From a159b601641aaba34b8dcaad3884599fd1e86a29 Mon Sep 17 00:00:00 2001 From: JishinMaster Date: Sat, 26 Jan 2019 19:44:06 +0100 Subject: [PATCH 1/3] Added the ability to launch transforms with offset for the input and output arrays --- src/client/client.cpp | 70 +- src/include/clFFT.h | 32 + src/library/accessors.cpp | 54 +- src/library/enqueue.cpp | 1270 ++++++++++++++-------------- src/library/generator.stockham.cpp | 64 +- src/library/plan.cpp | 8 +- src/library/plan.h | 12 +- 7 files changed, 799 insertions(+), 711 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index 052d326e..b96b5f16 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -45,6 +45,7 @@ std::basic_istream<_Elem, _Traits> & operator>> (std::basic_istream<_Elem, _Trai template < typename T > int transform( size_t* lengths, const size_t *inStrides, const size_t *outStrides, size_t batch_size, + size_t offsetIn, size_t offsetOut, clfftLayout in_layout, clfftLayout out_layout, clfftResultLocation place, clfftPrecision precision, clfftDirection dir, cl_device_type deviceType, cl_int deviceId, cl_int platformId, bool printInfo, @@ -66,6 +67,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride size_t outfftBatchSize = 0; size_t size_of_input_buffers_in_bytes = 0; size_t size_of_output_buffers_in_bytes = 0; + cl_uint number_of_output_buffers = 0; clfftDim dim = CLFFT_1D; cl_mem input_cl_mem_buffers [2] = { NULL, NULL }; @@ -139,23 +141,23 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride { case CLFFT_COMPLEX_INTERLEAVED: number_of_output_buffers = 1; - size_of_output_buffers_in_bytes = outfftBatchSize * sizeof( std::complex< T > ); + size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof( std::complex< T > ); break; case CLFFT_COMPLEX_PLANAR: number_of_output_buffers = 2; - size_of_output_buffers_in_bytes = outfftBatchSize * sizeof(T); + size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof(T); break; case CLFFT_HERMITIAN_INTERLEAVED: number_of_output_buffers = 1; - size_of_output_buffers_in_bytes = outfftBatchSize * sizeof( std::complex< T > ); + size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof( std::complex< T > ); break; case CLFFT_HERMITIAN_PLANAR: number_of_output_buffers = 2; - size_of_output_buffers_in_bytes = outfftBatchSize * sizeof(T); + size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof(T); break; case CLFFT_REAL: number_of_output_buffers = 1; - size_of_output_buffers_in_bytes = outfftBatchSize * sizeof(T); + size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof(T); break; } @@ -165,7 +167,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_COMPLEX_INTERLEAVED: { // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = fftBatchSize * sizeof( std::complex< T > ); + size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( std::complex< T > ); device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); createOpenCLCommandQueue( context, @@ -174,10 +176,10 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride size_of_input_buffers_in_bytes, 1, input_cl_mem_buffers, size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - std::vector< std::complex< T > > input( fftBatchSize ); + std::vector< std::complex< T > > input( fftBatchSize + offsetIn ); // set zero - for( cl_uint i = 0; i < fftBatchSize; ++i ) + for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) { input[ i ] = 0; } @@ -211,7 +213,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_COMPLEX_PLANAR: { // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = fftBatchSize * sizeof( T ); + size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( T ); device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); createOpenCLCommandQueue( context, @@ -220,11 +222,11 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride size_of_input_buffers_in_bytes, 2, input_cl_mem_buffers, size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - std::vector< T > real( fftBatchSize ); - std::vector< T > imag( fftBatchSize ); + std::vector< T > real( fftBatchSize + offsetIn ); + std::vector< T > imag( fftBatchSize + offsetIn ); // set zero - for( cl_uint i = 0; i < fftBatchSize; ++i ) + for( cl_uint i = 0; i < (fftBatchSize + offsetIn ); ++i ) { real[ i ] = 0; imag[ i ] = 0; @@ -261,7 +263,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_HERMITIAN_INTERLEAVED: { // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = fftBatchSize * sizeof( std::complex< T > ); + size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( std::complex< T > ); device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); createOpenCLCommandQueue( context, @@ -270,10 +272,10 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride size_of_input_buffers_in_bytes, 1, input_cl_mem_buffers, size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - std::vector< std::complex< T > > input( fftBatchSize ); + std::vector< std::complex< T > > input( fftBatchSize + offsetIn ); // set zero - for( cl_uint i = 0; i < fftBatchSize; ++i ) + for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) { input[ i ] = 0; } @@ -295,7 +297,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_HERMITIAN_PLANAR: { // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = fftBatchSize * sizeof( T ); + size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( T ); device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); createOpenCLCommandQueue( context, @@ -304,11 +306,11 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride size_of_input_buffers_in_bytes, 2, input_cl_mem_buffers, size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - std::vector< T > real( fftBatchSize ); - std::vector< T > imag( fftBatchSize ); + std::vector< T > real( fftBatchSize + offsetIn ); + std::vector< T > imag( fftBatchSize + offsetIn ); // set zero - for( cl_uint i = 0; i < fftBatchSize; ++i ) + for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) { real[ i ] = 0; imag[ i ] = 0; @@ -334,7 +336,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_REAL: { // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = fftBatchSize * sizeof( T ); + size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( T ); device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); createOpenCLCommandQueue( context, @@ -343,10 +345,10 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride size_of_input_buffers_in_bytes, 1, input_cl_mem_buffers, size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - std::vector< T > real( fftBatchSize ); + std::vector< T > real( fftBatchSize + offsetIn ); // set zero - for( cl_uint i = 0; i < fftBatchSize; ++i ) + for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) { real[ i ] = 0; } @@ -408,6 +410,9 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride OPENCL_V_THROW (clfftSetPlanOutStride ( plan_handle, dim, o_strides ), "clfftSetPlanOutStride failed" ); OPENCL_V_THROW (clfftSetPlanDistance ( plan_handle, strides[ 3 ], o_strides[ 3 ]), "clfftSetPlanDistance failed" ); + OPENCL_V_THROW (clfftSetPlanOffsetIn ( plan_handle, offsetIn ), "clfftSetPlanOffsetIn failed" ); + OPENCL_V_THROW (clfftSetPlanOffsetOut ( plan_handle, offsetOut ), "clfftSetPlanOffsetOut failed" ); + // Set backward scale factor to 1.0 for non real FFTs to do correct output checks if(dir == CLFFT_BACKWARD && in_layout != CLFFT_REAL && out_layout != CLFFT_REAL) OPENCL_V_THROW (clfftSetPlanScale( plan_handle, CLFFT_BACKWARD, (cl_float)1.0f ), "clfftSetPlanScale failed" ); @@ -594,7 +599,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_HERMITIAN_INTERLEAVED: case CLFFT_COMPLEX_INTERLEAVED: { - std::vector< std::complex< T > > output( outfftBatchSize ); + std::vector< std::complex< T > > output( outfftBatchSize + offsetOut ); if( place == CLFFT_INPLACE ) { @@ -610,7 +615,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride } //check output data - for( cl_uint i = 0; i < outfftBatchSize; ++i ) + for( cl_uint i = 0; i < ( outfftBatchSize + offsetOut ); ++i ) { if (0 == (i % outfftVectorSizePadded)) { @@ -640,8 +645,8 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride case CLFFT_HERMITIAN_PLANAR: case CLFFT_COMPLEX_PLANAR: { - std::valarray< T > real( outfftBatchSize ); - std::valarray< T > imag( outfftBatchSize ); + std::valarray< T > real( outfftBatchSize + offsetOut ); + std::valarray< T > imag( outfftBatchSize + offsetOut ); if( place == CLFFT_INPLACE ) { @@ -663,7 +668,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride } // Check output data - for( cl_uint i = 0; i < outfftBatchSize; ++i ) + for( cl_uint i = 0; i < ( outfftBatchSize + offsetOut ); ++i ) { if (0 == (i % outfftVectorSizePadded)) { @@ -692,7 +697,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride break; case CLFFT_REAL: { - std::valarray< T > real( outfftBatchSize ); + std::valarray< T > real( outfftBatchSize + offsetOut ); if( place == CLFFT_INPLACE ) { @@ -814,7 +819,8 @@ int _tmain( int argc, _TCHAR* argv[] ) cl_uint command_queue_flags = 0; size_t batchSize = 1; - + size_t offsetIn = 0; + size_t offsetOut = 0; // Initialize flags for FFT library std::auto_ptr< clfftSetupData > setupData( new clfftSetupData ); @@ -854,6 +860,8 @@ int _tmain( int argc, _TCHAR* argv[] ) ( "profile,p", po::value< cl_uint >( &profile_count )->default_value( 1 ), "Time and report the kernel speed of the FFT (default: profiling off)" ) ( "inLayout", po::value< clfftLayout >( &inLayout )->default_value( CLFFT_COMPLEX_INTERLEAVED ), "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian interleaved\n4) hermitian planar\n5) real" ) ( "outLayout", po::value< clfftLayout >( &outLayout )->default_value( CLFFT_COMPLEX_INTERLEAVED ), "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian interleaved\n4) hermitian planar\n5) real" ) + ( "offsetIn", po::value< size_t >( &offsetIn )->default_value( 0 ), "Input offset to be used in number of elements" ) + ( "offsetOut", po::value< size_t >( &offsetOut)->default_value( 0 ), "Output offset to be used in number of elements" ) ; po::variables_map vm; @@ -1028,9 +1036,9 @@ int _tmain( int argc, _TCHAR* argv[] ) } if( precision == CLFFT_SINGLE ) - transform( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData ); + transform( lengths, iStrides, oStrides, batchSize, offsetIn, offsetOut, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData ); else - transform( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData ); + transform( lengths, iStrides, oStrides, batchSize, offsetIn, offsetOut, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData ); } catch( std::exception& e ) { diff --git a/src/include/clFFT.h b/src/include/clFFT.h index cb68425a..66820008 100644 --- a/src/include/clFFT.h +++ b/src/include/clFFT.h @@ -341,6 +341,38 @@ extern "C" { */ CLFFTAPI clfftStatus clfftSetPlanPrecision( clfftPlanHandle plHandle, clfftPrecision precision ); + /*! @brief Set the offset in number of elements for the input array + * @details Sets the plan property which sets offset in number elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[in] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ + CLFFTAPI clfftStatus clfftSetPlanOffsetIn( clfftPlanHandle plHandle, size_t offsetIn ); + + /*! @brief Retrieve the offset in number of elements for the input array + * @details Queries a plan object and retrieves the value of the offset in number of elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[out] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ + CLFFTAPI clfftStatus clfftGetPlanOffsetIn( const clfftPlanHandle plHandle, size_t* offsetIn ); + + /*! @brief Retrieve the offset in number of elements for the output array + * @details Queries a plan object and retrieves the value of the offset in number of elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[out] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ + CLFFTAPI clfftStatus clfftSetPlanOffsetOut( clfftPlanHandle plHandle, size_t offsetOut ); + + /*! @brief Retrieve the offset in number of elements for the output array + * @details Queries a plan object and retrieves the value of the offset in number of elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[out] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ + CLFFTAPI clfftStatus clfftGetPlanOffsetOut( const clfftPlanHandle plHandle, size_t* offsetOut ); + /*! @brief Retrieve the scaling factor that is applied to the FFT data * @details The user must pass a reference to a cl_float variable, which is set to the * floating point scaling factor that is multiplied across the FFT data. diff --git a/src/library/accessors.cpp b/src/library/accessors.cpp index f7ccbcc6..ca428788 100644 --- a/src/library/accessors.cpp +++ b/src/library/accessors.cpp @@ -52,6 +52,58 @@ clfftStatus clfftSetPlanBatchSize( clfftPlanHandle plHandle, size_t batchsize ) return CLFFT_SUCCESS; } +clfftStatus clfftGetPlanOffsetIn( const clfftPlanHandle plHandle, size_t* offsetIn ) +{ + FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTPlan* fftPlan = NULL; + lockRAII* planLock = NULL; + + OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); + scopedLock sLock( *planLock, _T( "clfftGetPlanOffsetIn" ) ); + + *offsetIn = fftPlan->offsetIn; + return CLFFT_SUCCESS; +} + +clfftStatus clfftSetPlanOffsetIn( clfftPlanHandle plHandle, size_t offsetIn ) +{ + FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTPlan* fftPlan = NULL; + lockRAII* planLock = NULL; + + OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); + scopedLock sLock( *planLock, _T( "clfftSetPlanOffsetIn" ) ); + + fftPlan->offsetIn = offsetIn; + return CLFFT_SUCCESS; +} + +clfftStatus clfftGetPlanOffsetOut( const clfftPlanHandle plHandle, size_t* offsetOut ) +{ + FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTPlan* fftPlan = NULL; + lockRAII* planLock = NULL; + + OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); + scopedLock sLock( *planLock, _T( "clfftGetPlanOffsetIn" ) ); + + *offsetOut = fftPlan->offsetOut; + return CLFFT_SUCCESS; +} + +clfftStatus clfftSetPlanOffsetOut( clfftPlanHandle plHandle, size_t offsetOut ) +{ + FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTPlan* fftPlan = NULL; + lockRAII* planLock = NULL; + + OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); + scopedLock sLock( *planLock, _T( "clfftSetPlanOffsetIn" ) ); + + fftPlan->offsetOut = offsetOut; + return CLFFT_SUCCESS; +} + clfftStatus clfftGetPlanContext( const clfftPlanHandle plHandle, cl_context* context ) { FFTRepo& fftRepo = FFTRepo::getInstance( ); @@ -833,4 +885,4 @@ clfftStatus clfftSetPlanCallback(clfftPlanHandle plHandle, const char* funcName, } return CLFFT_SUCCESS; -} \ No newline at end of file +} diff --git a/src/library/enqueue.cpp b/src/library/enqueue.cpp index f5ee01b3..031d8ae6 100644 --- a/src/library/enqueue.cpp +++ b/src/library/enqueue.cpp @@ -30,473 +30,473 @@ FFTCopyAction::FFTCopyAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTAction(plan, err) +: FFTAction(plan, err) { - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } + if (err != CLFFT_SUCCESS) + { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } FFTTransposeGCNAction::FFTTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTAction(plan, err) +: FFTAction(plan, err) { - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } + if (err != CLFFT_SUCCESS) + { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } FFTTransposeSquareAction::FFTTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTAction(plan, err) +: FFTAction(plan, err) { - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } + if (err != CLFFT_SUCCESS) + { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } FFTTransposeNonSquareAction::FFTTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTAction(plan, err) +: FFTAction(plan, err) { - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } + if (err != CLFFT_SUCCESS) + { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } FFTStockhamAction::FFTStockhamAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTAction(plan, err) +: FFTAction(plan, err) { - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } + if (err != CLFFT_SUCCESS) + { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } FFTAction::FFTAction(FFTPlan * fftPlan, clfftStatus & err) - : plan(fftPlan) +: plan(fftPlan) { - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } clfftStatus FFTAction::selectBufferArguments(FFTPlan * fftPlan, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers, - std::vector< cl_mem > &inputBuff, - std::vector< cl_mem > &outputBuff) + cl_mem* clInputBuffers, + cl_mem* clOutputBuffers, + std::vector< cl_mem > &inputBuff, + std::vector< cl_mem > &outputBuff) { - - // 1d with normal length will fall into the below category - // add: 2d transpose kernel will fall into here too. - inputBuff.reserve( 2 ); - outputBuff.reserve( 2 ); - - // Decode the relevant properties from the plan paramter to figure out how many input/output buffers we have - switch( fftPlan->inputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - // Invalid to be an inplace transform, and go from 1 to 2 buffers - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_HERMITIAN_PLANAR: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_HERMITIAN_PLANAR: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_REAL: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - default: - { + + // 1d with normal length will fall into the below category + // add: 2d transpose kernel will fall into here too. + inputBuff.reserve( 2 ); + outputBuff.reserve( 2 ); + + // Decode the relevant properties from the plan paramter to figure out how many input/output buffers we have + switch( fftPlan->inputLayout ) + { + case CLFFT_COMPLEX_INTERLEAVED: + { + switch( fftPlan->outputLayout ) + { + case CLFFT_COMPLEX_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + // Invalid to be an inplace transform, and go from 1 to 2 buffers + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_REAL: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + default: + { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_COMPLEX_PLANAR: + { + switch( fftPlan->outputLayout ) + { + case CLFFT_COMPLEX_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_REAL: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + default: + { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + { + switch( fftPlan->outputLayout ) + { + case CLFFT_COMPLEX_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_HERMITIAN_PLANAR: + { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_REAL: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + default: + { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: + { + switch( fftPlan->outputLayout ) + { + case CLFFT_COMPLEX_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_HERMITIAN_PLANAR: + { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_REAL: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + inputBuff.push_back( clInputBuffers[ 1 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + default: + { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_REAL: + { + switch( fftPlan->outputLayout ) + { + case CLFFT_COMPLEX_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 0 ] ); + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: + { + if( fftPlan->placeness == CLFFT_INPLACE ) + { + return CLFFT_INVALID_ARG_VALUE; + } + else + { + inputBuff.push_back( clInputBuffers[ 0 ] ); + + outputBuff.push_back( clOutputBuffers[ 0 ] ); + outputBuff.push_back( clOutputBuffers[ 1 ] ); + } + + break; + } + default: + { if(fftPlan->transflag) { if( fftPlan->placeness == CLFFT_INPLACE ) @@ -514,94 +514,94 @@ clfftStatus FFTAction::selectBufferArguments(FFTPlan * fftPlan, // Don't recognize output layout return CLFFT_INVALID_ARG_VALUE; } - } - } + } + } - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } + break; + } + default: + { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, - clfftDirection dir, - cl_uint numQueuesAndEvents, - cl_command_queue* commQueues, - cl_uint numWaitEvents, - const cl_event* waitEvents, - cl_event* outEvents, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers) + clfftDirection dir, + cl_uint numQueuesAndEvents, + cl_command_queue* commQueues, + cl_uint numWaitEvents, + const cl_event* waitEvents, + cl_event* outEvents, + cl_mem* clInputBuffers, + cl_mem* clOutputBuffers) { - FFTRepo & fftRepo = FFTRepo::getInstance(); + FFTRepo & fftRepo = FFTRepo::getInstance(); - std::vector< cl_mem > inputBuff; - std::vector< cl_mem > outputBuff; + std::vector< cl_mem > inputBuff; + std::vector< cl_mem > outputBuff; - clfftStatus status = selectBufferArguments(this->plan, - clInputBuffers, clOutputBuffers, - inputBuff, outputBuff); + clfftStatus status = selectBufferArguments(this->plan, + clInputBuffers, clOutputBuffers, + inputBuff, outputBuff); - if (status != CLFFT_SUCCESS) - { - return status; - } - - // TODO: In the case of length == 1, FFT is a trivial NOP, but we still need to apply the forward and backwards tranforms - // TODO: Are map lookups expensive to call here? We can cache a pointer to the cl_program/cl_kernel in the plan + if (status != CLFFT_SUCCESS) + { + return status; + } - // Translate the user plan into the structure that we use to map plans to clPrograms + // TODO: In the case of length == 1, FFT is a trivial NOP, but we still need to apply the forward and backwards tranforms + // TODO: Are map lookups expensive to call here? We can cache a pointer to the cl_program/cl_kernel in the plan - cl_program prog; - cl_kernel kern; + // Translate the user plan into the structure that we use to map plans to clPrograms + + cl_program prog; + cl_kernel kern; lockRAII* kernelLock; - OPENCL_V( fftRepo.getclProgram( this->getGenerator(), this->getSignatureData(), prog, this->plan->bakeDevice, this->plan->context ), _T( "fftRepo.getclProgram failed" ) ); - OPENCL_V( fftRepo.getclKernel( prog, dir, kern, kernelLock), _T( "fftRepo.getclKernels failed" ) ); + OPENCL_V( fftRepo.getclProgram( this->getGenerator(), this->getSignatureData(), prog, this->plan->bakeDevice, this->plan->context ), _T( "fftRepo.getclProgram failed" ) ); + OPENCL_V( fftRepo.getclKernel( prog, dir, kern, kernelLock), _T( "fftRepo.getclKernels failed" ) ); scopedLock sLock(*kernelLock, _T("FFTAction::enqueue")); - cl_uint uarg = 0; - if (!this->plan->transflag && !(this->plan->gen == Copy)) - { - // ::clSetKernelArg() is not thread safe, according to the openCL spec for the same cl_kernel object - // TODO: Need to verify that two different plans (which would get through our lock above) with exactly the same - // parameters would NOT share the same cl_kernel objects - - /* constant buffer */ - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->const_buffer ), _T( "clSetKernelArg failed" ) ); - } - - // Input buffer(s) - // Input may be 1 buffer (CLFFT_COMPLEX_INTERLEAVED) - // or 2 buffers (CLFFT_COMPLEX_PLANAR) - - for (size_t i = 0; i < inputBuff.size(); ++i) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&inputBuff[i] ), _T( "clSetKernelArg failed" ) ); - } - // Output buffer(s) - // Output may be 0 buffers (CLFFT_INPLACE) - // or 1 buffer (CLFFT_COMPLEX_INTERLEAVED) - // or 2 buffers (CLFFT_COMPLEX_PLANAR) - for (size_t o = 0; o < outputBuff.size(); ++o) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&outputBuff[o] ), _T( "clSetKernelArg failed" ) ); - } + cl_uint uarg = 0; + if (!this->plan->transflag && !(this->plan->gen == Copy)) + { + // ::clSetKernelArg() is not thread safe, according to the openCL spec for the same cl_kernel object + // TODO: Need to verify that two different plans (which would get through our lock above) with exactly the same + // parameters would NOT share the same cl_kernel objects + + /* constant buffer */ + OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->const_buffer ), _T( "clSetKernelArg failed" ) ); + } + + // Input buffer(s) + // Input may be 1 buffer (CLFFT_COMPLEX_INTERLEAVED) + // or 2 buffers (CLFFT_COMPLEX_PLANAR) + + for (size_t i = 0; i < inputBuff.size(); ++i) + { + OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&inputBuff[i] ), _T( "clSetKernelArg failed" ) ); + } + // Output buffer(s) + // Output may be 0 buffers (CLFFT_INPLACE) + // or 1 buffer (CLFFT_COMPLEX_INTERLEAVED) + // or 2 buffers (CLFFT_COMPLEX_PLANAR) + for (size_t o = 0; o < outputBuff.size(); ++o) + { + OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&outputBuff[o] ), _T( "clSetKernelArg failed" ) ); + } //If callback function is set for the plan, pass the appropriate aruments if (this->plan->hasPreCallback || this->plan->hasPostCallback) { - if (this->plan->hasPreCallback) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->precallUserData ), _T( "clSetKernelArg failed" ) ); + if (this->plan->hasPreCallback) + { + OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->precallUserData ), _T( "clSetKernelArg failed" ) ); } //If post-callback function is set for the plan, pass the appropriate aruments @@ -612,7 +612,7 @@ clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, //Pass LDS size arument if set if ((this->plan->hasPreCallback && this->plan->preCallback.localMemSize > 0) || - (this->plan->hasPostCallback && this->plan->postCallbackParam.localMemSize > 0)) + (this->plan->hasPostCallback && this->plan->postCallbackParam.localMemSize > 0)) { int localmemSize = 0; if (this->plan->hasPreCallback && this->plan->preCallback.localMemSize > 0) @@ -624,9 +624,12 @@ clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, } } - std::vector< size_t > gWorkSize; - std::vector< size_t > lWorkSize; - clfftStatus result = this->getWorkSizes (gWorkSize, lWorkSize); + OPENCL_V( clSetKernelArg( kern, uarg++, sizeof(int), (void*)&this->plan->offsetIn ), _T( "clSetKernelArg failed" ) ); + OPENCL_V( clSetKernelArg( kern, uarg++, sizeof(int), (void*)&this->plan->offsetOut ), _T( "clSetKernelArg failed" ) ); + + std::vector< size_t > gWorkSize; + std::vector< size_t > lWorkSize; + clfftStatus result = this->getWorkSizes (gWorkSize, lWorkSize); //std::cout << "work sizes are " << gWorkSize[0] << ", " << lWorkSize[0] << std::endl; /* std::cout << "work sizes are "; @@ -636,34 +639,33 @@ clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, for (auto itor = lWorkSize.begin(); itor != lWorkSize.end(); itor++) std::cout << *itor << " "; std::cout << std::endl; - */ - // TODO: if getWorkSizes returns CLFFT_INVALID_GLOBAL_WORK_SIZE, that means - // that this multidimensional input data array is too large to be transformed - // with a single call to clEnqueueNDRangeKernel. For now, we will just return - // the error code back up the call stack. - // The *correct* course of action would be to split the work into mutliple - // calls to clEnqueueNDRangeKernel. - if (CLFFT_INVALID_GLOBAL_WORK_SIZE == result) - { - OPENCL_V( result, _T("Work size too large for clEnqueNDRangeKernel()")); - } - else - { - OPENCL_V( result, _T("FFTAction::getWorkSizes failed")); - } - BUG_CHECK (gWorkSize.size() == lWorkSize.size()); - - - cl_int call_status = clEnqueueNDRangeKernel( *commQueues, kern, static_cast< cl_uint >( gWorkSize.size( ) ), - NULL, &gWorkSize[ 0 ], &lWorkSize[ 0 ], numWaitEvents, waitEvents, outEvents ); - OPENCL_V( call_status, _T( "clEnqueueNDRangeKernel failed" ) ); - - if( fftRepo.pStatTimer ) - { - fftRepo.pStatTimer->AddSample( plHandle, this->plan, kern, numQueuesAndEvents, outEvents, gWorkSize, lWorkSize ); - } - - return CLFFT_SUCCESS; + */ + // TODO: if getWorkSizes returns CLFFT_INVALID_GLOBAL_WORK_SIZE, that means + // that this multidimensional input data array is too large to be transformed + // with a single call to clEnqueueNDRangeKernel. For now, we will just return + // the error code back up the call stack. + // The *correct* course of action would be to split the work into mutliple + // calls to clEnqueueNDRangeKernel. + if (CLFFT_INVALID_GLOBAL_WORK_SIZE == result) + { + OPENCL_V( result, _T("Work size too large for clEnqueNDRangeKernel()")); + } + else + { + OPENCL_V( result, _T("FFTAction::getWorkSizes failed")); + } + BUG_CHECK (gWorkSize.size() == lWorkSize.size()); + + cl_int call_status = clEnqueueNDRangeKernel( *commQueues, kern, static_cast< cl_uint >( gWorkSize.size( ) ), + NULL, &gWorkSize[ 0 ], &lWorkSize[ 0 ], numWaitEvents, waitEvents, outEvents ); + OPENCL_V( call_status, _T( "clEnqueueNDRangeKernel failed" ) ); + + if( fftRepo.pStatTimer ) + { + fftRepo.pStatTimer->AddSample( plHandle, this->plan, kern, numQueuesAndEvents, outEvents, gWorkSize, lWorkSize ); + } + + return CLFFT_SUCCESS; } @@ -671,24 +673,24 @@ clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, // Read the kernels that this plan uses from file, and store into the plan clfftStatus FFTAction::writeKernel( const clfftPlanHandle plHandle, const clfftGenerators gen, const FFTKernelSignatureHeader* data, const cl_context& context, const cl_device_id &device ) { - FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTRepo& fftRepo = FFTRepo::getInstance( ); - std::string kernelPath = getKernelName(gen, plHandle, true); + std::string kernelPath = getKernelName(gen, plHandle, true); - // Logic to write string contents out to file - tofstreamRAII< std::ofstream, std::string > kernelFile( kernelPath.c_str( ) ); - if( !kernelFile.get( ) ) - { - std::cerr << "Failed to open kernel file for writing: " << kernelPath.c_str( ) << std::endl; - return CLFFT_FILE_CREATE_FAILURE; - } + // Logic to write string contents out to file + tofstreamRAII< std::ofstream, std::string > kernelFile( kernelPath.c_str( ) ); + if( !kernelFile.get( ) ) + { + std::cerr << "Failed to open kernel file for writing: " << kernelPath.c_str( ) << std::endl; + return CLFFT_FILE_CREATE_FAILURE; + } - std::string kernel; - OPENCL_V( fftRepo.getProgramCode( gen, data, kernel, device, context ), _T( "fftRepo.getProgramCode failed." ) ); + std::string kernel; + OPENCL_V( fftRepo.getProgramCode( gen, data, kernel, device, context ), _T( "fftRepo.getProgramCode failed." ) ); - kernelFile.get( ) << kernel << std::endl; + kernelFile.get( ) << kernel << std::endl; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } @@ -700,131 +702,131 @@ clfftStatus FFTAction::writeKernel( const clfftPlanHandle plHandle, const clfftG // Compile the kernels that this plan uses, and store into the plan clfftStatus FFTAction::compileKernels( const cl_command_queue commQueueFFT, const clfftPlanHandle plHandle, FFTPlan* fftPlan ) { - cl_int status = 0; - size_t deviceListSize = 0; + cl_int status = 0; + size_t deviceListSize = 0; - FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTRepo& fftRepo = FFTRepo::getInstance( ); - // create a cl program executable for the device associated with command queue - // Get the device - cl_device_id &q_device = fftPlan->bakeDevice; + // create a cl program executable for the device associated with command queue + // Get the device + cl_device_id &q_device = fftPlan->bakeDevice; - cl_program program; - if( fftRepo.getclProgram( this->getGenerator(), this->getSignatureData(), program, q_device, fftPlan->context ) == CLFFT_INVALID_PROGRAM ) - { - FFTBinaryLookup lookup (this->getGenerator(), plHandle, fftPlan->context, q_device); + cl_program program; + if( fftRepo.getclProgram( this->getGenerator(), this->getSignatureData(), program, q_device, fftPlan->context ) == CLFFT_INVALID_PROGRAM ) + { + FFTBinaryLookup lookup (this->getGenerator(), plHandle, fftPlan->context, q_device); - lookup.variantRaw(this->getSignatureData(), this->getSignatureData()->datasize); + lookup.variantRaw(this->getSignatureData(), this->getSignatureData()->datasize); - if (lookup.found()) - { + if (lookup.found()) + { #if FFT_CACHE_DEBUG - // debug message in debug mode to ensure that the cache is used - fprintf(stderr, "Kernel loaded from cache\n"); + // debug message in debug mode to ensure that the cache is used + fprintf(stderr, "Kernel loaded from cache\n"); #endif - program = lookup.getProgram(); - } - else - { + program = lookup.getProgram(); + } + else + { #if FFT_CACHE_DEBUG - fprintf(stderr, "Kernel built from source\n"); + fprintf(stderr, "Kernel built from source\n"); #endif - // If the user wishes us to write the kernels out to disk, we do so - if( fftRepo.setupData.debugFlags & CLFFT_DUMP_PROGRAMS ) - { - OPENCL_V( writeKernel( plHandle, this->getGenerator(), this->getSignatureData(), fftPlan->context, fftPlan->bakeDevice ), _T( "writeKernel failed." ) ); - } + // If the user wishes us to write the kernels out to disk, we do so + //if( fftRepo.setupData.debugFlags & CLFFT_DUMP_PROGRAMS ) + //{ + OPENCL_V( writeKernel( plHandle, this->getGenerator(), this->getSignatureData(), fftPlan->context, fftPlan->bakeDevice ), _T( "writeKernel failed." ) ); + //} - std::string programCode; - OPENCL_V( fftRepo.getProgramCode( this->getGenerator(), this->getSignatureData(), programCode, q_device, fftPlan->context ), _T( "fftRepo.getProgramCode failed." ) ); + std::string programCode; + OPENCL_V( fftRepo.getProgramCode( this->getGenerator(), this->getSignatureData(), programCode, q_device, fftPlan->context ), _T( "fftRepo.getProgramCode failed." ) ); - const char* source = programCode.c_str(); - program = clCreateProgramWithSource( fftPlan->context, 1, &source, NULL, &status ); - OPENCL_V( status, _T( "clCreateProgramWithSource failed." ) ); + const char* source = programCode.c_str(); + program = clCreateProgramWithSource( fftPlan->context, 1, &source, NULL, &status ); + OPENCL_V( status, _T( "clCreateProgramWithSource failed." ) ); - // create a cl program executable for the device associated with command queue + // create a cl program executable for the device associated with command queue #if defined(DEBUGGING) - status = clBuildProgram( program, 1, &q_device, "-g -cl-opt-disable", NULL, NULL); // good for debugging kernels + status = clBuildProgram( program, 1, &q_device, "-g -cl-opt-disable", NULL, NULL); // good for debugging kernels -// if you have trouble creating smbols that GDB can pick up to set a breakpoint after kernels are loaded into memory -// this can be used to stop execution to allow you to set a breakpoint in a kernel after kernel symbols are in memory. + // if you have trouble creating smbols that GDB can pick up to set a breakpoint after kernels are loaded into memory + // this can be used to stop execution to allow you to set a breakpoint in a kernel after kernel symbols are in memory. #ifdef DEBUG_BREAK_GDB - __debugbreak(); + __debugbreak(); #endif #else - status = clBuildProgram( program, 1, &q_device, "", NULL, NULL); + status = clBuildProgram( program, 1, &q_device, "", NULL, NULL); #endif - if( status != CL_SUCCESS ) - { - if( status == CL_BUILD_PROGRAM_FAILURE ) - { - size_t buildLogSize = 0; - OPENCL_V( clGetProgramBuildInfo( program, q_device, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildLogSize ), - _T( "clGetProgramBuildInfo failed" ) ); + if( status != CL_SUCCESS ) + { + if( status == CL_BUILD_PROGRAM_FAILURE ) + { + size_t buildLogSize = 0; + OPENCL_V( clGetProgramBuildInfo( program, q_device, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildLogSize ), + _T( "clGetProgramBuildInfo failed" ) ); - std::vector< char > buildLog( buildLogSize ); - ::memset( &buildLog[ 0 ], 0x0, buildLogSize ); + std::vector< char > buildLog( buildLogSize ); + ::memset( &buildLog[ 0 ], 0x0, buildLogSize ); - OPENCL_V( clGetProgramBuildInfo( program, q_device, CL_PROGRAM_BUILD_LOG, buildLogSize, &buildLog[ 0 ], NULL ), - _T( "clGetProgramBuildInfo failed" ) ); + OPENCL_V( clGetProgramBuildInfo( program, q_device, CL_PROGRAM_BUILD_LOG, buildLogSize, &buildLog[ 0 ], NULL ), + _T( "clGetProgramBuildInfo failed" ) ); - std::cerr << "\n\t\t\tBUILD LOG\n"; - std::cerr << "************************************************\n"; - std::cerr << &buildLog[ 0 ] << std::endl; - std::cerr << "************************************************\n"; - } + std::cerr << "\n\t\t\tBUILD LOG\n"; + std::cerr << "************************************************\n"; + std::cerr << &buildLog[ 0 ] << std::endl; + std::cerr << "************************************************\n"; + } - OPENCL_V( status, _T( "clBuildProgram failed" ) ); - } + OPENCL_V( status, _T( "clBuildProgram failed" ) ); + } - lookup.setProgram(program, source); - lookup.populateCache(); - } + lookup.setProgram(program, source); + lookup.populateCache(); + } - fftRepo.setclProgram( this->getGenerator(), this->getSignatureData(), program, q_device, fftPlan->context ); + fftRepo.setclProgram( this->getGenerator(), this->getSignatureData(), program, q_device, fftPlan->context ); - // For real transforms we compile either forward or backward kernel - bool buildFwdKernel = buildForwardKernel(); - bool buildBwdKernel = buildBackwardKernel(); + // For real transforms we compile either forward or backward kernel + bool buildFwdKernel = buildForwardKernel(); + bool buildBwdKernel = buildBackwardKernel(); - // get a kernel object handle for a kernel with the given name - cl_kernel kernel; - if( buildFwdKernel ) - { + // get a kernel object handle for a kernel with the given name + cl_kernel kernel; + if( buildFwdKernel ) + { lockRAII *kernelLock; - if( fftRepo.getclKernel( program, CLFFT_FORWARD, kernel, kernelLock) == CLFFT_INVALID_KERNEL ) - { - std::string entryPoint; - OPENCL_V( fftRepo.getProgramEntryPoint( this->getGenerator(), this->getSignatureData(), CLFFT_FORWARD, entryPoint, q_device, fftPlan->context ), _T( "fftRepo.getProgramEntryPoint failed." ) ); + if( fftRepo.getclKernel( program, CLFFT_FORWARD, kernel, kernelLock) == CLFFT_INVALID_KERNEL ) + { + std::string entryPoint; + OPENCL_V( fftRepo.getProgramEntryPoint( this->getGenerator(), this->getSignatureData(), CLFFT_FORWARD, entryPoint, q_device, fftPlan->context ), _T( "fftRepo.getProgramEntryPoint failed." ) ); - kernel = clCreateKernel( program, entryPoint.c_str( ), &status ); - OPENCL_V( status, _T( "clCreateKernel failed" ) ); + kernel = clCreateKernel( program, entryPoint.c_str( ), &status ); + OPENCL_V( status, _T( "clCreateKernel failed" ) ); - fftRepo.setclKernel( program, CLFFT_FORWARD, kernel ); - } - } + fftRepo.setclKernel( program, CLFFT_FORWARD, kernel ); + } + } - if( buildBwdKernel ) - { + if( buildBwdKernel ) + { lockRAII *kernelLock; - if( fftRepo.getclKernel( program, CLFFT_BACKWARD, kernel, kernelLock ) == CLFFT_INVALID_KERNEL ) - { - std::string entryPoint; - OPENCL_V( fftRepo.getProgramEntryPoint( this->getGenerator(), this->getSignatureData(), CLFFT_BACKWARD, entryPoint, q_device, fftPlan->context ), _T( "fftRepo.getProgramEntryPoint failed." ) ); + if( fftRepo.getclKernel( program, CLFFT_BACKWARD, kernel, kernelLock ) == CLFFT_INVALID_KERNEL ) + { + std::string entryPoint; + OPENCL_V( fftRepo.getProgramEntryPoint( this->getGenerator(), this->getSignatureData(), CLFFT_BACKWARD, entryPoint, q_device, fftPlan->context ), _T( "fftRepo.getProgramEntryPoint failed." ) ); - kernel = clCreateKernel( program, entryPoint.c_str( ), &status ); - OPENCL_V( status, _T( "clCreateKernel failed" ) ); + kernel = clCreateKernel( program, entryPoint.c_str( ), &status ); + OPENCL_V( status, _T( "clCreateKernel failed" ) ); - fftRepo.setclKernel( program, CLFFT_BACKWARD, kernel ); - } - } - } + fftRepo.setclKernel( program, CLFFT_BACKWARD, kernel ); + } + } + } - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } diff --git a/src/library/generator.stockham.cpp b/src/library/generator.stockham.cpp index 6368b083..968cb644 100644 --- a/src/library/generator.stockham.cpp +++ b/src/library/generator.stockham.cpp @@ -2801,6 +2801,9 @@ namespace StockhamGenerator size_t workGroupSize; // Work group size size_t cnPerWI; // complex numbers per work-item + size_t offsetIn; + size_t offsetOut; + size_t numTrans; // Number of transforms per work-group size_t workGroupSizePerTrans; // Work group subdivision per transform size_t numPasses; // Number of FFT passes @@ -2936,6 +2939,11 @@ namespace StockhamGenerator } str += "\t"; str += off; str += " = "; + + str += " "; + str += input ? "offsetIn" : "offsetOut"; + str += " + "; + std::string nextBatch = batch; for(size_t i=(params.fft_DataDim - 1); i>1; i--) { @@ -2959,6 +2967,10 @@ namespace StockhamGenerator { length = params.fft_N[0]; + + offsetIn = params.fft_offsetIn; + offsetIn = params.fft_offsetOut; + workGroupSize = params.fft_SIMD; numTrans = (workGroupSize * params.fft_R) / length; @@ -3490,6 +3502,7 @@ namespace StockhamGenerator clGetDeviceInfo(Dev_ID, CL_DEVICE_VENDOR, SizeParam_ret, nameVendor, NULL); //nv compiler doesn't support __constant kernel argument + // TODO : works with CUDA 10.0, so might not be true anymore if (strncmp(nameVendor, "NVIDIA",6)!=0) str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; else @@ -3517,7 +3530,6 @@ namespace StockhamGenerator callbackstr += ", __local void* localmem"; } } - // Function attributes if(params.fft_placeness == CLFFT_INPLACE) { @@ -3531,14 +3543,6 @@ namespace StockhamGenerator { str += "__global "; str += rType; str += " * restrict gb"; } - - //If plan has callback - if (hasCallback) - { - str += callbackstr; - } - - str += ")\n"; } else { @@ -3549,27 +3553,11 @@ namespace StockhamGenerator if(inInterleaved) { str += "__global "; str += r2Type; str += " * restrict gb"; - - //If plan has callback - if (hasCallback) - { - str += callbackstr; - } - - str += ")\n"; } else { str += "__global "; str += rType; str += " * restrict gbRe, "; str += "__global "; str += rType; str += " * restrict gbIm"; - - //If plan has callback - if (hasCallback) - { - str += callbackstr; - } - - str += ")\n"; } } } @@ -3604,14 +3592,6 @@ namespace StockhamGenerator str += "__global "; str += rType; str += " * restrict gbOutRe, "; str += "__global "; str += rType; str += " * restrict gbOutIm"; } - - //If plan has callback - if (hasCallback) - { - str += callbackstr; - } - - str += ")\n"; } else { @@ -3634,17 +3614,17 @@ namespace StockhamGenerator str += "__global "; str += rType; str += " * restrict gbOutRe, "; str += "__global "; str += rType; str += " * restrict gbOutIm"; } - - //If plan has callback - if (hasCallback) - { - str += callbackstr; - } - - str += ")\n"; } } + //If plan has callback + if (hasCallback) + { + str += callbackstr; + } + str += ", const int offsetIn, const int offsetOut "; + str += ")\n"; + str += "{\n"; // Initialize @@ -4504,6 +4484,8 @@ clfftStatus FFTGeneratedStockhamAction::initParams () this->signature.fft_placeness = this->plan->placeness; this->signature.fft_inputLayout = this->plan->inputLayout; this->signature.fft_MaxWorkGroupSize = this->plan->envelope.limit_WorkGroupSize; + this->signature.fft_offsetIn = this->plan->offsetIn; + this->signature.fft_offsetOut = this->plan->offsetOut; ARG_CHECK(this->plan->length.size() > 0); ARG_CHECK(this->plan->inStride.size() > 0); diff --git a/src/library/plan.cpp b/src/library/plan.cpp index 99cf97ac..a3a1908f 100644 --- a/src/library/plan.cpp +++ b/src/library/plan.cpp @@ -31,9 +31,9 @@ using std::vector; -const std::string beginning_of_binary( "<[£_beginning_of_binary_£]>" ); -const std::string end_of_binary( "<[£_I_may_be_a_sorry_case,_but_I_don't_write_jokes_in_base_13_£]>" ); -const std::string end_of_file( "<[£_You're_off_the_edge_of_the_map,_mate._Here_there_be_monsters_£]>" ); +const std::string beginning_of_binary( "<[�_beginning_of_binary_�]>" ); +const std::string end_of_binary( "<[�_I_may_be_a_sorry_case,_but_I_don't_write_jokes_in_base_13_�]>" ); +const std::string end_of_file( "<[�_You're_off_the_edge_of_the_map,_mate._Here_there_be_monsters_�]>" ); static bool pow235(size_t num, size_t &pow2, size_t &pow3, size_t &pow5) { @@ -273,6 +273,8 @@ clfftStatus clfftCreateDefaultPlanInternal( clfftPlanHandle* plHandle, cl_contex fftPlan->backwardScale = 1.0 / static_cast< double >( lenX * lenY * lenZ ); fftPlan->batchsize = 1; fftPlan->gen = Stockham; //default setting + fftPlan->offsetIn = 0; + fftPlan->offsetOut = 0; OPENCL_V(fftPlan->SetEnvelope(), _T("SetEnvelope failed")); diff --git a/src/library/plan.h b/src/library/plan.h index 8368e5fe..f1616096 100644 --- a/src/library/plan.h +++ b/src/library/plan.h @@ -151,6 +151,9 @@ struct FFTKernelGenKeyParams { double fft_fwdScale; double fft_backScale; + size_t fft_offsetIn; + size_t fft_offsetOut; + size_t fft_SIMD; // Assume this SIMD/workgroup size size_t fft_LDSsize; // Limit the use of LDS to this many bytes. size_t fft_R; // # of complex values to keep in working registers @@ -218,6 +221,9 @@ struct FFTKernelGenKeyParams { fft_3StepTwiddle = false; fft_twiddleFront = false; + fft_offsetIn = 0; + fft_offsetOut = 0; + transOutHorizontal = false; fft_realSpecial = false; @@ -415,6 +421,9 @@ class FFTPlan size_t iDist, oDist; size_t batchsize; + size_t offsetIn; + size_t offsetOut; + // Note the device passed to BakePlan, assuming we are baking for one device // TODO, change this logic for handling multiple GPUs/devices cl_device_id bakeDevice; @@ -575,10 +584,11 @@ class FFTPlan , plHandle(0) , hasPreCallback(false) , hasPostCallback(false) + , offsetIn(0) + , offsetOut(0) { }; - size_t ElementSize() const; clfftStatus AllocateBuffers (); From 0ea8ab7457ae6e5e819f0bb1b633fac72cae285b Mon Sep 17 00:00:00 2001 From: JishinMaster Date: Mon, 28 Jan 2019 21:03:23 +0100 Subject: [PATCH 2/3] Added the offset parameters in the transpose kernels --- src/library/generator.stockham.cpp | 2 +- src/library/generator.transpose.cpp | 17 +++++++++++++---- src/library/generator.transpose.gcn.cpp | 8 +++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/library/generator.stockham.cpp b/src/library/generator.stockham.cpp index 968cb644..83583514 100644 --- a/src/library/generator.stockham.cpp +++ b/src/library/generator.stockham.cpp @@ -3507,7 +3507,7 @@ namespace StockhamGenerator str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; else str += "__global cb_t *cb, "; - + // str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; delete [] nameVendor; //If plan has pre/post callback diff --git a/src/library/generator.transpose.cpp b/src/library/generator.transpose.cpp index 03cdbe00..f7e37484 100644 --- a/src/library/generator.transpose.cpp +++ b/src/library/generator.transpose.cpp @@ -31,8 +31,9 @@ void OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyParams& par const size_t *stride = input ? params.fft_inStride : params.fft_outStride; std::string offset = input ? "iOffset" : "oOffset"; - - clKernWrite(transKernel, 3) << "size_t " << offset << " = 0;" << std::endl; + + std::string offsetInOut = input ? "offsetIn" : "offsetOut"; + clKernWrite( transKernel, 3 ) << "size_t " << offset << " = " << offsetInOut << " ;" << std::endl; clKernWrite(transKernel, 3) << "g_index = get_group_id(0);" << std::endl; for (size_t i = params.fft_DataDim - 2; i > 0; i--) @@ -50,7 +51,8 @@ void OffsetCalcLeadingDimensionBatched(std::stringstream& transKernel, const FFT const size_t *stride = params.fft_inStride; std::string offset = "iOffset"; - clKernWrite(transKernel, 3) << "size_t " << offset << " = 0;" << std::endl; + + clKernWrite(transKernel, 3) << "size_t " << offset << " = offsetIn;" << std::endl; clKernWrite(transKernel, 3) << "g_index = get_group_id(0);" << std::endl; for (size_t i = params.fft_DataDim - 2; i > 0; i--) @@ -68,7 +70,8 @@ void Swap_OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyParams const size_t *stride = params.fft_inStride; std::string offset = "iOffset"; - clKernWrite(transKernel, 3) << "size_t " << offset << " = 0;" << std::endl; + + clKernWrite(transKernel, 3) << "size_t " << offset << " = offsetOut;" << std::endl; for (size_t i = params.fft_DataDim - 2; i > 0; i--) { @@ -246,6 +249,9 @@ clfftStatus genTransposePrototype(const FFTGeneratedTransposeSquareAction::Signa } } + + clKernWrite( transKernel, 0 ) << ", const int offsetIn, const int offsetOut "; + // Close the method signature clKernWrite(transKernel, 0) << " )\n{" << std::endl; return CLFFT_SUCCESS; @@ -316,6 +322,9 @@ clfftStatus genTransposePrototypeLeadingDimensionBatched(const FFTGeneratedTrans // Close the method signature + + clKernWrite( transKernel, 0 ) << ", const int offsetIn, const int offsetOut "; + clKernWrite(transKernel, 0) << " )\n{" << std::endl; return CLFFT_SUCCESS; } diff --git a/src/library/generator.transpose.gcn.cpp b/src/library/generator.transpose.gcn.cpp index 6fc74724..3e642458 100644 --- a/src/library/generator.transpose.gcn.cpp +++ b/src/library/generator.transpose.gcn.cpp @@ -125,8 +125,10 @@ static void OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyPara const size_t *stride = input ? params.fft_inStride : params.fft_outStride; std::string offset = input ? "iOffset" : "oOffset"; + + std::string offsetInOut = input ? "offsetIn" : "offsetOut"; + clKernWrite( transKernel, 3 ) << "size_t " << offset << " = " << offsetInOut << " ;" << std::endl; - clKernWrite( transKernel, 3 ) << "size_t " << offset << " = 0;" << std::endl; clKernWrite( transKernel, 3 ) << "currDimIndex = groupIndex.y;" << std::endl; @@ -344,6 +346,10 @@ static clfftStatus genTransposePrototype( const FFTGeneratedTransposeGCNAction:: } // Close the method signature + + + clKernWrite( transKernel, 0 ) << ", const int offsetIn, const int offsetOut "; + clKernWrite( transKernel, 0 ) << " )\n{" << std::endl; return CLFFT_SUCCESS; From b22bef6eab6f22ee5cd6d589177af6b829644a84 Mon Sep 17 00:00:00 2001 From: JishinMaster Date: Sun, 23 Aug 2020 18:45:08 +0200 Subject: [PATCH 3/3] Applied clang-format-11 and clang-tidy-11 --- src/CMakeLists.txt | 2 +- src/callback-client/callback-client.cpp | 1182 +- src/callback-client/client.h | 217 +- src/callback-client/openCL.misc.cpp | 1029 +- src/callback-client/openCL.misc.h | 173 +- src/callback-client/stdafx.cpp | 1 - src/client/client.cpp | 2025 +- src/client/client.h | 78 +- src/client/openCL.misc.cpp | 1039 +- src/client/openCL.misc.h | 173 +- src/client/stdafx.cpp | 1 - src/examples/fft1d.c | 227 +- src/examples/fft2d.c | 213 +- src/examples/fft3d.c | 245 +- src/include/clAmdFft.h | 1040 +- src/include/clAmdFft.version.h | 12 +- src/include/clFFT.h | 1258 +- src/include/clFFT.version.h.in | 1 - src/include/convenienceFunctions.h | 11 +- src/include/sharedLibrary.h | 111 +- src/include/stdafx.h | 32 +- src/include/targetver.h | 6 +- src/include/unicode.compatibility.h | 64 +- src/library/accessors.cpp | 1451 +- src/library/action.h | 231 +- src/library/action.transpose.cpp | 1324 +- src/library/action.transpose.h | 5 +- src/library/dllmain.cpp | 26 +- src/library/enqueue.cpp | 1452 +- src/library/fft_binary_lookup.cpp | 959 +- src/library/fft_binary_lookup.h | 361 +- src/library/generator.copy.cpp | 1235 +- src/library/generator.h | 22 +- src/library/generator.stockham.cpp | 10019 ++++----- src/library/generator.stockham.h | 2861 +-- src/library/generator.transpose.cpp | 7908 +++---- src/library/generator.transpose.gcn.cpp | 2314 ++- src/library/generator.transpose.gcn.h | 5 +- src/library/generator.transpose.h | 87 +- src/library/lifetime.cpp | 140 +- src/library/lock.h | 406 +- src/library/mainpage.h | 733 +- src/library/md5sum.c | 471 +- src/library/md5sum.h | 10 +- src/library/plan.cpp | 9494 ++++----- src/library/plan.h | 1013 +- src/library/private.h | 582 +- src/library/repo.cpp | 609 +- src/library/repo.h | 414 +- src/library/stdafx.cpp | 1 - src/library/transform.cpp | 2348 +-- src/statTimer/dllmain.cpp | 25 +- src/statTimer/statisticalTimer.CPU.cpp | 545 +- src/statTimer/statisticalTimer.CPU.h | 270 +- src/statTimer/statisticalTimer.GPU.cpp | 1114 +- src/statTimer/statisticalTimer.GPU.h | 439 +- src/statTimer/statisticalTimer.extern.cpp | 19 +- src/statTimer/statisticalTimer.extern.h | 71 +- src/statTimer/statisticalTimer.h | 121 +- src/statTimer/stdafx.cpp | 1 - src/statTimer/stdafx.h | 17 +- src/statTimer/targetver.h | 5 +- src/tests/accuracy_test_common.cpp | 51 +- src/tests/accuracy_test_common.h | 1949 +- src/tests/accuracy_test_directed.cpp | 1339 +- src/tests/accuracy_test_mixed_callback.cpp | 741 +- src/tests/accuracy_test_mixed_radices.cpp | 749 +- src/tests/accuracy_test_postcallback.cpp | 6993 ++++--- src/tests/accuracy_test_pow2.cpp | 16524 ++++++++------- src/tests/accuracy_test_pow2_precallback.cpp | 16766 ++++++++------- src/tests/accuracy_test_pow3.cpp | 17057 +++++++++------- src/tests/accuracy_test_pow3_precallback.cpp | 16775 ++++++++------- src/tests/accuracy_test_pow5.cpp | 18110 ++++++++++------- src/tests/accuracy_test_pow5_precallback.cpp | 16775 ++++++++------- src/tests/accuracy_test_pow7.cpp | 15491 ++++++++------ src/tests/accuracy_test_pow7_precallback.cpp | 2329 ++- src/tests/accuracy_test_random.cpp | 1353 +- src/tests/buffer.cpp | 842 +- src/tests/buffer.h | 2348 +-- src/tests/buffer_memory.cpp | 21 +- src/tests/buffer_memory.h | 197 +- src/tests/c-compliance.c | 1 - src/tests/cl_transform.h | 2176 +- src/tests/fftw_transform.h | 928 +- src/tests/gtest_main.cpp | 476 +- src/tests/test_constants.cpp | 153 +- src/tests/test_constants.h | 394 +- src/tests/typedefs.h | 7 +- src/tests/unit_test.cpp | 1871 +- src/tests/unit_test_persistent_plans.cpp | 359 +- 90 files changed, 109822 insertions(+), 91201 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0a7b26b..5374fb8f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,7 +38,7 @@ if( NOT DEFINED CLFFT_VERSION_MINOR ) endif( ) if( NOT DEFINED CLFFT_VERSION_PATCH ) - set( CLFFT_VERSION_PATCH 0 ) + set( CLFFT_VERSION_PATCH 1 ) endif( ) set( CLFFT_VERSION "${CLFFT_VERSION_MAJOR}.${CLFFT_VERSION_MINOR}.${CLFFT_VERSION_PATCH}") diff --git a/src/callback-client/callback-client.cpp b/src/callback-client/callback-client.cpp index e569b657..59d1cc8c 100644 --- a/src/callback-client/callback-client.cpp +++ b/src/callback-client/callback-client.cpp @@ -1,576 +1,648 @@ -#include #include +#include -#include "client.h" +#include "../include/sharedLibrary.h" #include "../library/private.h" +#include "client.h" #include "openCL.misc.h" -#include "../include/sharedLibrary.h" namespace po = boost::program_options; -int main(int argc, char **argv) -{ - size_t lengths[ 3 ] = {BATCH_LENGTH,1,1}; //For simplicity, assuming 1D fft with fixed batch length of BATCH_LENGTH - cl_uint profile_count = 0; - clfftPrecision precision = CLFFT_SINGLE; //Testing for single precision. Easily extendable for double - - size_t batchSize = 1; - - // Initialize flags for FFT library - std::auto_ptr< clfftSetupData > setupData( new clfftSetupData ); - OPENCL_V_THROW( clfftInitSetupData( setupData.get( ) ), - "clfftInitSetupData failed" ); - - try - { - // Declare the supported options. - po::options_description desc( "clFFT client command line options" ); - desc.add_options() - ( "help,h", "produces this help message" ) - ( "dumpKernels,d", "FFT engine will dump generated OpenCL FFT kernels to disk (default: dump off)" ) - ( "batchSize,b", po::value< size_t >( &batchSize )->default_value( 1 ), "If this value is greater than one, arrays will be used " ) - ( "profile,p", po::value< cl_uint >( &profile_count )->default_value( 10 ), "Time and report the kernel speed of the FFT (default: profiling on)" ) - ; - - po::variables_map vm; - po::store( po::parse_command_line( argc, argv, desc ), vm ); - po::notify( vm ); - - if( vm.count( "help" ) ) - { - std::cout << desc << std::endl; - return 0; - } - - if( vm.count( "dumpKernels" ) ) - { - setupData->debugFlags |= CLFFT_DUMP_PROGRAMS; - } - - clfftDim dim = CLFFT_1D; - - tout << "\nRunning FFT for length " << BATCH_LENGTH << " and batch size " << batchSize << std::endl; - - // Real-Complex cases, SP - - R2C_transform(setupData, lengths, batchSize, dim, precision, profile_count); - - } - catch( std::exception& e ) - { - terr << _T( "clFFT error condition reported:" ) << std::endl << e.what() << std::endl; - return 1; - } - return 0; +int main(int argc, char **argv) { + size_t lengths[3] = {BATCH_LENGTH, 1, + 1}; // For simplicity, assuming 1D fft with fixed batch + // length of BATCH_LENGTH + cl_uint profile_count = 0; + clfftPrecision precision = CLFFT_SINGLE; // Testing for single precision. + // Easily extendable for double + + size_t batchSize = 1; + + // Initialize flags for FFT library + std::auto_ptr setupData(new clfftSetupData); + OPENCL_V_THROW(clfftInitSetupData(setupData.get()), + "clfftInitSetupData failed"); + + try { + // Declare the supported options. + po::options_description desc("clFFT client command line options"); + desc.add_options()("help,h", "produces this help message")( + "dumpKernels,d", "FFT engine will dump generated OpenCL FFT kernels to " + "disk (default: dump off)")( + "batchSize,b", po::value(&batchSize)->default_value(1), + "If this value is greater than one, arrays will be used ")( + "profile,p", po::value(&profile_count)->default_value(10), + "Time and report the kernel speed of the FFT (default: profiling on)"); + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << std::endl; + return 0; + } + + if (vm.count("dumpKernels")) { + setupData->debugFlags |= CLFFT_DUMP_PROGRAMS; + } + + clfftDim dim = CLFFT_1D; + + tout << "\nRunning FFT for length " << BATCH_LENGTH << " and batch size " + << batchSize << std::endl; + + // Real-Complex cases, SP + + R2C_transform(setupData, lengths, batchSize, dim, precision, + profile_count); + + } catch (std::exception &e) { + terr << _T( "clFFT error condition reported:" ) << std::endl + << e.what() << std::endl; + return 1; + } + return 0; } -template < typename T > -void R2C_transform(std::auto_ptr< clfftSetupData > setupData, size_t* inlengths, size_t batchSize, - clfftDim dim, clfftPrecision precision, cl_uint profile_count) -{ - // OpenCL state - cl_device_type deviceType = CL_DEVICE_TYPE_ALL; - cl_int deviceId = 0; - std::vector< cl_device_id > device_id; - cl_int platformId = 0; - cl_context context; - cl_uint command_queue_flags = 0; - command_queue_flags |= CL_QUEUE_PROFILING_ENABLE; - - // Test for in-place Hermitian Interleaved output - // Hence output size is N/2 + 1 complex. So allocate N + 2 real input - size_t Nt = inlengths[0] + 2; - size_t vectorLength = Nt * inlengths[1] * inlengths[2]; - size_t fftLength = vectorLength * batchSize; - - //OpenCL initializations - device_id = initializeCL( deviceType, deviceId, platformId, context, false); - - cl_int status = 0; - - cl_command_queue commandQueue = ::clCreateCommandQueue( context, device_id[0], command_queue_flags, &status ); - OPENCL_V_THROW( status, "Creating Command Queue ( ::clCreateCommandQueue() )" ); - - if (precision == CLFFT_SINGLE) - { - //Run clFFT with seaparate Pre-process Kernel - runR2C_FFT_PreAndPostprocessKernel(setupData, context, commandQueue, device_id[0], inlengths, dim, precision, - batchSize, vectorLength, fftLength, profile_count); - - //Run clFFT using pre-callback - runR2C_FFT_WithCallback(setupData, context, commandQueue, inlengths, dim, precision, - batchSize, vectorLength, fftLength, profile_count); - } - - OPENCL_V_THROW( clReleaseCommandQueue( commandQueue ), "Error: In clReleaseCommandQueue\n" ); - OPENCL_V_THROW( clReleaseContext( context ), "Error: In clReleaseContext\n" ); +template +void R2C_transform(std::auto_ptr setupData, size_t *inlengths, + size_t batchSize, clfftDim dim, clfftPrecision precision, + cl_uint profile_count) { + // OpenCL state + cl_device_type deviceType = CL_DEVICE_TYPE_ALL; + cl_int deviceId = 0; + std::vector device_id; + cl_int platformId = 0; + cl_context context; + cl_uint command_queue_flags = 0; + command_queue_flags |= CL_QUEUE_PROFILING_ENABLE; + + // Test for in-place Hermitian Interleaved output + // Hence output size is N/2 + 1 complex. So allocate N + 2 real input + size_t Nt = inlengths[0] + 2; + size_t vectorLength = Nt * inlengths[1] * inlengths[2]; + size_t fftLength = vectorLength * batchSize; + + // OpenCL initializations + device_id = initializeCL(deviceType, deviceId, platformId, context, false); + + cl_int status = 0; + + cl_command_queue commandQueue = ::clCreateCommandQueue( + context, device_id[0], command_queue_flags, &status); + OPENCL_V_THROW(status, "Creating Command Queue ( ::clCreateCommandQueue() )"); + + if (precision == CLFFT_SINGLE) { + // Run clFFT with seaparate Pre-process Kernel + runR2C_FFT_PreAndPostprocessKernel( + setupData, context, commandQueue, device_id[0], inlengths, dim, + precision, batchSize, vectorLength, fftLength, profile_count); + + // Run clFFT using pre-callback + runR2C_FFT_WithCallback(setupData, context, commandQueue, inlengths, + dim, precision, batchSize, vectorLength, + fftLength, profile_count); + } + + OPENCL_V_THROW(clReleaseCommandQueue(commandQueue), + "Error: In clReleaseCommandQueue\n"); + OPENCL_V_THROW(clReleaseContext(context), "Error: In clReleaseContext\n"); } -template < typename T > -void runR2C_FFT_WithCallback(std::auto_ptr< clfftSetupData > setupData, cl_context context, cl_command_queue commandQueue, - size_t* inlengths, clfftDim dim, clfftPrecision precision, - size_t batchSize, size_t vectorLength, size_t fftLength, cl_uint profile_count) -{ - cl_int status = 0; - - //input/output allocation sizes - size_t in_size_of_buffers = fftLength * sizeof(uint24_t); - size_t out_size_of_buffers = fftLength * sizeof( T ); - - uint24_t *input24bitData = (uint24_t*)malloc(in_size_of_buffers); - - //Initialize Data - srand(1); - for (size_t idx = 0; idx < fftLength; ++idx) - { - int randomVal = (int)rand(); - - input24bitData[idx][0] = (randomVal >> 16) & 0xFF; - input24bitData[idx][1] = (randomVal >> 8) & 0xFF; - input24bitData[idx][2] = randomVal & 0xFF; - } - - //input data buffer - cl_mem infftbuffer = ::clCreateBuffer( context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, in_size_of_buffers, (void*)input24bitData, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer(infftbuffer) )" ); - - //out-place transform. - cl_mem outfftbuffer = ::clCreateBuffer( context, CL_MEM_READ_WRITE, out_size_of_buffers, NULL, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer(oufftbuffer) )" ); - - //clFFT initializations - - // FFT state - clfftResultLocation place = CLFFT_OUTOFPLACE; - clfftLayout inLayout = CLFFT_REAL; - clfftLayout outLayout = CLFFT_HERMITIAN_INTERLEAVED; - - clfftPlanHandle plan_handle; - OPENCL_V_THROW( clfftSetup( setupData.get( ) ), "clfftSetup failed" ); - OPENCL_V_THROW( clfftCreateDefaultPlan( &plan_handle, context, dim, inlengths ), "clfftCreateDefaultPlan failed" ); - - //Precallback setup - char* precallbackstr = STRINGIFY(ConvertToFloat); - - //Postcallback setup - char* postcallbackstr = STRINGIFY(MagnitudeExtraction); - - //Register the callback - OPENCL_V_THROW (clfftSetPlanCallback(plan_handle, "convert24To32bit", precallbackstr, 0, PRECALLBACK, NULL, 0), "clFFTSetPlanCallback failed"); - OPENCL_V_THROW (clfftSetPlanCallback(plan_handle, "extractMagnitude", postcallbackstr, 0, POSTCALLBACK, NULL, 0), "clFFTSetPlanCallback failed"); - - // Default plan creates a plan that expects an inPlace transform with interleaved complex numbers - OPENCL_V_THROW( clfftSetResultLocation( plan_handle, place ), "clfftSetResultLocation failed" ); - OPENCL_V_THROW( clfftSetLayout( plan_handle, inLayout, outLayout ), "clfftSetLayout failed" ); - OPENCL_V_THROW( clfftSetPlanBatchSize( plan_handle, batchSize ), "clfftSetPlanBatchSize failed" ); - OPENCL_V_THROW( clfftSetPlanPrecision( plan_handle, precision ), "clfftSetPlanPrecision failed" ); - OPENCL_V_THROW( clfftSetPlanDistance( plan_handle, BATCH_LENGTH + 2, (BATCH_LENGTH/2 + 1)), "clfftSetPlanDistance failed" ); - - //Bake Plan - OPENCL_V_THROW( clfftBakePlan( plan_handle, 1, &commandQueue, NULL, NULL ), "clfftBakePlan failed" ); - - //get the buffersize - size_t buffersize=0; - OPENCL_V_THROW( clfftGetTmpBufSize(plan_handle, &buffersize ), "clfftGetTmpBufSize failed" ); - - //allocate the intermediate buffer - cl_mem clMedBuffer=NULL; - - if (buffersize) - { - cl_int medstatus; - clMedBuffer = clCreateBuffer ( context, CL_MEM_READ_WRITE, buffersize, 0, &medstatus); - OPENCL_V_THROW( medstatus, "Creating intmediate Buffer failed" ); - } - - //for functional test - OPENCL_V_THROW( clfftEnqueueTransform( plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, NULL, - &infftbuffer, &outfftbuffer, clMedBuffer ), - "clfftEnqueueTransform failed" ); - - OPENCL_V_THROW( clFinish( commandQueue ), "clFinish failed" ); - - if (profile_count > 1) - { - Timer tr; - tr.Start(); - - // Loop as many times as the user specifies to average out the timings - for( cl_uint i = 0; i < profile_count; ++i ) - { - OPENCL_V_THROW( clfftEnqueueTransform( plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, NULL, - &infftbuffer, &outfftbuffer, clMedBuffer ), - "clfftEnqueueTransform failed" ); - - OPENCL_V_THROW( clFinish( commandQueue ), "clFinish failed" ); - } - double wtimesample = tr.Sample(); - double wtime = wtimesample/((double)profile_count); - - tout << "\nExecution wall time (with clFFT Callback): " << 1000.0*wtime << " ms" << std::endl; - } - - if(clMedBuffer) clReleaseMemObject(clMedBuffer); - - if (profile_count == 1) - { - std::vector< T > output( fftLength ); - - OPENCL_V_THROW( clEnqueueReadBuffer( commandQueue, outfftbuffer, CL_TRUE, 0, out_size_of_buffers, &output[ 0 ], - 0, NULL, NULL ), "Reading the result buffer failed" ); - - //Reference fftw output - fftwf_complex *refout; - - refout = get_R2C_fftwf_output(inlengths, fftLength, (int)batchSize, inLayout, dim); - - if (!compare(refout, output, fftLength/2)) - { - std::cout << "\n\n\t\tInternal Client Test (with clFFT Callback) *****FAIL*****" << std::endl; - } - else - { - std::cout << "\n\n\t\tInternal Client Test (with clFFT Callback) *****PASS*****" << std::endl; - } - - fftwf_free(refout); - } - - OPENCL_V_THROW( clfftDestroyPlan( &plan_handle ), "clfftDestroyPlan failed" ); - OPENCL_V_THROW( clfftTeardown( ), "clfftTeardown failed" ); - - //cleanup - OPENCL_V_THROW( clReleaseMemObject( infftbuffer ), "Error: In clReleaseMemObject\n" ); - OPENCL_V_THROW( clReleaseMemObject( outfftbuffer ), "Error: In clReleaseMemObject\n" ); +template +void runR2C_FFT_WithCallback(std::auto_ptr setupData, + cl_context context, cl_command_queue commandQueue, + size_t *inlengths, clfftDim dim, + clfftPrecision precision, size_t batchSize, + size_t vectorLength, size_t fftLength, + cl_uint profile_count) { + cl_int status = 0; + + // input/output allocation sizes + size_t in_size_of_buffers = fftLength * sizeof(uint24_t); + size_t out_size_of_buffers = fftLength * sizeof(T); + + uint24_t *input24bitData = (uint24_t *)malloc(in_size_of_buffers); + + // Initialize Data + srand(1); + for (size_t idx = 0; idx < fftLength; ++idx) { + int randomVal = (int)rand(); + + input24bitData[idx][0] = (randomVal >> 16) & 0xFF; + input24bitData[idx][1] = (randomVal >> 8) & 0xFF; + input24bitData[idx][2] = randomVal & 0xFF; + } + + // input data buffer + cl_mem infftbuffer = + ::clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + in_size_of_buffers, (void *)input24bitData, &status); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer(infftbuffer) )"); + + // out-place transform. + cl_mem outfftbuffer = ::clCreateBuffer(context, CL_MEM_READ_WRITE, + out_size_of_buffers, NULL, &status); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer(oufftbuffer) )"); + + // clFFT initializations + + // FFT state + clfftResultLocation place = CLFFT_OUTOFPLACE; + clfftLayout inLayout = CLFFT_REAL; + clfftLayout outLayout = CLFFT_HERMITIAN_INTERLEAVED; + + clfftPlanHandle plan_handle; + OPENCL_V_THROW(clfftSetup(setupData.get()), "clfftSetup failed"); + OPENCL_V_THROW(clfftCreateDefaultPlan(&plan_handle, context, dim, inlengths), + "clfftCreateDefaultPlan failed"); + + // Precallback setup + char *precallbackstr = STRINGIFY(ConvertToFloat); + + // Postcallback setup + char *postcallbackstr = STRINGIFY(MagnitudeExtraction); + + // Register the callback + OPENCL_V_THROW(clfftSetPlanCallback(plan_handle, "convert24To32bit", + precallbackstr, 0, PRECALLBACK, NULL, 0), + "clFFTSetPlanCallback failed"); + OPENCL_V_THROW(clfftSetPlanCallback(plan_handle, "extractMagnitude", + postcallbackstr, 0, POSTCALLBACK, NULL, + 0), + "clFFTSetPlanCallback failed"); + + // Default plan creates a plan that expects an inPlace transform with + //interleaved complex numbers + OPENCL_V_THROW(clfftSetResultLocation(plan_handle, place), + "clfftSetResultLocation failed"); + OPENCL_V_THROW(clfftSetLayout(plan_handle, inLayout, outLayout), + "clfftSetLayout failed"); + OPENCL_V_THROW(clfftSetPlanBatchSize(plan_handle, batchSize), + "clfftSetPlanBatchSize failed"); + OPENCL_V_THROW(clfftSetPlanPrecision(plan_handle, precision), + "clfftSetPlanPrecision failed"); + OPENCL_V_THROW(clfftSetPlanDistance(plan_handle, BATCH_LENGTH + 2, + (BATCH_LENGTH / 2 + 1)), + "clfftSetPlanDistance failed"); + + // Bake Plan + OPENCL_V_THROW(clfftBakePlan(plan_handle, 1, &commandQueue, NULL, NULL), + "clfftBakePlan failed"); + + // get the buffersize + size_t buffersize = 0; + OPENCL_V_THROW(clfftGetTmpBufSize(plan_handle, &buffersize), + "clfftGetTmpBufSize failed"); + + // allocate the intermediate buffer + cl_mem clMedBuffer = NULL; + + if (buffersize) { + cl_int medstatus; + clMedBuffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, buffersize, 0, &medstatus); + OPENCL_V_THROW(medstatus, "Creating intmediate Buffer failed"); + } + + // for functional test + OPENCL_V_THROW(clfftEnqueueTransform( + plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, + NULL, &infftbuffer, &outfftbuffer, clMedBuffer), + "clfftEnqueueTransform failed"); + + OPENCL_V_THROW(clFinish(commandQueue), "clFinish failed"); + + if (profile_count > 1) { + Timer tr; + tr.Start(); + + // Loop as many times as the user specifies to average out the timings + for (cl_uint i = 0; i < profile_count; ++i) { + OPENCL_V_THROW(clfftEnqueueTransform( + plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, + NULL, &infftbuffer, &outfftbuffer, clMedBuffer), + "clfftEnqueueTransform failed"); + + OPENCL_V_THROW(clFinish(commandQueue), "clFinish failed"); + } + double wtimesample = tr.Sample(); + double wtime = wtimesample / ((double)profile_count); + + tout << "\nExecution wall time (with clFFT Callback): " << 1000.0 * wtime + << " ms" << std::endl; + } + + if (clMedBuffer) + clReleaseMemObject(clMedBuffer); + + if (profile_count == 1) { + std::vector output(fftLength); + + OPENCL_V_THROW(clEnqueueReadBuffer(commandQueue, outfftbuffer, CL_TRUE, 0, + out_size_of_buffers, &output[0], 0, NULL, + NULL), + "Reading the result buffer failed"); + + // Reference fftw output + fftwf_complex *refout; + + refout = get_R2C_fftwf_output(inlengths, fftLength, (int)batchSize, + inLayout, dim); + + if (!compare(refout, output, fftLength / 2)) { + std::cout + << "\n\n\t\tInternal Client Test (with clFFT Callback) *****FAIL*****" + << std::endl; + } else { + std::cout + << "\n\n\t\tInternal Client Test (with clFFT Callback) *****PASS*****" + << std::endl; + } + + fftwf_free(refout); + } + + OPENCL_V_THROW(clfftDestroyPlan(&plan_handle), "clfftDestroyPlan failed"); + OPENCL_V_THROW(clfftTeardown(), "clfftTeardown failed"); + + // cleanup + OPENCL_V_THROW(clReleaseMemObject(infftbuffer), + "Error: In clReleaseMemObject\n"); + OPENCL_V_THROW(clReleaseMemObject(outfftbuffer), + "Error: In clReleaseMemObject\n"); } -template < typename T > -void runR2C_FFT_PreAndPostprocessKernel(std::auto_ptr< clfftSetupData > setupData, cl_context context, - cl_command_queue commandQueue, cl_device_id device_id, - size_t* inlengths, clfftDim dim, clfftPrecision precision, - size_t batchSize, size_t vectorLength, size_t fftLength, cl_uint profile_count) -{ - cl_int status = 0; - - //input/output allocation sizes - size_t in_size_of_buffers = fftLength * sizeof(uint24_t); - size_t out_size_of_buffers = fftLength * sizeof( T ); - - uint24_t *input24bitData = (uint24_t*)malloc(in_size_of_buffers); - - //Initialize Data - srand(1); - for (size_t idx = 0; idx < fftLength; ++idx) - { - int randomVal = (int)rand(); - - input24bitData[idx][0] = (randomVal >> 16) & 0xFF; - input24bitData[idx][1] = (randomVal >> 8) & 0xFF; - input24bitData[idx][2] = randomVal & 0xFF; - } - - //input data buffer - cl_mem in24bitfftbuffer = ::clCreateBuffer( context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, in_size_of_buffers, (void*)input24bitData, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer(in24bitfftbuffer) )" ); - - cl_mem in32bitfftbuffer = ::clCreateBuffer( context, CL_MEM_READ_WRITE, out_size_of_buffers, NULL, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer(in32bitfftbuffer) )" ); - - //out-place transform. - cl_mem outfftbuffer = ::clCreateBuffer( context, CL_MEM_READ_WRITE, out_size_of_buffers, NULL, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer(oufftbuffer) )" ); - - //output magnitude buffer transform. - cl_mem magoutfftbuffer = ::clCreateBuffer( context, CL_MEM_WRITE_ONLY, out_size_of_buffers/2, NULL, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer(magoutfftbuffer) )" ); - - //clFFT initializations - - // FFT state - clfftResultLocation place = CLFFT_OUTOFPLACE; - clfftLayout inLayout = CLFFT_REAL; - clfftLayout outLayout = CLFFT_HERMITIAN_INTERLEAVED; - - clfftPlanHandle plan_handle; - OPENCL_V_THROW( clfftSetup( setupData.get( ) ), "clfftSetup failed" ); - OPENCL_V_THROW( clfftCreateDefaultPlan( &plan_handle, context, dim, inlengths ), "clfftCreateDefaultPlan failed" ); - - // Default plan creates a plan that expects an inPlace transform with interleaved complex numbers - OPENCL_V_THROW( clfftSetResultLocation( plan_handle, place ), "clfftSetResultLocation failed" ); - OPENCL_V_THROW( clfftSetLayout( plan_handle, inLayout, outLayout ), "clfftSetLayout failed" ); - OPENCL_V_THROW( clfftSetPlanBatchSize( plan_handle, batchSize ), "clfftSetPlanBatchSize failed" ); - OPENCL_V_THROW( clfftSetPlanPrecision( plan_handle, precision ), "clfftSetPlanPrecision failed" ); - OPENCL_V_THROW( clfftSetPlanDistance( plan_handle, BATCH_LENGTH + 2, (BATCH_LENGTH/2 + 1)), "clfftSetPlanDistance failed" ); - - //Bake Plan - OPENCL_V_THROW( clfftBakePlan( plan_handle, 1, &commandQueue, NULL, NULL ), "clfftBakePlan failed" ); - - //get the buffersize - size_t buffersize=0; - OPENCL_V_THROW( clfftGetTmpBufSize(plan_handle, &buffersize ), "clfftGetTmpBufSize failed" ); - - //allocate the intermediate buffer - cl_mem clMedBuffer=NULL; - - if (buffersize) - { - cl_int medstatus; - clMedBuffer = clCreateBuffer ( context, CL_MEM_READ_WRITE, buffersize, 0, &medstatus); - OPENCL_V_THROW( medstatus, "Creating intmediate Buffer failed" ); - } - - //Pre and post process kernel string - std::string sourceStr; - sourceStr += STRINGIFY(ConvertToFloat_KERNEL); - sourceStr += "\n"; - sourceStr += STRINGIFY(MagnitudeExtraction_KERNEL); - - const char* source = sourceStr.c_str(); - - cl_program program = clCreateProgramWithSource( context, 1, &source, NULL, &status ); - OPENCL_V_THROW( status, "clCreateProgramWithSource failed." ); - - status = clBuildProgram( program, 1, &device_id, "", NULL, NULL); - OPENCL_V_THROW( status, "clBuildProgram failed" ); - -#if defined( _DEBUG ) - if( status != CL_SUCCESS ) - { - if( status == CL_BUILD_PROGRAM_FAILURE ) - { - size_t buildLogSize = 0; - OPENCL_V_THROW( clGetProgramBuildInfo( program, device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildLogSize ), - "clGetProgramBuildInfo failed" ); - - std::vector< char > buildLog( buildLogSize ); - ::memset( &buildLog[ 0 ], 0x0, buildLogSize ); - - OPENCL_V_THROW( clGetProgramBuildInfo( program, device_id, CL_PROGRAM_BUILD_LOG, buildLogSize, &buildLog[ 0 ], NULL ), - "clGetProgramBuildInfo failed" ); - - std::cerr << "\n\t\t\tBUILD LOG\n"; - std::cerr << "************************************************\n"; - std::cerr << &buildLog[ 0 ] << std::endl; - std::cerr << "************************************************\n"; - } - - OPENCL_V_THROW( status, "clBuildProgram failed" ); - } +template +void runR2C_FFT_PreAndPostprocessKernel( + std::auto_ptr setupData, cl_context context, + cl_command_queue commandQueue, cl_device_id device_id, size_t *inlengths, + clfftDim dim, clfftPrecision precision, size_t batchSize, + size_t vectorLength, size_t fftLength, cl_uint profile_count) { + cl_int status = 0; + + // input/output allocation sizes + size_t in_size_of_buffers = fftLength * sizeof(uint24_t); + size_t out_size_of_buffers = fftLength * sizeof(T); + + uint24_t *input24bitData = (uint24_t *)malloc(in_size_of_buffers); + + // Initialize Data + srand(1); + for (size_t idx = 0; idx < fftLength; ++idx) { + int randomVal = (int)rand(); + + input24bitData[idx][0] = (randomVal >> 16) & 0xFF; + input24bitData[idx][1] = (randomVal >> 8) & 0xFF; + input24bitData[idx][2] = randomVal & 0xFF; + } + + // input data buffer + cl_mem in24bitfftbuffer = + ::clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + in_size_of_buffers, (void *)input24bitData, &status); + OPENCL_V_THROW(status, + "Creating Buffer ( ::clCreateBuffer(in24bitfftbuffer) )"); + + cl_mem in32bitfftbuffer = ::clCreateBuffer( + context, CL_MEM_READ_WRITE, out_size_of_buffers, NULL, &status); + OPENCL_V_THROW(status, + "Creating Buffer ( ::clCreateBuffer(in32bitfftbuffer) )"); + + // out-place transform. + cl_mem outfftbuffer = ::clCreateBuffer(context, CL_MEM_READ_WRITE, + out_size_of_buffers, NULL, &status); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer(oufftbuffer) )"); + + // output magnitude buffer transform. + cl_mem magoutfftbuffer = ::clCreateBuffer( + context, CL_MEM_WRITE_ONLY, out_size_of_buffers / 2, NULL, &status); + OPENCL_V_THROW(status, + "Creating Buffer ( ::clCreateBuffer(magoutfftbuffer) )"); + + // clFFT initializations + + // FFT state + clfftResultLocation place = CLFFT_OUTOFPLACE; + clfftLayout inLayout = CLFFT_REAL; + clfftLayout outLayout = CLFFT_HERMITIAN_INTERLEAVED; + + clfftPlanHandle plan_handle; + OPENCL_V_THROW(clfftSetup(setupData.get()), "clfftSetup failed"); + OPENCL_V_THROW(clfftCreateDefaultPlan(&plan_handle, context, dim, inlengths), + "clfftCreateDefaultPlan failed"); + + // Default plan creates a plan that expects an inPlace transform with + //interleaved complex numbers + OPENCL_V_THROW(clfftSetResultLocation(plan_handle, place), + "clfftSetResultLocation failed"); + OPENCL_V_THROW(clfftSetLayout(plan_handle, inLayout, outLayout), + "clfftSetLayout failed"); + OPENCL_V_THROW(clfftSetPlanBatchSize(plan_handle, batchSize), + "clfftSetPlanBatchSize failed"); + OPENCL_V_THROW(clfftSetPlanPrecision(plan_handle, precision), + "clfftSetPlanPrecision failed"); + OPENCL_V_THROW(clfftSetPlanDistance(plan_handle, BATCH_LENGTH + 2, + (BATCH_LENGTH / 2 + 1)), + "clfftSetPlanDistance failed"); + + // Bake Plan + OPENCL_V_THROW(clfftBakePlan(plan_handle, 1, &commandQueue, NULL, NULL), + "clfftBakePlan failed"); + + // get the buffersize + size_t buffersize = 0; + OPENCL_V_THROW(clfftGetTmpBufSize(plan_handle, &buffersize), + "clfftGetTmpBufSize failed"); + + // allocate the intermediate buffer + cl_mem clMedBuffer = NULL; + + if (buffersize) { + cl_int medstatus; + clMedBuffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, buffersize, 0, &medstatus); + OPENCL_V_THROW(medstatus, "Creating intmediate Buffer failed"); + } + + // Pre and post process kernel string + std::string sourceStr; + sourceStr += STRINGIFY(ConvertToFloat_KERNEL); + sourceStr += "\n"; + sourceStr += STRINGIFY(MagnitudeExtraction_KERNEL); + + const char *source = sourceStr.c_str(); + + cl_program program = + clCreateProgramWithSource(context, 1, &source, NULL, &status); + OPENCL_V_THROW(status, "clCreateProgramWithSource failed."); + + status = clBuildProgram(program, 1, &device_id, "", NULL, NULL); + OPENCL_V_THROW(status, "clBuildProgram failed"); + +#if defined(_DEBUG) + if (status != CL_SUCCESS) { + if (status == CL_BUILD_PROGRAM_FAILURE) { + size_t buildLogSize = 0; + OPENCL_V_THROW(clGetProgramBuildInfo(program, device_id, + CL_PROGRAM_BUILD_LOG, 0, NULL, + &buildLogSize), + "clGetProgramBuildInfo failed"); + + std::vector buildLog(buildLogSize); + ::memset(&buildLog[0], 0x0, buildLogSize); + + OPENCL_V_THROW(clGetProgramBuildInfo(program, device_id, + CL_PROGRAM_BUILD_LOG, buildLogSize, + &buildLog[0], NULL), + "clGetProgramBuildInfo failed"); + + std::cerr << "\n\t\t\tBUILD LOG\n"; + std::cerr << "************************************************\n"; + std::cerr << &buildLog[0] << std::endl; + std::cerr << "************************************************\n"; + } + + OPENCL_V_THROW(status, "clBuildProgram failed"); + } #endif - //For functional test - - //Pre-process kernel - cl_kernel prekernel = clCreateKernel( program, "convert24To32bit", &status ); - OPENCL_V_THROW( status, "clCreateKernel convert24To32bit failed" ); - - //Input 24bit Buffer - OPENCL_V_THROW( clSetKernelArg( prekernel, 0, sizeof( cl_mem ), (void*)&in24bitfftbuffer ), "clSetKernelArg failed" ); - - //output 32bit Buffer - OPENCL_V_THROW( clSetKernelArg( prekernel, 1, sizeof( cl_mem ), (void*)&in32bitfftbuffer ), "clSetKernelArg failed" ); - - //Post-process kernel - cl_kernel postkernel = clCreateKernel( program, "extractMagnitude", &status ); - OPENCL_V_THROW( status, "clCreateKernel extractMagnitude failed" ); - - OPENCL_V_THROW( clSetKernelArg( postkernel, 0, sizeof( cl_mem ), (void*)&outfftbuffer ), "clSetKernelArg failed" ); - OPENCL_V_THROW( clSetKernelArg( postkernel, 1, sizeof( cl_mem ), (void*)&magoutfftbuffer ), "clSetKernelArg failed" ); - - //Launch pre-process kernel - size_t gSize_pre = fftLength; - status = clEnqueueNDRangeKernel( commandQueue, prekernel, 1, - NULL, &gSize_pre, NULL, 0, NULL, NULL ); - OPENCL_V_THROW( status, "clEnqueueNDRangeKernel failed" ); - - OPENCL_V_THROW( clFinish( commandQueue ), "clFinish failed" ); - - //Now invoke the clfft execute - OPENCL_V_THROW( clfftEnqueueTransform( plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, NULL, - &in32bitfftbuffer, &outfftbuffer, clMedBuffer ), - "clfftEnqueueTransform failed" ); - - size_t gSize_post = fftLength/2; - //Launch post-process kernel - status = clEnqueueNDRangeKernel( commandQueue, postkernel, 1, - NULL, &gSize_post, NULL, 0, NULL, NULL ); - OPENCL_V_THROW( status, "clEnqueueNDRangeKernel failed" ); - - OPENCL_V_THROW( clFinish( commandQueue ), "clFinish failed" ); - - if (profile_count > 1) - { - Timer tr; - tr.Start(); - - // Loop as many times as the user specifies to average out the timings - for( cl_uint i = 0; i < profile_count; ++i ) - { - //Launch pre-process kernel - - //Input 24bit Buffer - OPENCL_V_THROW( clSetKernelArg( prekernel, 0, sizeof( cl_mem ), (void*)&in24bitfftbuffer ), "clSetKernelArg failed" ); - - //output 32bit Buffer - OPENCL_V_THROW( clSetKernelArg( prekernel, 1, sizeof( cl_mem ), (void*)&in32bitfftbuffer ), "clSetKernelArg failed" ); - - status = clEnqueueNDRangeKernel( commandQueue, prekernel, 1, - NULL, &gSize_pre, NULL, 0, NULL, NULL ); - OPENCL_V_THROW( status, "clEnqueueNDRangeKernel failed" ); - - OPENCL_V_THROW( clFinish( commandQueue ), "clFinish failed" ); - - //Now invoke the clfft execute - OPENCL_V_THROW( clfftEnqueueTransform( plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, NULL, - &in32bitfftbuffer, &outfftbuffer, clMedBuffer ), - "clfftEnqueueTransform failed" ); - - //Launch post-process kernel - OPENCL_V_THROW( clSetKernelArg( postkernel, 0, sizeof( cl_mem ), (void*)&outfftbuffer ), "clSetKernelArg failed" ); - OPENCL_V_THROW( clSetKernelArg( postkernel, 1, sizeof( cl_mem ), (void*)&magoutfftbuffer ), "clSetKernelArg failed" ); - - status = clEnqueueNDRangeKernel( commandQueue, postkernel, 1, - NULL, &gSize_post, NULL, 0, NULL, NULL ); - OPENCL_V_THROW( status, "clEnqueueNDRangeKernel failed" ); - - OPENCL_V_THROW( clFinish( commandQueue ), "clFinish failed" ); - } - double wtimesample = tr.Sample(); - double wtime = wtimesample/((double)profile_count); - - tout << "\nExecution wall time (Separate Pre and Post process kernels): " << 1000.0*wtime << " ms" << std::endl; - } - - //cleanup preprocess kernel opencl objects - OPENCL_V_THROW( clReleaseProgram( program ), "Error: In clReleaseProgram\n" ); - OPENCL_V_THROW( clReleaseKernel( prekernel ), "Error: In clReleaseKernel\n" ); - OPENCL_V_THROW( clReleaseKernel( postkernel ), "Error: In clReleaseKernel\n" ); - - if(clMedBuffer) clReleaseMemObject(clMedBuffer); - - if (profile_count == 1) - { - std::vector< T > output( fftLength/2 ); - - OPENCL_V_THROW( clEnqueueReadBuffer( commandQueue, magoutfftbuffer, CL_TRUE, 0, out_size_of_buffers/2, &output[ 0 ], - 0, NULL, NULL ), "Reading the result buffer failed" ); - - //Reference fftw output - fftwf_complex *refout; - - refout = get_R2C_fftwf_output(inlengths, fftLength, (int)batchSize, inLayout, dim); - - if (!compare(refout, output, fftLength/2)) - { - std::cout << "\n\n\t\tInternal Client Test (Separate Pre and Post process kernels) *****FAIL*****" << std::endl; - } - else - { - std::cout << "\n\n\t\tInternal Client Test (Separate Pre and Post process kernels) *****PASS*****" << std::endl; - } - - fftwf_free(refout); - } - - OPENCL_V_THROW( clfftDestroyPlan( &plan_handle ), "clfftDestroyPlan failed" ); - OPENCL_V_THROW( clfftTeardown( ), "clfftTeardown failed" ); - - //cleanup - OPENCL_V_THROW( clReleaseMemObject( in24bitfftbuffer ), "Error: In clReleaseMemObject\n" ); - OPENCL_V_THROW( clReleaseMemObject( in32bitfftbuffer ), "Error: In clReleaseMemObject\n" ); - OPENCL_V_THROW( clReleaseMemObject( outfftbuffer ), "Error: In clReleaseMemObject\n" ); - OPENCL_V_THROW( clReleaseMemObject( magoutfftbuffer ), "Error: In clReleaseMemObject\n" ); + // For functional test + + // Pre-process kernel + cl_kernel prekernel = clCreateKernel(program, "convert24To32bit", &status); + OPENCL_V_THROW(status, "clCreateKernel convert24To32bit failed"); + + // Input 24bit Buffer + OPENCL_V_THROW( + clSetKernelArg(prekernel, 0, sizeof(cl_mem), (void *)&in24bitfftbuffer), + "clSetKernelArg failed"); + + // output 32bit Buffer + OPENCL_V_THROW( + clSetKernelArg(prekernel, 1, sizeof(cl_mem), (void *)&in32bitfftbuffer), + "clSetKernelArg failed"); + + // Post-process kernel + cl_kernel postkernel = clCreateKernel(program, "extractMagnitude", &status); + OPENCL_V_THROW(status, "clCreateKernel extractMagnitude failed"); + + OPENCL_V_THROW( + clSetKernelArg(postkernel, 0, sizeof(cl_mem), (void *)&outfftbuffer), + "clSetKernelArg failed"); + OPENCL_V_THROW( + clSetKernelArg(postkernel, 1, sizeof(cl_mem), (void *)&magoutfftbuffer), + "clSetKernelArg failed"); + + // Launch pre-process kernel + size_t gSize_pre = fftLength; + status = clEnqueueNDRangeKernel(commandQueue, prekernel, 1, NULL, &gSize_pre, + NULL, 0, NULL, NULL); + OPENCL_V_THROW(status, "clEnqueueNDRangeKernel failed"); + + OPENCL_V_THROW(clFinish(commandQueue), "clFinish failed"); + + // Now invoke the clfft execute + OPENCL_V_THROW(clfftEnqueueTransform( + plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, + NULL, &in32bitfftbuffer, &outfftbuffer, clMedBuffer), + "clfftEnqueueTransform failed"); + + size_t gSize_post = fftLength / 2; + // Launch post-process kernel + status = clEnqueueNDRangeKernel(commandQueue, postkernel, 1, NULL, + &gSize_post, NULL, 0, NULL, NULL); + OPENCL_V_THROW(status, "clEnqueueNDRangeKernel failed"); + + OPENCL_V_THROW(clFinish(commandQueue), "clFinish failed"); + + if (profile_count > 1) { + Timer tr; + tr.Start(); + + // Loop as many times as the user specifies to average out the timings + for (cl_uint i = 0; i < profile_count; ++i) { + // Launch pre-process kernel + + // Input 24bit Buffer + OPENCL_V_THROW(clSetKernelArg(prekernel, 0, sizeof(cl_mem), + (void *)&in24bitfftbuffer), + "clSetKernelArg failed"); + + // output 32bit Buffer + OPENCL_V_THROW(clSetKernelArg(prekernel, 1, sizeof(cl_mem), + (void *)&in32bitfftbuffer), + "clSetKernelArg failed"); + + status = clEnqueueNDRangeKernel(commandQueue, prekernel, 1, NULL, + &gSize_pre, NULL, 0, NULL, NULL); + OPENCL_V_THROW(status, "clEnqueueNDRangeKernel failed"); + + OPENCL_V_THROW(clFinish(commandQueue), "clFinish failed"); + + // Now invoke the clfft execute + OPENCL_V_THROW(clfftEnqueueTransform( + plan_handle, CLFFT_FORWARD, 1, &commandQueue, 0, NULL, + NULL, &in32bitfftbuffer, &outfftbuffer, clMedBuffer), + "clfftEnqueueTransform failed"); + + // Launch post-process kernel + OPENCL_V_THROW( + clSetKernelArg(postkernel, 0, sizeof(cl_mem), (void *)&outfftbuffer), + "clSetKernelArg failed"); + OPENCL_V_THROW(clSetKernelArg(postkernel, 1, sizeof(cl_mem), + (void *)&magoutfftbuffer), + "clSetKernelArg failed"); + + status = clEnqueueNDRangeKernel(commandQueue, postkernel, 1, NULL, + &gSize_post, NULL, 0, NULL, NULL); + OPENCL_V_THROW(status, "clEnqueueNDRangeKernel failed"); + + OPENCL_V_THROW(clFinish(commandQueue), "clFinish failed"); + } + double wtimesample = tr.Sample(); + double wtime = wtimesample / ((double)profile_count); + + tout << "\nExecution wall time (Separate Pre and Post process kernels): " + << 1000.0 * wtime << " ms" << std::endl; + } + + // cleanup preprocess kernel opencl objects + OPENCL_V_THROW(clReleaseProgram(program), "Error: In clReleaseProgram\n"); + OPENCL_V_THROW(clReleaseKernel(prekernel), "Error: In clReleaseKernel\n"); + OPENCL_V_THROW(clReleaseKernel(postkernel), "Error: In clReleaseKernel\n"); + + if (clMedBuffer) + clReleaseMemObject(clMedBuffer); + + if (profile_count == 1) { + std::vector output(fftLength / 2); + + OPENCL_V_THROW(clEnqueueReadBuffer(commandQueue, magoutfftbuffer, CL_TRUE, + 0, out_size_of_buffers / 2, &output[0], + 0, NULL, NULL), + "Reading the result buffer failed"); + + // Reference fftw output + fftwf_complex *refout; + + refout = get_R2C_fftwf_output(inlengths, fftLength, (int)batchSize, + inLayout, dim); + + if (!compare(refout, output, fftLength / 2)) { + std::cout << "\n\n\t\tInternal Client Test (Separate Pre and Post " + "process kernels) *****FAIL*****" + << std::endl; + } else { + std::cout << "\n\n\t\tInternal Client Test (Separate Pre and Post " + "process kernels) *****PASS*****" + << std::endl; + } + + fftwf_free(refout); + } + + OPENCL_V_THROW(clfftDestroyPlan(&plan_handle), "clfftDestroyPlan failed"); + OPENCL_V_THROW(clfftTeardown(), "clfftTeardown failed"); + + // cleanup + OPENCL_V_THROW(clReleaseMemObject(in24bitfftbuffer), + "Error: In clReleaseMemObject\n"); + OPENCL_V_THROW(clReleaseMemObject(in32bitfftbuffer), + "Error: In clReleaseMemObject\n"); + OPENCL_V_THROW(clReleaseMemObject(outfftbuffer), + "Error: In clReleaseMemObject\n"); + OPENCL_V_THROW(clReleaseMemObject(magoutfftbuffer), + "Error: In clReleaseMemObject\n"); } -//Compare reference and opencl output -template < typename T1, typename T2> -bool compare(T1 *refData, std::vector< T2 > data, - size_t length, const float epsilon) -{ - float error = 0.0f; - T1 ref; - T1 diff; - float normRef = 0.0f; - float normError = 0.0f; - - for(size_t i = 0; i < length; ++i) - { - diff[0] = refData[i][0] - data[i]; - error += (float)(diff[0] * diff[0]); - ref[0] += refData[i][0] * refData[i][0]; - } - if (error != 0) - { - normRef =::sqrtf((float) ref[0]); - if (::fabs((float) ref[0]) < 1e-7f) - { - return false; - } - normError = ::sqrtf((float) error); - error = normError / normRef; - - if (error > epsilon) - return false; - } - - return true; +// Compare reference and opencl output +template +bool compare(T1 *refData, std::vector data, size_t length, + const float epsilon) { + float error = 0.0f; + T1 ref; + T1 diff; + float normRef = 0.0f; + float normError = 0.0f; + + for (size_t i = 0; i < length; ++i) { + diff[0] = refData[i][0] - data[i]; + error += (float)(diff[0] * diff[0]); + ref[0] += refData[i][0] * refData[i][0]; + } + if (error != 0) { + normRef = ::sqrtf((float)ref[0]); + if (::fabs((float)ref[0]) < 1e-7f) { + return false; } + normError = ::sqrtf((float)error); + error = normError / normRef; + + if (error > epsilon) + return false; + } + + return true; +} // Compute reference output using fftw for float type -fftwf_complex* get_R2C_fftwf_output(size_t* lengths, size_t fftbatchLength, int batch_size, - clfftLayout in_layout, clfftDim dim) -{ - //In FFTW last dimension has the fastest changing index - int fftwLengths[3] = {(int)lengths[2], (int)lengths[1], (int)lengths[0]}; - int inembed[3] = {(int)lengths[2], (int)lengths[1], (int)(lengths[0] + 2)}; - int outembed[3] = {(int)lengths[2], (int)lengths[1], (int)(lengths[0]/2 + 1)}; - - fftwf_plan refPlan; - - int infftVectorLength = inembed[0] * inembed[1] * inembed[2]; - int outfftVectorLength = outembed[0] * outembed[1] * outembed[2]; - - float *refin = (float*) malloc(sizeof(float)*fftbatchLength); - fftwf_complex *refout = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*outfftVectorLength*batch_size); - - refPlan = fftwf_plan_many_dft_r2c(dim, &fftwLengths[3 - dim], batch_size, - refin, &inembed[3 - dim], 1, infftVectorLength, - refout, &outembed[3 - dim], 1, outfftVectorLength, FFTW_ESTIMATE); - - uint24_t* in24bitData = (uint24_t*)malloc(sizeof(uint24_t) * fftbatchLength); - - //Initialize Data - srand(1); - for (size_t idx = 0; idx < fftbatchLength; ++idx) - { - int randomVal = (int)rand(); - - in24bitData[idx][0] = (randomVal >> 16) & 0xFF; - in24bitData[idx][1] = (randomVal >> 8) & 0xFF; - in24bitData[idx][2] = randomVal & 0xFF; - } - - float val; - - for( size_t i = 0; i < fftbatchLength; i++) - { - val = (float)(in24bitData[i][0] << 16 | in24bitData[i][1] << 8 | in24bitData[i][2]) ; - - refin[i] = val; - } - - fftwf_execute(refPlan); - - free(refin); - - fftwf_destroy_plan(refPlan); - - //Execute post-process code - for (size_t idx = 0; idx < (outfftVectorLength*batch_size); ++idx) - { - float magnitude = sqrtf(pow(refout[idx][0], 2) + pow(refout[idx][1], 2)); - refout[idx][0] = magnitude; - } - - return refout; +fftwf_complex *get_R2C_fftwf_output(size_t *lengths, size_t fftbatchLength, + int batch_size, clfftLayout in_layout, + clfftDim dim) { + // In FFTW last dimension has the fastest changing index + int fftwLengths[3] = {(int)lengths[2], (int)lengths[1], (int)lengths[0]}; + int inembed[3] = {(int)lengths[2], (int)lengths[1], (int)(lengths[0] + 2)}; + int outembed[3] = {(int)lengths[2], (int)lengths[1], + (int)(lengths[0] / 2 + 1)}; + + fftwf_plan refPlan; + + int infftVectorLength = inembed[0] * inembed[1] * inembed[2]; + int outfftVectorLength = outembed[0] * outembed[1] * outembed[2]; + + float *refin = (float *)malloc(sizeof(float) * fftbatchLength); + fftwf_complex *refout = (fftwf_complex *)fftwf_malloc( + sizeof(fftwf_complex) * outfftVectorLength * batch_size); + + refPlan = fftwf_plan_many_dft_r2c( + dim, &fftwLengths[3 - dim], batch_size, refin, &inembed[3 - dim], 1, + infftVectorLength, refout, &outembed[3 - dim], 1, outfftVectorLength, + FFTW_ESTIMATE); + + uint24_t *in24bitData = (uint24_t *)malloc(sizeof(uint24_t) * fftbatchLength); + + // Initialize Data + srand(1); + for (size_t idx = 0; idx < fftbatchLength; ++idx) { + int randomVal = (int)rand(); + + in24bitData[idx][0] = (randomVal >> 16) & 0xFF; + in24bitData[idx][1] = (randomVal >> 8) & 0xFF; + in24bitData[idx][2] = randomVal & 0xFF; + } + + float val; + + for (size_t i = 0; i < fftbatchLength; i++) { + val = (float)(in24bitData[i][0] << 16 | in24bitData[i][1] << 8 | + in24bitData[i][2]); + + refin[i] = val; + } + + fftwf_execute(refPlan); + + free(refin); + + fftwf_destroy_plan(refPlan); + + // Execute post-process code + for (size_t idx = 0; idx < (outfftVectorLength * batch_size); ++idx) { + float magnitude = sqrtf(pow(refout[idx][0], 2) + pow(refout[idx][1], 2)); + refout[idx][0] = magnitude; + } + + return refout; } diff --git a/src/callback-client/client.h b/src/callback-client/client.h index 79d260d5..6bd5bee0 100644 --- a/src/callback-client/client.h +++ b/src/callback-client/client.h @@ -14,95 +14,114 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLIENT_H ) +#if !defined(CLIENT_H) #define CLIENT_H // Boost headers that we want to use // #define BOOST_PROGRAM_OPTIONS_DYN_LINK -#include -#include "stdafx.h" -#include "../statTimer/statisticalTimer.extern.h" #include "../include/unicode.compatibility.h" +#include "../statTimer/statisticalTimer.extern.h" +#include "stdafx.h" +#include #include -typedef unsigned char uint24_t[3]; +typedef unsigned char uint24_t[3]; #define CALLBCKSTR(...) #__VA_ARGS__ -#define STRINGIFY(...) CALLBCKSTR(__VA_ARGS__) - -#define BATCH_LENGTH 1024 - -#define ConvertToFloat typedef unsigned char uint24_t[3]; \n \ - float convert24To32bit(__global void* in, uint inoffset, __global void* userdata) \n \ - { \n \ - __global uint24_t* inData = (__global uint24_t*)in; \n \ - float val = inData[inoffset][0] << 16 | inData[inoffset][1] << 8 | inData[inoffset][2] ; \n \ - return val; \n \ - } - -#define ConvertToFloat_KERNEL typedef unsigned char uint24_t[3]; \n \ - __kernel void convert24To32bit (__global void *input, __global void *output) \n \ - { \n \ - uint inoffset = get_global_id(0); \n \ - __global uint24_t* inData = (__global uint24_t*)input; \n \ - float val = inData[inoffset][0] << 16 | inData[inoffset][1] << 8 | inData[inoffset][2] ; \n \ - *((__global float*)output + inoffset) = val; \n \ - } \n - -#define MagnitudeExtraction void extractMagnitude(__global void *output, uint outoffset, __global void *userdata, float2 fftoutput) \n \ - { \n \ - float magnitude = sqrt(fftoutput.x * fftoutput.x + fftoutput.y * fftoutput.y); \n \ - *((__global float*)output + outoffset) = magnitude; \n \ - } \n - -#define MagnitudeExtraction_KERNEL __kernel void extractMagnitude(__global float2 *output, __global float *magoutput) \n \ - { \n \ - uint outoffset = get_global_id(0); \n \ - float magnitude = sqrt(output[outoffset].x * output[outoffset].x + output[outoffset].y * output[outoffset].y); \n \ - *(magoutput + outoffset) = magnitude; \n \ - } \n - -template < typename T > -void R2C_transform(std::auto_ptr< clfftSetupData > setupData, size_t* inlengths, size_t batchSize, - clfftDim dim, clfftPrecision precision, cl_uint profile_count); - -template < typename T > -void runR2C_FFT_WithCallback(std::auto_ptr< clfftSetupData > setupData, cl_context context, cl_command_queue commandQueue, - size_t* inlengths, clfftDim dim, clfftPrecision precision, - size_t batchSize, size_t vectorLength, size_t fftLength, cl_uint profile_count); - -template < typename T > -void runR2C_FFT_PreAndPostprocessKernel(std::auto_ptr< clfftSetupData > setupData, cl_context context, - cl_command_queue commandQueue, cl_device_id device_id, - size_t* inlengths, clfftDim dim, clfftPrecision precision, - size_t batchSize, size_t vectorLength, size_t fftLength, cl_uint profile_count); - -fftwf_complex* get_R2C_fftwf_output(size_t* lengths, size_t fftbatchLength, int batch_size, - clfftLayout in_layout, clfftDim dim); - -template < typename T1, typename T2> -bool compare(T1 *refData, std::vector< T2 > data, - size_t length, const float epsilon = 1e-6f); +#define STRINGIFY(...) CALLBCKSTR(__VA_ARGS__) + +#define BATCH_LENGTH 1024 + +#define ConvertToFloat \ + typedef unsigned char uint24_t[3]; \ + \n float convert24To32bit(__global void *in, uint inoffset, \ + __global void *userdata) \n { \ + \n __global uint24_t *inData = (__global uint24_t *)in; \ + \n float val = inData[inoffset][0] << 16 | inData[inoffset][1] << 8 | \ + inData[inoffset][2]; \ + \n return val; \ + \n \ + } + +#define ConvertToFloat_KERNEL \ + typedef unsigned char uint24_t[3]; \ + \n __kernel void convert24To32bit(__global void *input, \ + __global void *output) \n { \ + \n uint inoffset = get_global_id(0); \ + \n __global uint24_t *inData = (__global uint24_t *)input; \ + \n float val = inData[inoffset][0] << 16 | inData[inoffset][1] << 8 | \ + inData[inoffset][2]; \ + \n *((__global float *)output + inoffset) = val; \ + \n \ + } \ + \n + +#define MagnitudeExtraction \ + void extractMagnitude(__global void *output, uint outoffset, \ + __global void *userdata, float2 fftoutput) \n { \ + \n float magnitude = \ + sqrt(fftoutput.x * fftoutput.x + fftoutput.y * fftoutput.y); \ + \n *((__global float *)output + outoffset) = magnitude; \ + \n \ + } \ + \n + +#define MagnitudeExtraction_KERNEL \ + __kernel void extractMagnitude(__global float2 *output, \ + __global float *magoutput) \n { \ + \n uint outoffset = get_global_id(0); \ + \n float magnitude = sqrt(output[outoffset].x * output[outoffset].x + \ + output[outoffset].y * output[outoffset].y); \ + \n *(magoutput + outoffset) = magnitude; \ + \n \ + } \ + \n + +template +void R2C_transform(std::auto_ptr setupData, size_t *inlengths, + size_t batchSize, clfftDim dim, clfftPrecision precision, + cl_uint profile_count); + +template +void runR2C_FFT_WithCallback(std::auto_ptr setupData, + cl_context context, cl_command_queue commandQueue, + size_t *inlengths, clfftDim dim, + clfftPrecision precision, size_t batchSize, + size_t vectorLength, size_t fftLength, + cl_uint profile_count); + +template +void runR2C_FFT_PreAndPostprocessKernel( + std::auto_ptr setupData, cl_context context, + cl_command_queue commandQueue, cl_device_id device_id, size_t *inlengths, + clfftDim dim, clfftPrecision precision, size_t batchSize, + size_t vectorLength, size_t fftLength, cl_uint profile_count); + +fftwf_complex *get_R2C_fftwf_output(size_t *lengths, size_t fftbatchLength, + int batch_size, clfftLayout in_layout, + clfftDim dim); + +template +bool compare(T1 *refData, std::vector data, size_t length, + const float epsilon = 1e-6f); #ifdef WIN32 -struct Timer -{ - LARGE_INTEGER start, stop, freq; +struct Timer { + LARGE_INTEGER start, stop, freq; public: - Timer() { QueryPerformanceFrequency( &freq ); } - - void Start() { QueryPerformanceCounter(&start); } - double Sample() - { - QueryPerformanceCounter ( &stop ); - double time = (double)(stop.QuadPart-start.QuadPart) / (double)(freq.QuadPart); - return time; - } + Timer() { QueryPerformanceFrequency(&freq); } + + void Start() { QueryPerformanceCounter(&start); } + double Sample() { + QueryPerformanceCounter(&stop); + double time = + (double)(stop.QuadPart - start.QuadPart) / (double)(freq.QuadPart); + return time; + } }; #elif defined(__APPLE__) || defined(__MACOSX) @@ -110,43 +129,41 @@ struct Timer #include #include -struct Timer -{ - clock_serv_t clock; - mach_timespec_t start, end; +struct Timer { + clock_serv_t clock; + mach_timespec_t start, end; public: - Timer() { host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clock); } - ~Timer() { mach_port_deallocate(mach_task_self(), clock); } - - void Start() { clock_get_time(clock, &start); } - double Sample() - { - clock_get_time(clock, &end); - double time = 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; - return time * 1E-9; - } + Timer() { host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clock); } + ~Timer() { mach_port_deallocate(mach_task_self(), clock); } + + void Start() { clock_get_time(clock, &start); } + double Sample() { + clock_get_time(clock, &end); + double time = + 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; + return time * 1E-9; + } }; #else -#include #include +#include -struct Timer -{ - struct timespec start, end; +struct Timer { + struct timespec start, end; public: - Timer() { } - - void Start() { clock_gettime(CLOCK_MONOTONIC, &start); } - double Sample() - { - clock_gettime(CLOCK_MONOTONIC, &end); - double time = 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; - return time * 1E-9; - } + Timer() {} + + void Start() { clock_gettime(CLOCK_MONOTONIC, &start); } + double Sample() { + clock_gettime(CLOCK_MONOTONIC, &end); + double time = + 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; + return time * 1E-9; + } }; #endif diff --git a/src/callback-client/openCL.misc.cpp b/src/callback-client/openCL.misc.cpp index e406d713..a438f85d 100644 --- a/src/callback-client/openCL.misc.cpp +++ b/src/callback-client/openCL.misc.cpp @@ -14,520 +14,593 @@ * limitations under the License. * ************************************************************************/ - // clfft.opencl.cpp : Provides functions to set up openCL // +#include "openCL.misc.h" +#include "clFFT.h" #include "stdafx.h" -#include +#include #include #include -#include +#include #include -#include "clFFT.h" -#include "openCL.misc.h" - - - -void prettyPrintPlatformInfo( const cl_platform_id& pId ) -{ - size_t platformProfileSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_PROFILE, 0, NULL, &platformProfileSize ), - "Getting CL_PLATFORM_PROFILE Platform Info string size ( ::clGetPlatformInfo() )" ); - - std::vector< char > szPlatformProfile( platformProfileSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_PROFILE, platformProfileSize, &szPlatformProfile[ 0 ], NULL), - "Getting CL_PLATFORM_PROFILE Platform Info string ( ::clGetPlatformInfo() )" ); - - size_t platformVersionSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VERSION, 0, NULL, &platformVersionSize ), - "Getting CL_PLATFORM_VERSION Platform Info string size ( ::clGetPlatformInfo() )" ); - - std::vector< char > szPlatformVersion( platformVersionSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VERSION, platformVersionSize, &szPlatformVersion[ 0 ], NULL), - "Getting CL_PLATFORM_VERSION Platform Info string ( ::clGetPlatformInfo() )" ); - - size_t platformNameSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_NAME, 0, NULL, &platformNameSize ), - "Getting CL_PLATFORM_NAME Platform Info string size ( ::clGetPlatformInfo() )" ); - - std::vector< char > szPlatformName( platformNameSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_NAME, platformNameSize, &szPlatformName[ 0 ], NULL), - "Getting CL_PLATFORM_NAME Platform Info string ( ::clGetPlatformInfo() )" ); - size_t vendorStringSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VENDOR, 0, NULL, &vendorStringSize ), - "Getting CL_PLATFORM_VENDOR Platform Info string size ( ::clGetPlatformInfo() )" ); +void prettyPrintPlatformInfo(const cl_platform_id &pId) { + size_t platformProfileSize = 0; + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_PROFILE, 0, NULL, + &platformProfileSize), + "Getting CL_PLATFORM_PROFILE Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformProfile(platformProfileSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_PROFILE, + platformProfileSize, &szPlatformProfile[0], + NULL), + "Getting CL_PLATFORM_PROFILE Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t platformVersionSize = 0; + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_VERSION, 0, NULL, + &platformVersionSize), + "Getting CL_PLATFORM_VERSION Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformVersion(platformVersionSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_VERSION, + platformVersionSize, &szPlatformVersion[0], + NULL), + "Getting CL_PLATFORM_VERSION Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t platformNameSize = 0; + OPENCL_V_THROW( + ::clGetPlatformInfo(pId, CL_PLATFORM_NAME, 0, NULL, &platformNameSize), + "Getting CL_PLATFORM_NAME Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformName(platformNameSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_NAME, platformNameSize, + &szPlatformName[0], NULL), + "Getting CL_PLATFORM_NAME Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t vendorStringSize = 0; + OPENCL_V_THROW( + ::clGetPlatformInfo(pId, CL_PLATFORM_VENDOR, 0, NULL, &vendorStringSize), + "Getting CL_PLATFORM_VENDOR Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformVendor(vendorStringSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_VENDOR, vendorStringSize, + &szPlatformVendor[0], NULL), + "Getting CL_PLATFORM_VENDOR Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t platformExtensionsSize = 0; + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_EXTENSIONS, 0, NULL, + &platformExtensionsSize), + "Getting CL_PLATFORM_EXTENSIONS Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformExtensions(platformExtensionsSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_EXTENSIONS, + platformExtensionsSize, + &szPlatformExtensions[0], NULL), + "Getting CL_PLATFORM_EXTENSIONS Platform Info string ( " + "::clGetPlatformInfo() )"); + + const int indent = countOf(" CL_PLATFORM_EXTENSIONS: "); + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_PROFILE: " << &szPlatformProfile[0] + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_VERSION: " << &szPlatformVersion[0] + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_NAME: " << &szPlatformName[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_VENDOR: " << &szPlatformVendor[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_EXTENSIONS: " << &szPlatformExtensions[0] + << std::endl; + std::cout << std::right << std::endl; +} - std::vector< char > szPlatformVendor( vendorStringSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VENDOR, vendorStringSize, &szPlatformVendor[ 0 ], NULL), - "Getting CL_PLATFORM_VENDOR Platform Info string ( ::clGetPlatformInfo() )" ); +void prettyPrintDeviceInfo(const cl_device_id &dId) { + size_t deviceNameSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_NAME, 0, NULL, &deviceNameSize), + "Getting CL_DEVICE_NAME Platform Info string size ( ::clGetDeviceInfo() " + ")"); + + std::vector szDeviceName(deviceNameSize); + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_NAME, deviceNameSize, &szDeviceName[0], + NULL), + "Getting CL_DEVICE_NAME Platform Info string ( ::clGetDeviceInfo() )"); + + size_t deviceVersionSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_VERSION, 0, NULL, &deviceVersionSize), + "Getting CL_DEVICE_VERSION Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDeviceVersion(deviceVersionSize); + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_VERSION, deviceVersionSize, + &szDeviceVersion[0], NULL), + "Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )"); + + size_t driverVersionSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DRIVER_VERSION, 0, NULL, &driverVersionSize), + "Getting CL_DRIVER_VERSION Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDriverVersion(driverVersionSize); + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DRIVER_VERSION, driverVersionSize, + &szDriverVersion[0], NULL), + "Getting CL_DRIVER_VERSION Platform Info string ( ::clGetDeviceInfo() )"); + + size_t openCLVersionSize = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, + &openCLVersionSize), + "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string size " + "( ::clGetDeviceInfo() )"); + + std::vector szOpenCLVersion(openCLVersionSize); + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_OPENCL_C_VERSION, + openCLVersionSize, &szOpenCLVersion[0], + NULL), + "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string ( " + "::clGetDeviceInfo() )"); + + cl_device_type devType = CL_DEVICE_TYPE_DEFAULT; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_TYPE, sizeof(cl_device_type), + &devType, NULL), + "Getting CL_DEVICE_TYPE device info ( ::clGetDeviceInfo() )"); + + cl_uint devAddrBits = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), + &devAddrBits, NULL), + "Getting CL_DEVICE_ADDRESS_BITS device info ( ::clGetDeviceInfo() )"); + + cl_uint maxClockFreq = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_CLOCK_FREQUENCY, + sizeof(cl_uint), &maxClockFreq, NULL), + "Getting CL_DEVICE_MAX_CLOCK_FREQUENCY device info ( " + "::clGetDeviceInfo() )"); + + cl_bool devAvailable = CL_FALSE; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_AVAILABLE, sizeof(cl_bool), + &devAvailable, NULL), + "Getting CL_DEVICE_AVAILABLE device info ( ::clGetDeviceInfo() )"); + + cl_bool devCompAvailable = CL_FALSE; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_COMPILER_AVAILABLE, + sizeof(cl_bool), &devCompAvailable, NULL), + "Getting CL_DEVICE_COMPILER_AVAILABLE device info ( " + "::clGetDeviceInfo() )"); + + size_t devMaxWorkGroup = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_WORK_GROUP_SIZE, + sizeof(size_t), &devMaxWorkGroup, NULL), + "Getting CL_DEVICE_MAX_WORK_GROUP_SIZE device info ( " + "::clGetDeviceInfo() )"); + + cl_uint devMaxWorkItemDim = CL_FALSE; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, + sizeof(cl_uint), &devMaxWorkItemDim, NULL), + "Getting CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS device info ( " + "::clGetDeviceInfo() )"); + + std::vector devMaxWorkItemSizes(devMaxWorkItemDim); + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_WORK_ITEM_SIZES, + sizeof(size_t) * devMaxWorkItemSizes.size(), + &devMaxWorkItemSizes[0], NULL), + "Getting CL_DEVICE_MAX_WORK_ITEM_SIZES device info ( " + "::clGetDeviceInfo() )"); + + cl_bool deviceHostUnified = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_HOST_UNIFIED_MEMORY, + sizeof(cl_bool), &deviceHostUnified, NULL), + "Getting CL_DEVICE_HOST_UNIFIED_MEMORY Platform Info string ( " + "::clGetDeviceInfo() )"); + + cl_ulong devMaxConstantBuffer = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, + sizeof(cl_ulong), &devMaxConstantBuffer, + NULL), + "Getting CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE device info ( " + "::clGetDeviceInfo() )"); + + cl_ulong devLocalMemSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), + &devLocalMemSize, NULL), + "Getting CL_DEVICE_LOCAL_MEM_SIZE device info ( ::clGetDeviceInfo() )"); + + cl_ulong deviceGlobalMemSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), + &deviceGlobalMemSize, NULL), + "Getting CL_DEVICE_GLOBAL_MEM_SIZE device info ( ::clGetDeviceInfo() )"); + + cl_ulong deviceMaxMemAllocSize = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_MEM_ALLOC_SIZE, + sizeof(cl_ulong), &deviceMaxMemAllocSize, + NULL), + "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( " + "::clGetDeviceInfo() )"); + + size_t deviceExtSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_EXTENSIONS, 0, NULL, &deviceExtSize), + "Getting CL_DEVICE_EXTENSIONS Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDeviceExt(deviceExtSize); + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_EXTENSIONS, deviceExtSize, + &szDeviceExt[0], NULL), + "Getting CL_DEVICE_EXTENSIONS Platform Info string ( " + "::clGetDeviceInfo() )"); + + const int indent = countOf(" CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: "); + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_NAME: " << &szDeviceName[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_VERSION: " << &szDeviceVersion[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DRIVER_VERSION: " << &szDriverVersion[0] << std::endl; + std::cout << std::left << std::setw(indent) << " CL_DEVICE_TYPE: " + << (CL_DEVICE_TYPE_DEFAULT & devType ? "default" : "") + << (CL_DEVICE_TYPE_CPU & devType ? "CPU" : "") + << (CL_DEVICE_TYPE_GPU & devType ? "GPU" : "") + << (CL_DEVICE_TYPE_ACCELERATOR & devType ? "Accelerator" : "") + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_CLOCK_FREQUENCY: " << maxClockFreq + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_ADDRESS_BITS: " << devAddrBits << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_AVAILABLE: " << (devAvailable ? "TRUE" : "FALSE") + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_COMPILER_AVAILABLE: " + << (devCompAvailable ? "TRUE" : "FALSE") << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_OPENCL_C_VERSION: " << &szOpenCLVersion[0] + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_WORK_GROUP_SIZE: " << devMaxWorkGroup + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " << devMaxWorkItemDim + << std::endl; + for (cl_uint wis = 0; wis < devMaxWorkItemSizes.size(); ++wis) { + std::stringstream dimString; + dimString << "Dimension[ " << wis << " ] "; + std::cout << std::right << std::setw(indent) << dimString.str() + << devMaxWorkItemSizes[wis] << std::endl; + } + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_HOST_UNIFIED_MEMORY: " + << (deviceHostUnified ? "TRUE" : "FALSE") << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: " + << devMaxConstantBuffer; + std::cout << " ( " << devMaxConstantBuffer / 1024 << " KB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_LOCAL_MEM_SIZE: " << devLocalMemSize; + std::cout << " ( " << devLocalMemSize / 1024 << " KB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_GLOBAL_MEM_SIZE: " << deviceGlobalMemSize; + std::cout << " ( " << deviceGlobalMemSize / 1048576 << " MB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_MEM_ALLOC_SIZE: " << deviceMaxMemAllocSize; + std::cout << " ( " << deviceMaxMemAllocSize / 1048576 << " MB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_EXTENSIONS: " << &szDeviceExt[0] << std::endl; + + std::cout << std::right << std::endl; +} - size_t platformExtensionsSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_EXTENSIONS, 0, NULL, &platformExtensionsSize ), - "Getting CL_PLATFORM_EXTENSIONS Platform Info string size ( ::clGetPlatformInfo() )" ); +void prettyPrintCLPlatforms(std::vector &platforms, + std::vector> &devices) { + for (unsigned int i = 0; i < platforms.size(); ++i) { + std::cout << "OpenCL platform [ " << i << " ]:" << std::endl; + prettyPrintPlatformInfo(platforms[i]); - std::vector< char > szPlatformExtensions( platformExtensionsSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_EXTENSIONS, platformExtensionsSize, &szPlatformExtensions[ 0 ], NULL), - "Getting CL_PLATFORM_EXTENSIONS Platform Info string ( ::clGetPlatformInfo() )" ); + for (unsigned int n = 0; n < devices[i].size(); ++n) { + std::cout << "OpenCL platform [ " << i << " ], device [ " << n + << " ]:" << std::endl; + prettyPrintDeviceInfo((devices[i])[n]); + } + } +} - const int indent = countOf( " CL_PLATFORM_EXTENSIONS: " ); - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_PROFILE: " << &szPlatformProfile[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_VERSION: " << &szPlatformVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_NAME: " << &szPlatformName[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_VENDOR: " << &szPlatformVendor[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_EXTENSIONS: " << &szPlatformExtensions[ 0 ] << std::endl; - std::cout << std::right << std::endl; +// Verify a failed condition; return true on fail +inline cl_bool OPENCL_V_FAIL(cl_int res) { + if (res == CL_SUCCESS) + return CL_FALSE; + else + return CL_TRUE; } -void prettyPrintDeviceInfo( const cl_device_id& dId ) -{ - size_t deviceNameSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_NAME, 0, NULL, &deviceNameSize ), - "Getting CL_DEVICE_NAME Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDeviceName( deviceNameSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_NAME, deviceNameSize, &szDeviceName[ 0 ], NULL ), - "Getting CL_DEVICE_NAME Platform Info string ( ::clGetDeviceInfo() )" ); - - size_t deviceVersionSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_VERSION, 0, NULL, &deviceVersionSize ), - "Getting CL_DEVICE_VERSION Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDeviceVersion( deviceVersionSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_VERSION, deviceVersionSize, &szDeviceVersion[ 0 ], NULL ), - "Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )" ); - - size_t driverVersionSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DRIVER_VERSION, 0, NULL, &driverVersionSize ), - "Getting CL_DRIVER_VERSION Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDriverVersion( driverVersionSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DRIVER_VERSION, driverVersionSize, &szDriverVersion[ 0 ], NULL ), - "Getting CL_DRIVER_VERSION Platform Info string ( ::clGetDeviceInfo() )" ); - - size_t openCLVersionSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, &openCLVersionSize ), - "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szOpenCLVersion( openCLVersionSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_OPENCL_C_VERSION, openCLVersionSize, &szOpenCLVersion[ 0 ], NULL ), - "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string ( ::clGetDeviceInfo() )" ); - - cl_device_type devType = CL_DEVICE_TYPE_DEFAULT; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_TYPE, sizeof( cl_device_type ), &devType, NULL ), - "Getting CL_DEVICE_TYPE device info ( ::clGetDeviceInfo() )" ); - - cl_uint devAddrBits = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_ADDRESS_BITS, sizeof( cl_uint ), &devAddrBits, NULL ), - "Getting CL_DEVICE_ADDRESS_BITS device info ( ::clGetDeviceInfo() )" ); - - cl_uint maxClockFreq = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof( cl_uint ), &maxClockFreq, NULL ), - "Getting CL_DEVICE_MAX_CLOCK_FREQUENCY device info ( ::clGetDeviceInfo() )" ); - - cl_bool devAvailable = CL_FALSE; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_AVAILABLE, sizeof( cl_bool ), &devAvailable, NULL ), - "Getting CL_DEVICE_AVAILABLE device info ( ::clGetDeviceInfo() )" ); - - cl_bool devCompAvailable = CL_FALSE; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_COMPILER_AVAILABLE, sizeof( cl_bool ), &devCompAvailable, NULL ), - "Getting CL_DEVICE_COMPILER_AVAILABLE device info ( ::clGetDeviceInfo() )" ); - - size_t devMaxWorkGroup = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof( size_t ), &devMaxWorkGroup, NULL ), - "Getting CL_DEVICE_MAX_WORK_GROUP_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_uint devMaxWorkItemDim = CL_FALSE; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof( cl_uint ), &devMaxWorkItemDim, NULL ), - "Getting CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS device info ( ::clGetDeviceInfo() )" ); - - std::vector< size_t > devMaxWorkItemSizes( devMaxWorkItemDim ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof( size_t )*devMaxWorkItemSizes.size( ), &devMaxWorkItemSizes[0], NULL), - "Getting CL_DEVICE_MAX_WORK_ITEM_SIZES device info ( ::clGetDeviceInfo() )" ); - - cl_bool deviceHostUnified = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof( cl_bool ), &deviceHostUnified, NULL ), - "Getting CL_DEVICE_HOST_UNIFIED_MEMORY Platform Info string ( ::clGetDeviceInfo() )" ); - - cl_ulong devMaxConstantBuffer = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof( cl_ulong ), &devMaxConstantBuffer, NULL ), - "Getting CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_ulong devLocalMemSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_LOCAL_MEM_SIZE, sizeof( cl_ulong ), &devLocalMemSize, NULL ), - "Getting CL_DEVICE_LOCAL_MEM_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_ulong deviceGlobalMemSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( cl_ulong ), &deviceGlobalMemSize, NULL ), - "Getting CL_DEVICE_GLOBAL_MEM_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_ulong deviceMaxMemAllocSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( cl_ulong ), &deviceMaxMemAllocSize, NULL ), - "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( ::clGetDeviceInfo() )" ); - - size_t deviceExtSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_EXTENSIONS, 0, NULL, &deviceExtSize ), - "Getting CL_DEVICE_EXTENSIONS Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDeviceExt( deviceExtSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_EXTENSIONS, deviceExtSize, &szDeviceExt[ 0 ], NULL ), - "Getting CL_DEVICE_EXTENSIONS Platform Info string ( ::clGetDeviceInfo() )" ); - - const int indent = countOf( " CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " ); - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_NAME: " << &szDeviceName[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_VERSION: " << &szDeviceVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DRIVER_VERSION: " << &szDriverVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_TYPE: " - << (CL_DEVICE_TYPE_DEFAULT & devType ? "default" : "") - << (CL_DEVICE_TYPE_CPU & devType ? "CPU" : "") - << (CL_DEVICE_TYPE_GPU & devType ? "GPU" : "") - << (CL_DEVICE_TYPE_ACCELERATOR & devType ? "Accelerator" : "") - << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_CLOCK_FREQUENCY: " << maxClockFreq << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_ADDRESS_BITS: " << devAddrBits << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_AVAILABLE: " << ( devAvailable ? "TRUE": "FALSE") << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_COMPILER_AVAILABLE: " << ( devCompAvailable ? "TRUE": "FALSE") << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_OPENCL_C_VERSION: " << &szOpenCLVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_WORK_GROUP_SIZE: " << devMaxWorkGroup << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " << devMaxWorkItemDim << std::endl; - for( cl_uint wis = 0; wis < devMaxWorkItemSizes.size( ); ++wis ) - { - std::stringstream dimString; - dimString << "Dimension[ " << wis << " ] "; - std::cout << std::right << std::setw( indent ) << dimString.str( ) << devMaxWorkItemSizes[wis] << std::endl; - } - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_HOST_UNIFIED_MEMORY: " << ( deviceHostUnified ? "TRUE": "FALSE") << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: " << devMaxConstantBuffer; - std::cout << " ( " << devMaxConstantBuffer / 1024 << " KB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_LOCAL_MEM_SIZE: " << devLocalMemSize; - std::cout << " ( " << devLocalMemSize / 1024 << " KB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_GLOBAL_MEM_SIZE: " << deviceGlobalMemSize; - std::cout << " ( " << deviceGlobalMemSize / 1048576 << " MB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_MEM_ALLOC_SIZE: " << deviceMaxMemAllocSize; - std::cout << " ( " << deviceMaxMemAllocSize / 1048576 << " MB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_EXTENSIONS: " << &szDeviceExt[ 0 ] << std::endl; - - std::cout << std::right << std::endl; +std::string prettyPrintclFFTStatus(const cl_int &status) { + switch (status) { + case CLFFT_INVALID_GLOBAL_WORK_SIZE: + return "CLFFT_INVALID_GLOBAL_WORK_SIZE"; + case CLFFT_INVALID_MIP_LEVEL: + return "CLFFT_INVALID_MIP_LEVEL"; + case CLFFT_INVALID_BUFFER_SIZE: + return "CLFFT_INVALID_BUFFER_SIZE"; + case CLFFT_INVALID_GL_OBJECT: + return "CLFFT_INVALID_GL_OBJECT"; + case CLFFT_INVALID_OPERATION: + return "CLFFT_INVALID_OPERATION"; + case CLFFT_INVALID_EVENT: + return "CLFFT_INVALID_EVENT"; + case CLFFT_INVALID_EVENT_WAIT_LIST: + return "CLFFT_INVALID_EVENT_WAIT_LIST"; + case CLFFT_INVALID_GLOBAL_OFFSET: + return "CLFFT_INVALID_GLOBAL_OFFSET"; + case CLFFT_INVALID_WORK_ITEM_SIZE: + return "CLFFT_INVALID_WORK_ITEM_SIZE"; + case CLFFT_INVALID_WORK_GROUP_SIZE: + return "CLFFT_INVALID_WORK_GROUP_SIZE"; + case CLFFT_INVALID_WORK_DIMENSION: + return "CLFFT_INVALID_WORK_DIMENSION"; + case CLFFT_INVALID_KERNEL_ARGS: + return "CLFFT_INVALID_KERNEL_ARGS"; + case CLFFT_INVALID_ARG_SIZE: + return "CLFFT_INVALID_ARG_SIZE"; + case CLFFT_INVALID_ARG_VALUE: + return "CLFFT_INVALID_ARG_VALUE"; + case CLFFT_INVALID_ARG_INDEX: + return "CLFFT_INVALID_ARG_INDEX"; + case CLFFT_INVALID_KERNEL: + return "CLFFT_INVALID_KERNEL"; + case CLFFT_INVALID_KERNEL_DEFINITION: + return "CLFFT_INVALID_KERNEL_DEFINITION"; + case CLFFT_INVALID_KERNEL_NAME: + return "CLFFT_INVALID_KERNEL_NAME"; + case CLFFT_INVALID_PROGRAM_EXECUTABLE: + return "CLFFT_INVALID_PROGRAM_EXECUTABLE"; + case CLFFT_INVALID_PROGRAM: + return "CLFFT_INVALID_PROGRAM"; + case CLFFT_INVALID_BUILD_OPTIONS: + return "CLFFT_INVALID_BUILD_OPTIONS"; + case CLFFT_INVALID_BINARY: + return "CLFFT_INVALID_BINARY"; + case CLFFT_INVALID_SAMPLER: + return "CLFFT_INVALID_SAMPLER"; + case CLFFT_INVALID_IMAGE_SIZE: + return "CLFFT_INVALID_IMAGE_SIZE"; + case CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR: + return "CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR"; + case CLFFT_INVALID_MEM_OBJECT: + return "CLFFT_INVALID_MEM_OBJECT"; + case CLFFT_INVALID_HOST_PTR: + return "CLFFT_INVALID_HOST_PTR"; + case CLFFT_INVALID_COMMAND_QUEUE: + return "CLFFT_INVALID_COMMAND_QUEUE"; + case CLFFT_INVALID_QUEUE_PROPERTIES: + return "CLFFT_INVALID_QUEUE_PROPERTIES"; + case CLFFT_INVALID_CONTEXT: + return "CLFFT_INVALID_CONTEXT"; + case CLFFT_INVALID_DEVICE: + return "CLFFT_INVALID_DEVICE"; + case CLFFT_INVALID_PLATFORM: + return "CLFFT_INVALID_PLATFORM"; + case CLFFT_INVALID_DEVICE_TYPE: + return "CLFFT_INVALID_DEVICE_TYPE"; + case CLFFT_INVALID_VALUE: + return "CLFFT_INVALID_VALUE"; + case CLFFT_MAP_FAILURE: + return "CLFFT_MAP_FAILURE"; + case CLFFT_BUILD_PROGRAM_FAILURE: + return "CLFFT_BUILD_PROGRAM_FAILURE"; + case CLFFT_IMAGE_FORMAT_NOT_SUPPORTED: + return "CLFFT_IMAGE_FORMAT_NOT_SUPPORTED"; + case CLFFT_IMAGE_FORMAT_MISMATCH: + return "CLFFT_IMAGE_FORMAT_MISMATCH"; + case CLFFT_MEM_COPY_OVERLAP: + return "CLFFT_MEM_COPY_OVERLAP"; + case CLFFT_PROFILING_INFO_NOT_AVAILABLE: + return "CLFFT_PROFILING_INFO_NOT_AVAILABLE"; + case CLFFT_OUT_OF_HOST_MEMORY: + return "CLFFT_OUT_OF_HOST_MEMORY"; + case CLFFT_OUT_OF_RESOURCES: + return "CLFFT_OUT_OF_RESOURCES"; + case CLFFT_MEM_OBJECT_ALLOCATION_FAILURE: + return "CLFFT_MEM_OBJECT_ALLOCATION_FAILURE"; + case CLFFT_COMPILER_NOT_AVAILABLE: + return "CLFFT_COMPILER_NOT_AVAILABLE"; + case CLFFT_DEVICE_NOT_AVAILABLE: + return "CLFFT_DEVICE_NOT_AVAILABLE"; + case CLFFT_DEVICE_NOT_FOUND: + return "CLFFT_DEVICE_NOT_FOUND"; + case CLFFT_SUCCESS: + return "CLFFT_SUCCESS"; + case CLFFT_NOTIMPLEMENTED: + return "CLFFT_NOTIMPLEMENTED"; + case CLFFT_TRANSPOSED_NOTIMPLEMENTED: + return "CLFFT_TRANSPOSED_NOTIMPLEMENTED"; + case CLFFT_FILE_NOT_FOUND: + return "CLFFT_FILE_NOT_FOUND"; + case CLFFT_FILE_CREATE_FAILURE: + return "CLFFT_FILE_CREATE_FAILURE"; + case CLFFT_VERSION_MISMATCH: + return "CLFFT_VERSION_MISMATCH"; + case CLFFT_INVALID_PLAN: + return "CLFFT_INVALID_PLAN"; + default: + return "Error code not defined"; + break; + } } -void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices) -{ - for (unsigned int i = 0; i < platforms.size(); ++i) - { - std::cout << "OpenCL platform [ " << i << " ]:" << std::endl; - prettyPrintPlatformInfo(platforms[i]); - - for (unsigned int n = 0; n < devices[i].size(); ++n) - { - std::cout << "OpenCL platform [ " << i << " ], device [ " << n << " ]:" << std::endl; - prettyPrintDeviceInfo((devices[i])[n]); - } - } +int discoverCLPlatforms(cl_device_type deviceType, + std::vector &platforms, + std::vector> &devices) { + cl_int status = 0; -} + /* + * Find all OpenCL platforms this system has to offer. + */ -// Verify a failed condition; return true on fail -inline cl_bool OPENCL_V_FAIL( cl_int res ) -{ - if( res == CL_SUCCESS ) - return CL_FALSE; - else - return CL_TRUE; -} + cl_uint numPlatforms = 0; + cl_platform_id platform = NULL; + OPENCL_V_THROW(::clGetPlatformIDs(0, NULL, &numPlatforms), + "Getting number of platforms( ::clGetPlatformsIDs() )"); + + if (numPlatforms > 0) { + platforms.resize(numPlatforms); + devices.resize(numPlatforms); + OPENCL_V_THROW(::clGetPlatformIDs(numPlatforms, &platforms[0], NULL), + "Getting Platform Id's ( ::clGetPlatformsIDs() )"); -std::string prettyPrintclFFTStatus( const cl_int& status ) -{ - switch( status ) - { - case CLFFT_INVALID_GLOBAL_WORK_SIZE: - return "CLFFT_INVALID_GLOBAL_WORK_SIZE"; - case CLFFT_INVALID_MIP_LEVEL: - return "CLFFT_INVALID_MIP_LEVEL"; - case CLFFT_INVALID_BUFFER_SIZE: - return "CLFFT_INVALID_BUFFER_SIZE"; - case CLFFT_INVALID_GL_OBJECT: - return "CLFFT_INVALID_GL_OBJECT"; - case CLFFT_INVALID_OPERATION: - return "CLFFT_INVALID_OPERATION"; - case CLFFT_INVALID_EVENT: - return "CLFFT_INVALID_EVENT"; - case CLFFT_INVALID_EVENT_WAIT_LIST: - return "CLFFT_INVALID_EVENT_WAIT_LIST"; - case CLFFT_INVALID_GLOBAL_OFFSET: - return "CLFFT_INVALID_GLOBAL_OFFSET"; - case CLFFT_INVALID_WORK_ITEM_SIZE: - return "CLFFT_INVALID_WORK_ITEM_SIZE"; - case CLFFT_INVALID_WORK_GROUP_SIZE: - return "CLFFT_INVALID_WORK_GROUP_SIZE"; - case CLFFT_INVALID_WORK_DIMENSION: - return "CLFFT_INVALID_WORK_DIMENSION"; - case CLFFT_INVALID_KERNEL_ARGS: - return "CLFFT_INVALID_KERNEL_ARGS"; - case CLFFT_INVALID_ARG_SIZE: - return "CLFFT_INVALID_ARG_SIZE"; - case CLFFT_INVALID_ARG_VALUE: - return "CLFFT_INVALID_ARG_VALUE"; - case CLFFT_INVALID_ARG_INDEX: - return "CLFFT_INVALID_ARG_INDEX"; - case CLFFT_INVALID_KERNEL: - return "CLFFT_INVALID_KERNEL"; - case CLFFT_INVALID_KERNEL_DEFINITION: - return "CLFFT_INVALID_KERNEL_DEFINITION"; - case CLFFT_INVALID_KERNEL_NAME: - return "CLFFT_INVALID_KERNEL_NAME"; - case CLFFT_INVALID_PROGRAM_EXECUTABLE: - return "CLFFT_INVALID_PROGRAM_EXECUTABLE"; - case CLFFT_INVALID_PROGRAM: - return "CLFFT_INVALID_PROGRAM"; - case CLFFT_INVALID_BUILD_OPTIONS: - return "CLFFT_INVALID_BUILD_OPTIONS"; - case CLFFT_INVALID_BINARY: - return "CLFFT_INVALID_BINARY"; - case CLFFT_INVALID_SAMPLER: - return "CLFFT_INVALID_SAMPLER"; - case CLFFT_INVALID_IMAGE_SIZE: - return "CLFFT_INVALID_IMAGE_SIZE"; - case CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR: - return "CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR"; - case CLFFT_INVALID_MEM_OBJECT: - return "CLFFT_INVALID_MEM_OBJECT"; - case CLFFT_INVALID_HOST_PTR: - return "CLFFT_INVALID_HOST_PTR"; - case CLFFT_INVALID_COMMAND_QUEUE: - return "CLFFT_INVALID_COMMAND_QUEUE"; - case CLFFT_INVALID_QUEUE_PROPERTIES: - return "CLFFT_INVALID_QUEUE_PROPERTIES"; - case CLFFT_INVALID_CONTEXT: - return "CLFFT_INVALID_CONTEXT"; - case CLFFT_INVALID_DEVICE: - return "CLFFT_INVALID_DEVICE"; - case CLFFT_INVALID_PLATFORM: - return "CLFFT_INVALID_PLATFORM"; - case CLFFT_INVALID_DEVICE_TYPE: - return "CLFFT_INVALID_DEVICE_TYPE"; - case CLFFT_INVALID_VALUE: - return "CLFFT_INVALID_VALUE"; - case CLFFT_MAP_FAILURE: - return "CLFFT_MAP_FAILURE"; - case CLFFT_BUILD_PROGRAM_FAILURE: - return "CLFFT_BUILD_PROGRAM_FAILURE"; - case CLFFT_IMAGE_FORMAT_NOT_SUPPORTED: - return "CLFFT_IMAGE_FORMAT_NOT_SUPPORTED"; - case CLFFT_IMAGE_FORMAT_MISMATCH: - return "CLFFT_IMAGE_FORMAT_MISMATCH"; - case CLFFT_MEM_COPY_OVERLAP: - return "CLFFT_MEM_COPY_OVERLAP"; - case CLFFT_PROFILING_INFO_NOT_AVAILABLE: - return "CLFFT_PROFILING_INFO_NOT_AVAILABLE"; - case CLFFT_OUT_OF_HOST_MEMORY: - return "CLFFT_OUT_OF_HOST_MEMORY"; - case CLFFT_OUT_OF_RESOURCES: - return "CLFFT_OUT_OF_RESOURCES"; - case CLFFT_MEM_OBJECT_ALLOCATION_FAILURE: - return "CLFFT_MEM_OBJECT_ALLOCATION_FAILURE"; - case CLFFT_COMPILER_NOT_AVAILABLE: - return "CLFFT_COMPILER_NOT_AVAILABLE"; - case CLFFT_DEVICE_NOT_AVAILABLE: - return "CLFFT_DEVICE_NOT_AVAILABLE"; - case CLFFT_DEVICE_NOT_FOUND: - return "CLFFT_DEVICE_NOT_FOUND"; - case CLFFT_SUCCESS: - return "CLFFT_SUCCESS"; - case CLFFT_NOTIMPLEMENTED: - return "CLFFT_NOTIMPLEMENTED"; - case CLFFT_TRANSPOSED_NOTIMPLEMENTED: - return "CLFFT_TRANSPOSED_NOTIMPLEMENTED"; - case CLFFT_FILE_NOT_FOUND: - return "CLFFT_FILE_NOT_FOUND"; - case CLFFT_FILE_CREATE_FAILURE: - return "CLFFT_FILE_CREATE_FAILURE"; - case CLFFT_VERSION_MISMATCH: - return "CLFFT_VERSION_MISMATCH"; - case CLFFT_INVALID_PLAN: - return "CLFFT_INVALID_PLAN"; - default: - return "Error code not defined"; - break; + if (NULL == platforms[0]) { + throw std::runtime_error("No appropriate OpenCL platform could be found"); } -} + /* + * Now, for each platform get all available devices matching deviceType. + */ + for (unsigned int i = 0; i < numPlatforms; ++i) { + // Get the device list for deviceType. + // + cl_uint numDevices = 0; + OPENCL_V_WARN( + ::clGetDeviceIDs(platforms[i], deviceType, 0, NULL, &numDevices), + "Getting OpenCL devices ( ::clGetDeviceIDs() )"); + if (0 == numDevices) { + // OPENCL_V_WARN(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); + continue; + } + + devices[i].resize(numDevices); + OPENCL_V_THROW(::clGetDeviceIDs(platforms[i], deviceType, numDevices, + &(devices[i])[0], NULL), + "Getting OpenCL deviceIDs ( ::clGetDeviceIDs() )"); + } + } -int discoverCLPlatforms( cl_device_type deviceType, - std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices ) -{ - cl_int status = 0; - - /* - * Find all OpenCL platforms this system has to offer. - */ - - cl_uint numPlatforms = 0; - cl_platform_id platform = NULL; - OPENCL_V_THROW(::clGetPlatformIDs(0, NULL, &numPlatforms), - "Getting number of platforms( ::clGetPlatformsIDs() )"); - - if (numPlatforms > 0) - { - platforms.resize( numPlatforms ); - devices.resize( numPlatforms ); - OPENCL_V_THROW(::clGetPlatformIDs(numPlatforms, &platforms[0], NULL), - "Getting Platform Id's ( ::clGetPlatformsIDs() )"); - - if (NULL == platforms[0]) - { - throw std::runtime_error("No appropriate OpenCL platform could be found"); - } - - /* - * Now, for each platform get all available devices matching deviceType. - */ - for (unsigned int i = 0; i < numPlatforms; ++i) - { - // Get the device list for deviceType. - // - cl_uint numDevices = 0; - OPENCL_V_WARN(::clGetDeviceIDs(platforms[i], deviceType, 0, NULL, &numDevices), - "Getting OpenCL devices ( ::clGetDeviceIDs() )"); - if (0 == numDevices) - { - // OPENCL_V_WARN(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); - continue; - } - - devices[i].resize(numDevices); - OPENCL_V_THROW(::clGetDeviceIDs(platforms[i], deviceType, numDevices, &(devices[i])[0], NULL), - "Getting OpenCL deviceIDs ( ::clGetDeviceIDs() )"); - } - } - - return 0; + return 0; } -std::vector< cl_device_id > initializeCL( cl_device_type deviceType, - cl_int deviceId, - cl_int platformId, - cl_context& context, - bool printclInfo) -{ - cl_int status = 0; - cl_platform_id platform = NULL; - std::vector< cl_device_id > devices(1); - devices[0] = NULL; - - // Have a look at all the available platforms on this system - std::vector< cl_platform_id > platformInfos; - std::vector< std::vector< cl_device_id > > deviceInfos; - discoverCLPlatforms( deviceType, platformInfos, deviceInfos ); - - - for (unsigned int i = 0; i < platformInfos.size(); ++i) - { - if(i == platformId) - { - for (unsigned int n = 0; n < deviceInfos[i].size(); ++n) - { - if (n == deviceId) - { - platform = platformInfos[i]; - devices[0] = deviceInfos[i][n]; - - if(printclInfo) - { - prettyPrintPlatformInfo(platform); - prettyPrintDeviceInfo(devices[0]); - } - - break; - } - } - - break; - } - } - - - - // Do some error checking if we really selected a valid platform and a valid device - if (NULL == devices[0]) - { - OPENCL_V_THROW(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); - } - - if (NULL == platform) - { - throw std::runtime_error("No appropriate OpenCL platform could be found"); - } - - // Create an OpenCL context - cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties) platform, 0 }; - context = clCreateContext(cps, - (cl_uint)devices.size(), - &devices[0], - NULL, - NULL, - &status); - OPENCL_V_THROW(status, "Creating Context ( ::clCreateContextFromType() )"); - - return devices; +std::vector initializeCL(cl_device_type deviceType, + cl_int deviceId, cl_int platformId, + cl_context &context, bool printclInfo) { + cl_int status = 0; + cl_platform_id platform = NULL; + std::vector devices(1); + devices[0] = NULL; + + // Have a look at all the available platforms on this system + std::vector platformInfos; + std::vector> deviceInfos; + discoverCLPlatforms(deviceType, platformInfos, deviceInfos); + + for (unsigned int i = 0; i < platformInfos.size(); ++i) { + if (i == platformId) { + for (unsigned int n = 0; n < deviceInfos[i].size(); ++n) { + if (n == deviceId) { + platform = platformInfos[i]; + devices[0] = deviceInfos[i][n]; + + if (printclInfo) { + prettyPrintPlatformInfo(platform); + prettyPrintDeviceInfo(devices[0]); + } + + break; + } + } + + break; + } + } + + // Do some error checking if we really selected a valid platform and a valid + // device + if (NULL == devices[0]) { + OPENCL_V_THROW(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); + } + + if (NULL == platform) { + throw std::runtime_error("No appropriate OpenCL platform could be found"); + } + + // Create an OpenCL context + cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM, + (cl_context_properties)platform, 0}; + context = clCreateContext(cps, (cl_uint)devices.size(), &devices[0], NULL, + NULL, &status); + OPENCL_V_THROW(status, "Creating Context ( ::clCreateContextFromType() )"); + + return devices; } -int cleanupCL( cl_context* context, cl_command_queue* commandQueue, - const cl_uint numBuffersIn, cl_mem inputBuffer[], const cl_uint numBuffersOut, cl_mem outputBuffer[] ) -{ - releaseOpenCLMemBuffer( numBuffersIn, inputBuffer); - releaseOpenCLMemBuffer( numBuffersOut, outputBuffer); +int cleanupCL(cl_context *context, cl_command_queue *commandQueue, + const cl_uint numBuffersIn, cl_mem inputBuffer[], + const cl_uint numBuffersOut, cl_mem outputBuffer[]) { + releaseOpenCLMemBuffer(numBuffersIn, inputBuffer); + releaseOpenCLMemBuffer(numBuffersOut, outputBuffer); - if( *commandQueue != NULL ) - OPENCL_V_THROW( clReleaseCommandQueue( *commandQueue ), "Error: In clReleaseCommandQueue\n" ); + if (*commandQueue != NULL) + OPENCL_V_THROW(clReleaseCommandQueue(*commandQueue), + "Error: In clReleaseCommandQueue\n"); - if( *context != NULL ) - OPENCL_V_THROW( clReleaseContext( *context ), "Error: In clReleaseContext\n" ); + if (*context != NULL) + OPENCL_V_THROW(clReleaseContext(*context), "Error: In clReleaseContext\n"); - return 0; + return 0; } -int createOpenCLMemoryBuffer( cl_context& context, const size_t bufferSizeBytes, const cl_uint numBuffers, cl_mem buffer[], cl_mem_flags accessibility) { - cl_int status = 0; +int createOpenCLMemoryBuffer(cl_context &context, const size_t bufferSizeBytes, + const cl_uint numBuffers, cl_mem buffer[], + cl_mem_flags accessibility) { + cl_int status = 0; - for( cl_uint i = 0; i < numBuffers; ++i ) - { - buffer[ i ] = ::clCreateBuffer( context, accessibility, bufferSizeBytes, NULL, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - } + for (cl_uint i = 0; i < numBuffers; ++i) { + buffer[i] = ::clCreateBuffer(context, accessibility, bufferSizeBytes, NULL, + &status); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + } - return 0; + return 0; } -int releaseOpenCLMemBuffer( const cl_uint numBuffers, cl_mem buffer[]) -{ - for( cl_uint i = 0; i < numBuffers; ++i ) - { - if( buffer[ i ] != NULL ) - OPENCL_V_THROW( clReleaseMemObject( buffer[ i ] ), "Error: In clReleaseMemObject\n" ); - } +int releaseOpenCLMemBuffer(const cl_uint numBuffers, cl_mem buffer[]) { + for (cl_uint i = 0; i < numBuffers; ++i) { + if (buffer[i] != NULL) + OPENCL_V_THROW(clReleaseMemObject(buffer[i]), + "Error: In clReleaseMemObject\n"); + } - return 0; + return 0; } -void createOpenCLCommandQueue( cl_context& context, - cl_uint commandQueueFlags, - cl_command_queue& commandQueue, - std::vector< cl_device_id > devices, - const size_t bufferSizeBytesIn, - const cl_uint numBuffersIn, - cl_mem clMemBufferIn[], - const size_t bufferSizeBytesOut, - const cl_uint numBuffersOut, - cl_mem clMemBufferOut[] ) -{ - cl_int status = 0; - commandQueue = ::clCreateCommandQueue( context, devices[0], commandQueueFlags, &status ); - OPENCL_V_THROW( status, "Creating Command Queue ( ::clCreateCommandQueue() )" ); - - createOpenCLMemoryBuffer( context, bufferSizeBytesIn, numBuffersIn, clMemBufferIn, CL_MEM_READ_WRITE); - createOpenCLMemoryBuffer( context, bufferSizeBytesOut, numBuffersOut, clMemBufferOut, CL_MEM_READ_WRITE); +void createOpenCLCommandQueue( + cl_context &context, cl_uint commandQueueFlags, + cl_command_queue &commandQueue, std::vector devices, + const size_t bufferSizeBytesIn, const cl_uint numBuffersIn, + cl_mem clMemBufferIn[], const size_t bufferSizeBytesOut, + const cl_uint numBuffersOut, cl_mem clMemBufferOut[]) { + cl_int status = 0; + commandQueue = + ::clCreateCommandQueue(context, devices[0], commandQueueFlags, &status); + OPENCL_V_THROW(status, "Creating Command Queue ( ::clCreateCommandQueue() )"); + + createOpenCLMemoryBuffer(context, bufferSizeBytesIn, numBuffersIn, + clMemBufferIn, CL_MEM_READ_WRITE); + createOpenCLMemoryBuffer(context, bufferSizeBytesOut, numBuffersOut, + clMemBufferOut, CL_MEM_READ_WRITE); } - diff --git a/src/callback-client/openCL.misc.h b/src/callback-client/openCL.misc.h index 67ab5374..8962b326 100644 --- a/src/callback-client/openCL.misc.h +++ b/src/callback-client/openCL.misc.h @@ -14,32 +14,31 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( OPENCL_MISC_H ) +#if !defined(OPENCL_MISC_H) #define OPENCL_MISC_H +#include "unicode.compatibility.h" #include #include -#include "unicode.compatibility.h" // Creating a portable defintion of countof -#if defined( _MSC_VER ) - #define countOf _countof +#if defined(_MSC_VER) +#define countOf _countof #else - #define countOf( arr ) ( sizeof( arr ) / sizeof( arr[ 0 ] ) ) +#define countOf(arr) (sizeof(arr) / sizeof(arr[0])) #endif /* * \brief OpenCL platform and device discovery * Creates a list of OpenCL platforms - * and their associated devices + * and their associated devices */ -int discoverCLPlatforms( cl_device_type deviceType, - std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices ); +int discoverCLPlatforms(cl_device_type deviceType, + std::vector &platforms, + std::vector> &devices); -void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices); +void prettyPrintCLPlatforms(std::vector &platforms, + std::vector> &devices); /* * \brief OpenCL related initialization @@ -47,105 +46,95 @@ void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms, * Load CL file, compile, link CL source * Build program and kernel objects */ -std::vector< cl_device_id > initializeCL( cl_device_type deviceType, - cl_int deviceId, - cl_int platformId, - cl_context& context, - bool printclInfo ); +std::vector initializeCL(cl_device_type deviceType, + cl_int deviceId, cl_int platformId, + cl_context &context, bool printclInfo); /* * \brief OpenCL memory buffer creation */ -int createOpenCLMemoryBuffer( - cl_context& context, - const size_t bufferSizeBytes, - const cl_uint numBuffers, - cl_mem buffer[], - cl_mem_flags accessibility - ); +int createOpenCLMemoryBuffer(cl_context &context, const size_t bufferSizeBytes, + const cl_uint numBuffers, cl_mem buffer[], + cl_mem_flags accessibility); /* * \brief OpenCL command queue creation * Create Command Queue * Create OpenCL memory buffer objects */ -void createOpenCLCommandQueue( cl_context& context, - cl_uint commandQueueFlags, - cl_command_queue& commandQueue, - std::vector< cl_device_id > devices, - const size_t bufferSizeBytesIn, - const cl_uint numBuffersIn, - cl_mem clMemBufferIn[], - const size_t bufferSizeBytesOut, - const cl_uint numBuffersOut, - cl_mem clMemBufferOut[] ); +void createOpenCLCommandQueue( + cl_context &context, cl_uint commandQueueFlags, + cl_command_queue &commandQueue, std::vector devices, + const size_t bufferSizeBytesIn, const cl_uint numBuffersIn, + cl_mem clMemBufferIn[], const size_t bufferSizeBytesOut, + const cl_uint numBuffersOut, cl_mem clMemBufferOut[]); /* * \brief release OpenCL memory buffer */ -int releaseOpenCLMemBuffer( const cl_uint numBuffers, cl_mem buffer[] ); - -std::string prettyPrintclFFTStatus( const cl_int& status ); - -// This is used to either wrap an OpenCL function call, or to explicitly check a variable for an OpenCL error condition. -// If an error occurs, we throw. -// Note: std::runtime_error does not take unicode strings as input, so only strings supported -inline cl_int OpenCL_V_Throw ( cl_int res, const std::string& msg, size_t lineno ) -{ - switch( res ) - { - case CL_SUCCESS: /**< No error */ - break; - default: - { - std::stringstream tmp; - tmp << "OPENCL_V_THROWERROR< "; - tmp << prettyPrintclFFTStatus( res ); - tmp << " > ("; - tmp << lineno; - tmp << "): "; - tmp << msg; - std::string errorm (tmp.str()); - std::cout << errorm<< std::endl; - throw std::runtime_error( errorm ); - } - } - - return res; +int releaseOpenCLMemBuffer(const cl_uint numBuffers, cl_mem buffer[]); + +std::string prettyPrintclFFTStatus(const cl_int &status); + +// This is used to either wrap an OpenCL function call, or to explicitly +//check a variable for an OpenCL error condition. If an error occurs, we throw. +// Note: std::runtime_error does not take unicode strings as input, so only +//strings supported +inline cl_int OpenCL_V_Throw(cl_int res, const std::string &msg, + size_t lineno) { + switch (res) { + case CL_SUCCESS: /**< No error */ + break; + default: { + std::stringstream tmp; + tmp << "OPENCL_V_THROWERROR< "; + tmp << prettyPrintclFFTStatus(res); + tmp << " > ("; + tmp << lineno; + tmp << "): "; + tmp << msg; + std::string errorm(tmp.str()); + std::cout << errorm << std::endl; + throw std::runtime_error(errorm); + } + } + + return res; } -#define OPENCL_V_THROW(_status,_message) OpenCL_V_Throw (_status, _message, __LINE__) - -inline cl_int OpenCL_V_Warn(cl_int res, const std::string& msg, size_t lineno) -{ - switch (res) - { - case CL_SUCCESS: /**< No error */ - break; - case CL_DEVICE_NOT_FOUND: - // This happens all the time when discovering the OpenCL capabilities of the system, - // so do nothing here. - break; - default: - { - std::stringstream tmp; - tmp << "OPENCL_V_WARN< "; - tmp << prettyPrintclFFTStatus(res); - tmp << " > ("; - tmp << lineno; - tmp << "): "; - tmp << msg; - std::string errorm(tmp.str()); - std::cout << errorm << std::endl; - } - } - - return res; +#define OPENCL_V_THROW(_status, _message) \ + OpenCL_V_Throw(_status, _message, __LINE__) + +inline cl_int OpenCL_V_Warn(cl_int res, const std::string &msg, size_t lineno) { + switch (res) { + case CL_SUCCESS: /**< No error */ + break; + case CL_DEVICE_NOT_FOUND: + // This happens all the time when discovering the OpenCL capabilities of the + // system, so do nothing here. + break; + default: { + std::stringstream tmp; + tmp << "OPENCL_V_WARN< "; + tmp << prettyPrintclFFTStatus(res); + tmp << " > ("; + tmp << lineno; + tmp << "): "; + tmp << msg; + std::string errorm(tmp.str()); + std::cout << errorm << std::endl; + } + } + + return res; } -#define OPENCL_V_WARN(_status,_message) OpenCL_V_Warn (_status, _message, __LINE__); +#define OPENCL_V_WARN(_status, _message) \ + OpenCL_V_Warn(_status, _message, __LINE__); /* * \brief Release OpenCL resources (Context, Memory etc.) */ -int cleanupCL( cl_context* context, cl_command_queue* commandQueue, const cl_uint numBuffersIn, cl_mem inputBuffer[], const cl_uint numBuffersOut, cl_mem outputBuffer[]); +int cleanupCL(cl_context *context, cl_command_queue *commandQueue, + const cl_uint numBuffersIn, cl_mem inputBuffer[], + const cl_uint numBuffersOut, cl_mem outputBuffer[]); #endif diff --git a/src/callback-client/stdafx.cpp b/src/callback-client/stdafx.cpp index 2587b2c1..fec08b6f 100644 --- a/src/callback-client/stdafx.cpp +++ b/src/callback-client/stdafx.cpp @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - // stdafx.cpp : source file that includes just the standard includes // clFFT.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information diff --git a/src/client/client.cpp b/src/client/client.cpp index b96b5f16..fc2d4804 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -14,1036 +14,1033 @@ * limitations under the License. * ************************************************************************/ - // clfft.client.cpp : Defines the entry point for the console application. // #include "stdafx.h" -#include #include +#include -#include "client.h" -#include "../library/private.h" -#include "openCL.misc.h" -#include "../statTimer/statisticalTimer.extern.h" #include "../include/sharedLibrary.h" #include "../include/unicode.compatibility.h" +#include "../library/private.h" +#include "../statTimer/statisticalTimer.extern.h" +#include "client.h" +#include "openCL.misc.h" namespace po = boost::program_options; -// This is used with the program_options class so that the user can type an integer on the command line -// and we store into an enum varaible -template -std::basic_istream<_Elem, _Traits> & operator>> (std::basic_istream<_Elem, _Traits> & stream, clfftLayout & layout) -{ - cl_uint tmp; - stream >> tmp; - layout = clfftLayout(tmp); - return stream; +// This is used with the program_options class so that the user can type an +//integer on the command line and we store into an enum varaible +template +std::basic_istream<_Elem, _Traits> & +operator>>(std::basic_istream<_Elem, _Traits> &stream, clfftLayout &layout) { + cl_uint tmp; + stream >> tmp; + layout = clfftLayout(tmp); + return stream; } - -template < typename T > -int transform( size_t* lengths, const size_t *inStrides, const size_t *outStrides, size_t batch_size, - size_t offsetIn, size_t offsetOut, - clfftLayout in_layout, clfftLayout out_layout, - clfftResultLocation place, clfftPrecision precision, clfftDirection dir, - cl_device_type deviceType, cl_int deviceId, cl_int platformId, bool printInfo, - cl_uint command_queue_flags, cl_uint profile_count, - std::auto_ptr< clfftSetupData > setupData ) -{ - // Our command line does not specify what dimension FFT we wish to transform; we decode - // this from the lengths that the user specifies for X, Y, Z. A length of one means that - // The user does not want that dimension. - - const size_t max_dimensions = 3; - size_t strides[ 4 ]; - size_t o_strides[ 4 ]; - size_t fftVectorSize = 0; - size_t fftVectorSizePadded = 0; - size_t fftBatchSize = 0; - size_t outfftVectorSize = 0; - size_t outfftVectorSizePadded = 0; - size_t outfftBatchSize = 0; - size_t size_of_input_buffers_in_bytes = 0; - size_t size_of_output_buffers_in_bytes = 0; - - cl_uint number_of_output_buffers = 0; - clfftDim dim = CLFFT_1D; - cl_mem input_cl_mem_buffers [2] = { NULL, NULL }; - cl_mem output_cl_mem_buffers[2] = { NULL, NULL }; - std::vector< cl_device_id > device_id; - cl_context context; - cl_command_queue queue; - clfftPlanHandle plan_handle; - - for (unsigned u = 0; u < max_dimensions; ++u) { - if (0 != lengths[u]) - continue; - lengths[u] = 1; - } - - if( lengths[ 1 ] > 1 ) - { - dim = CLFFT_2D; - } - if( lengths[ 2 ] > 1 ) - { - dim = CLFFT_3D; - } - - strides[ 0 ] = inStrides[0]; - strides[ 1 ] = inStrides[1]; - strides[ 2 ] = inStrides[2]; - strides[ 3 ] = inStrides[3]; - - o_strides[ 0 ] = outStrides[0]; - o_strides[ 1 ] = outStrides[1]; - o_strides[ 2 ] = outStrides[2]; - o_strides[ 3 ] = outStrides[3]; - - fftVectorSize = lengths[0] * lengths[1] * lengths[2]; - fftVectorSizePadded = strides[3]; - fftBatchSize = fftVectorSizePadded * batch_size; - - size_t Nt = 1 + lengths[0]/2; - - if(place == CLFFT_INPLACE) - { - outfftVectorSize = fftVectorSize; - outfftVectorSizePadded = fftVectorSizePadded; - outfftBatchSize = fftBatchSize; - } - else - { - outfftVectorSize = lengths[0] * lengths[1] * lengths[2]; - outfftVectorSizePadded = o_strides[3]; - outfftBatchSize = outfftVectorSizePadded * batch_size; - } - - - // Real to complex case - if( (in_layout == CLFFT_REAL) || (out_layout == CLFFT_REAL) ) - { - fftVectorSizePadded = strides[3]; - fftBatchSize = fftVectorSizePadded * batch_size; - - outfftVectorSizePadded = o_strides[3]; - outfftBatchSize = outfftVectorSizePadded * batch_size; - - fftVectorSize = lengths[0] * lengths[1] * lengths[2]; - outfftVectorSize = fftVectorSize; - - } - - - switch( out_layout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - number_of_output_buffers = 1; - size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof( std::complex< T > ); - break; - case CLFFT_COMPLEX_PLANAR: - number_of_output_buffers = 2; - size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof(T); - break; - case CLFFT_HERMITIAN_INTERLEAVED: - number_of_output_buffers = 1; - size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof( std::complex< T > ); - break; - case CLFFT_HERMITIAN_PLANAR: - number_of_output_buffers = 2; - size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof(T); - break; - case CLFFT_REAL: - number_of_output_buffers = 1; - size_of_output_buffers_in_bytes = ( outfftBatchSize + offsetOut ) * sizeof(T); - break; - } - - // Fill the input buffers - switch( in_layout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( std::complex< T > ); - - device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); - createOpenCLCommandQueue( context, - command_queue_flags, queue, - device_id, - size_of_input_buffers_in_bytes, 1, input_cl_mem_buffers, - size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - - std::vector< std::complex< T > > input( fftBatchSize + offsetIn ); - - // set zero - for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) - { - input[ i ] = 0; - } - - // impulse test case - for(size_t b = 0; b < batch_size; b++) - { - size_t p3 = b * strides[3]; - for(size_t k = 0; k < lengths[2]; k++) - { - size_t p2 = p3 + k * strides[2]; - for(size_t j = 0; j < lengths[1]; j++) - { - size_t p1 = p2 + j * strides[1]; - for(size_t i = 0; i < lengths[0]; i++) - { - size_t p0 = p1 + i * strides[0]; - input[p0] = 1; - } - } - } - } - - - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &input[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - - } - break; - case CLFFT_COMPLEX_PLANAR: - { - // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( T ); - - device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); - createOpenCLCommandQueue( context, - command_queue_flags, queue, - device_id, - size_of_input_buffers_in_bytes, 2, input_cl_mem_buffers, - size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - - std::vector< T > real( fftBatchSize + offsetIn ); - std::vector< T > imag( fftBatchSize + offsetIn ); - - // set zero - for( cl_uint i = 0; i < (fftBatchSize + offsetIn ); ++i ) - { - real[ i ] = 0; - imag[ i ] = 0; - } - - // impulse test case - for(size_t b = 0; b < batch_size; b++) - { - size_t p3 = b * strides[3]; - for(size_t k = 0; k < lengths[2]; k++) - { - size_t p2 = p3 + k * strides[2]; - for(size_t j = 0; j < lengths[1]; j++) - { - size_t p1 = p2 + j * strides[1]; - for(size_t i = 0; i < lengths[0]; i++) - { - size_t p0 = p1 + i * strides[0]; - real[p0] = 1; - } - } - } - } - - - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 1 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &imag[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - { - // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( std::complex< T > ); - - device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); - createOpenCLCommandQueue( context, - command_queue_flags, queue, - device_id, - size_of_input_buffers_in_bytes, 1, input_cl_mem_buffers, - size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - - std::vector< std::complex< T > > input( fftBatchSize + offsetIn ); - - // set zero - for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) - { - input[ i ] = 0; - } - - // impulse test case - for(size_t b = 0; b < batch_size; b++) - { - size_t p3 = b * strides[3]; - input[p3] = static_cast(outfftVectorSize); - - } - - - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &input[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( T ); - - device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); - createOpenCLCommandQueue( context, - command_queue_flags, queue, - device_id, - size_of_input_buffers_in_bytes, 2, input_cl_mem_buffers, - size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - - std::vector< T > real( fftBatchSize + offsetIn ); - std::vector< T > imag( fftBatchSize + offsetIn ); - - // set zero - for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) - { - real[ i ] = 0; - imag[ i ] = 0; - } - - // impulse test case - for(size_t b = 0; b < batch_size; b++) - { - size_t p3 = b * strides[3]; - real[p3] = static_cast(outfftVectorSize); - } - - - - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 1 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &imag[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - } - break; - case CLFFT_REAL: - { - // This call creates our openCL context and sets up our devices; expected to throw on error - size_of_input_buffers_in_bytes = ( fftBatchSize + offsetIn ) * sizeof( T ); - - device_id = initializeCL( deviceType, deviceId, platformId, context, printInfo ); - createOpenCLCommandQueue( context, - command_queue_flags, queue, - device_id, - size_of_input_buffers_in_bytes, 1, input_cl_mem_buffers, - size_of_output_buffers_in_bytes, number_of_output_buffers, output_cl_mem_buffers); - - std::vector< T > real( fftBatchSize + offsetIn ); - - // set zero - for( cl_uint i = 0; i < ( fftBatchSize + offsetIn ); ++i ) - { - real[ i ] = 0; - } - - // impulse test case - for(size_t b = 0; b < batch_size; b++) - { - size_t p3 = b * strides[3]; - for(size_t k = 0; k < lengths[2]; k++) - { - size_t p2 = p3 + k * strides[2]; - for(size_t j = 0; j < lengths[1]; j++) - { - size_t p1 = p2 + j * strides[1]; - for(size_t i = 0; i < lengths[0]; i++) - { - size_t p0 = p1 + i * strides[0]; - real[p0] = 1; - } - } - } - } - - - OPENCL_V_THROW( clEnqueueWriteBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "clEnqueueWriteBuffer failed" ); - } - break; - default: - { - throw std::runtime_error( "Input layout format not yet supported" ); - } - break; - } - - // Discover and load the timer module if present - void* timerLibHandle = LoadSharedLibrary( "lib", "StatTimer", false ); - if( timerLibHandle == NULL ) - { - terr << _T( "Could not find the external timing library; timings disabled" ) << std::endl; - } - - // Timer module discovered and loaded successfully - // Initialize function pointers to call into the shared module - PFGETSTATTIMER get_timer = reinterpret_cast< PFGETSTATTIMER > ( LoadFunctionAddr( timerLibHandle, "getStatTimer" ) ); - - - OPENCL_V_THROW( clfftSetup( setupData.get( ) ), "clfftSetup failed" ); - OPENCL_V_THROW( clfftCreateDefaultPlan( &plan_handle, context, dim, lengths ), "clfftCreateDefaultPlan failed" ); - - // Default plan creates a plan that expects an inPlace transform with interleaved complex numbers - OPENCL_V_THROW( clfftSetResultLocation( plan_handle, place ), "clfftSetResultLocation failed" ); - OPENCL_V_THROW( clfftSetLayout( plan_handle, in_layout, out_layout ), "clfftSetLayout failed" ); - OPENCL_V_THROW( clfftSetPlanBatchSize( plan_handle, batch_size ), "clfftSetPlanBatchSize failed" ); - OPENCL_V_THROW( clfftSetPlanPrecision( plan_handle, precision ), "clfftSetPlanPrecision failed" ); - - OPENCL_V_THROW (clfftSetPlanInStride ( plan_handle, dim, strides ), "clfftSetPlanInStride failed" ); - OPENCL_V_THROW (clfftSetPlanOutStride ( plan_handle, dim, o_strides ), "clfftSetPlanOutStride failed" ); - OPENCL_V_THROW (clfftSetPlanDistance ( plan_handle, strides[ 3 ], o_strides[ 3 ]), "clfftSetPlanDistance failed" ); - - OPENCL_V_THROW (clfftSetPlanOffsetIn ( plan_handle, offsetIn ), "clfftSetPlanOffsetIn failed" ); - OPENCL_V_THROW (clfftSetPlanOffsetOut ( plan_handle, offsetOut ), "clfftSetPlanOffsetOut failed" ); - - // Set backward scale factor to 1.0 for non real FFTs to do correct output checks - if(dir == CLFFT_BACKWARD && in_layout != CLFFT_REAL && out_layout != CLFFT_REAL) - OPENCL_V_THROW (clfftSetPlanScale( plan_handle, CLFFT_BACKWARD, (cl_float)1.0f ), "clfftSetPlanScale failed" ); - - OPENCL_V_THROW( clfftBakePlan( plan_handle, 1, &queue, NULL, NULL ), "clfftBakePlan failed" ); - - //get the buffersize - size_t buffersize=0; - OPENCL_V_THROW( clfftGetTmpBufSize(plan_handle, &buffersize ), "clfftGetTmpBufSize failed" ); - - //allocate the intermediate buffer - cl_mem clMedBuffer=NULL; - - if (buffersize) - { - cl_int medstatus; - clMedBuffer = clCreateBuffer ( context, CL_MEM_READ_WRITE, buffersize, 0, &medstatus); - OPENCL_V_THROW( medstatus, "Creating intmediate Buffer failed" ); - } - - switch( in_layout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - case CLFFT_REAL: - break; - default: - // Don't recognize input layout - return CLFFT_INVALID_ARG_VALUE; - } - - switch( out_layout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - case CLFFT_REAL: - break; - default: - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - - if (( place == CLFFT_INPLACE ) - && ( in_layout != out_layout )) { - switch( in_layout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( (out_layout == CLFFT_COMPLEX_PLANAR) || (out_layout == CLFFT_HERMITIAN_PLANAR) ) - { - throw std::runtime_error( "Cannot use the same buffer for interleaved->planar in-place transforms" ); - } - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( (out_layout == CLFFT_COMPLEX_INTERLEAVED) || (out_layout == CLFFT_HERMITIAN_INTERLEAVED) ) - { - throw std::runtime_error( "Cannot use the same buffer for planar->interleaved in-place transforms" ); - } - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( out_layout != CLFFT_REAL ) - { - throw std::runtime_error( "Cannot use the same buffer for interleaved->planar in-place transforms" ); - } - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - throw std::runtime_error( "Cannot use the same buffer for planar->interleaved in-place transforms" ); - break; - } - case CLFFT_REAL: - { - if( (out_layout == CLFFT_COMPLEX_PLANAR) || (out_layout == CLFFT_HERMITIAN_PLANAR) ) - { - throw std::runtime_error( "Cannot use the same buffer for interleaved->planar in-place transforms" ); - } - break; - } - } - } - - - cl_mem * BuffersOut = ( place == CLFFT_INPLACE ) ? NULL : &output_cl_mem_buffers[ 0 ]; - - // Execute once for basic functional test - OPENCL_V_THROW( clfftEnqueueTransform( plan_handle, dir, 1, &queue, 0, NULL, NULL, - &input_cl_mem_buffers[ 0 ], BuffersOut, clMedBuffer ), - "clfftEnqueueTransform failed" ); - - OPENCL_V_THROW( clFinish( queue ), "clFinish failed" ); - - - // Create and initialize our timer class, if the external timer shared library loaded - baseStatTimer* timer = NULL; - size_t clFFTID = 0; - if( get_timer ) - { - timer = get_timer( CLFFT_GPU ); - timer->Reserve( 1, profile_count ); - timer->setNormalize( true ); - - clFFTID = timer->getUniqueID( "clFFT", 0 ); - } - - cl_event *outEvent = new cl_event[profile_count]; - for( cl_uint i = 0; i < profile_count; ++i ) outEvent[i] = 0; - - if(profile_count > 1) - { - Timer tr; - tr.Start(); - for( cl_uint i = 0; i < profile_count; ++i ) - { - if( timer ) timer->Start( clFFTID ); - - OPENCL_V_THROW( clfftEnqueueTransform( plan_handle, dir, 1, &queue, 0, NULL, &outEvent[i], - &input_cl_mem_buffers[ 0 ], BuffersOut, clMedBuffer ), - "clfftEnqueueTransform failed" ); - - if( timer ) timer->Stop( clFFTID ); - } - OPENCL_V_THROW( clWaitForEvents ( profile_count, outEvent ), "clWaitForEvents failed" ); - - double wtime = tr.Sample()/((double)profile_count); - - OPENCL_V_THROW( clFinish( queue ), "clFinish failed" ); - - size_t totalLen = 1; - for(int i=0; ipruneOutliers( 2.0 ); - timer->Print( ); - timer->Reset( ); - } - - /*****************/ - FreeSharedLibrary( timerLibHandle ); - - for( cl_uint i = 0; i < profile_count; ++i ) - { - if(outEvent[i]) - clReleaseEvent(outEvent[i]); - } - - delete[] outEvent; - - // Read and check output data - // This check is not valid if the FFT is executed multiple times inplace. - // - if (( place == CLFFT_OUTOFPLACE ) - || ( profile_count == 1)) - { - bool checkflag= false; - switch( out_layout ) - { - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_COMPLEX_INTERLEAVED: - { - std::vector< std::complex< T > > output( outfftBatchSize + offsetOut ); - - if( place == CLFFT_INPLACE ) - { - OPENCL_V_THROW( clEnqueueReadBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &output[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - } - else - { - OPENCL_V_THROW( clEnqueueReadBuffer( queue, BuffersOut[ 0 ], CL_TRUE, 0, size_of_output_buffers_in_bytes, &output[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - } - - //check output data - for( cl_uint i = 0; i < ( outfftBatchSize + offsetOut ); ++i ) - { - if (0 == (i % outfftVectorSizePadded)) - { - if (output[i].real() != outfftVectorSize) - { - checkflag = true; - break; - } - } - else - { - if (output[ i ].real() != 0) - { - checkflag = true; - break; - } - } - - if (output[ i ].imag() != 0) - { - checkflag = true; - break; - } - } - } - break; - case CLFFT_HERMITIAN_PLANAR: - case CLFFT_COMPLEX_PLANAR: - { - std::valarray< T > real( outfftBatchSize + offsetOut ); - std::valarray< T > imag( outfftBatchSize + offsetOut ); - - if( place == CLFFT_INPLACE ) - { - OPENCL_V_THROW( clEnqueueReadBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - OPENCL_V_THROW( clEnqueueReadBuffer( queue, input_cl_mem_buffers[ 1 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &imag[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - } - else - { - OPENCL_V_THROW( clEnqueueReadBuffer( queue, BuffersOut[ 0 ], CL_TRUE, 0, size_of_output_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - OPENCL_V_THROW( clEnqueueReadBuffer( queue, BuffersOut[ 1 ], CL_TRUE, 0, size_of_output_buffers_in_bytes, &imag[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - } - - // Check output data - for( cl_uint i = 0; i < ( outfftBatchSize + offsetOut ); ++i ) - { - if (0 == (i % outfftVectorSizePadded)) - { - if (real[i] != outfftVectorSize) - { - checkflag = true; - break; - } - } - else - { - if (real[i] != 0) - { - checkflag = true; - break; - } - } - - if (imag[i] != 0) - { - checkflag = true; - break; - } - } - } - break; - case CLFFT_REAL: - { - std::valarray< T > real( outfftBatchSize + offsetOut ); - - if( place == CLFFT_INPLACE ) - { - OPENCL_V_THROW( clEnqueueReadBuffer( queue, input_cl_mem_buffers[ 0 ], CL_TRUE, 0, size_of_input_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - } - else - { - OPENCL_V_THROW( clEnqueueReadBuffer( queue, BuffersOut[ 0 ], CL_TRUE, 0, size_of_output_buffers_in_bytes, &real[ 0 ], - 0, NULL, NULL ), - "Reading the result buffer failed" ); - } - - ////check output data - - for(size_t b = 0; b < batch_size; b++) - { - size_t p3 = b * o_strides[3]; - for(size_t k = 0; k < lengths[2]; k++) - { - size_t p2 = p3 + k * o_strides[2]; - for(size_t j = 0; j < lengths[1]; j++) - { - size_t p1 = p2 + j * o_strides[1]; - for(size_t i = 0; i < lengths[0]; i++) - { - size_t p0 = p1 + i * o_strides[0]; - - if (real[p0] != 1) - { - checkflag = true; - break; - } - - } - } - } - } - } - break; - default: - { - throw std::runtime_error( "Input layout format not yet supported" ); - } - break; - } - - if (checkflag) - { - std::cout << "\n\n\t\tInternal Client Test *****FAIL*****" << std::endl; - } - else - { - std::cout << "\n\n\t\tInternal Client Test *****PASS*****" << std::endl; - } - } - - OPENCL_V_THROW( clfftDestroyPlan( &plan_handle ), "clfftDestroyPlan failed" ); - OPENCL_V_THROW( clfftTeardown( ), "clfftTeardown failed" ); - - cleanupCL( &context, &queue, countOf( input_cl_mem_buffers ), input_cl_mem_buffers, countOf( output_cl_mem_buffers ), output_cl_mem_buffers, NULL ); - return 0; +template +int transform(size_t *lengths, const size_t *inStrides, + const size_t *outStrides, size_t batch_size, size_t offsetIn, + size_t offsetOut, clfftLayout in_layout, clfftLayout out_layout, + clfftResultLocation place, clfftPrecision precision, + clfftDirection dir, cl_device_type deviceType, cl_int deviceId, + cl_int platformId, bool printInfo, cl_uint command_queue_flags, + cl_uint profile_count, std::auto_ptr setupData) { + // Our command line does not specify what dimension FFT we wish to + //transform; we decode this from the lengths that the user specifies for X, Y, + //Z. A length of one means that The user does not want that dimension. + + const size_t max_dimensions = 3; + size_t strides[4]; + size_t o_strides[4]; + size_t fftVectorSize = 0; + size_t fftVectorSizePadded = 0; + size_t fftBatchSize = 0; + size_t outfftVectorSize = 0; + size_t outfftVectorSizePadded = 0; + size_t outfftBatchSize = 0; + size_t size_of_input_buffers_in_bytes = 0; + size_t size_of_output_buffers_in_bytes = 0; + + cl_uint number_of_output_buffers = 0; + clfftDim dim = CLFFT_1D; + cl_mem input_cl_mem_buffers[2] = {NULL, NULL}; + cl_mem output_cl_mem_buffers[2] = {NULL, NULL}; + std::vector device_id; + cl_context context; + cl_command_queue queue; + clfftPlanHandle plan_handle; + + for (unsigned u = 0; u < max_dimensions; ++u) { + if (0 != lengths[u]) + continue; + lengths[u] = 1; + } + + if (lengths[1] > 1) { + dim = CLFFT_2D; + } + if (lengths[2] > 1) { + dim = CLFFT_3D; + } + + strides[0] = inStrides[0]; + strides[1] = inStrides[1]; + strides[2] = inStrides[2]; + strides[3] = inStrides[3]; + + o_strides[0] = outStrides[0]; + o_strides[1] = outStrides[1]; + o_strides[2] = outStrides[2]; + o_strides[3] = outStrides[3]; + + fftVectorSize = lengths[0] * lengths[1] * lengths[2]; + fftVectorSizePadded = strides[3]; + fftBatchSize = fftVectorSizePadded * batch_size; + + size_t Nt = 1 + lengths[0] / 2; + + if (place == CLFFT_INPLACE) { + outfftVectorSize = fftVectorSize; + outfftVectorSizePadded = fftVectorSizePadded; + outfftBatchSize = fftBatchSize; + } else { + outfftVectorSize = lengths[0] * lengths[1] * lengths[2]; + outfftVectorSizePadded = o_strides[3]; + outfftBatchSize = outfftVectorSizePadded * batch_size; + } + + // Real to complex case + if ((in_layout == CLFFT_REAL) || (out_layout == CLFFT_REAL)) { + fftVectorSizePadded = strides[3]; + fftBatchSize = fftVectorSizePadded * batch_size; + + outfftVectorSizePadded = o_strides[3]; + outfftBatchSize = outfftVectorSizePadded * batch_size; + + fftVectorSize = lengths[0] * lengths[1] * lengths[2]; + outfftVectorSize = fftVectorSize; + } + + switch (out_layout) { + case CLFFT_COMPLEX_INTERLEAVED: + number_of_output_buffers = 1; + size_of_output_buffers_in_bytes = + (outfftBatchSize + offsetOut) * sizeof(std::complex); + break; + case CLFFT_COMPLEX_PLANAR: + number_of_output_buffers = 2; + size_of_output_buffers_in_bytes = (outfftBatchSize + offsetOut) * sizeof(T); + break; + case CLFFT_HERMITIAN_INTERLEAVED: + number_of_output_buffers = 1; + size_of_output_buffers_in_bytes = + (outfftBatchSize + offsetOut) * sizeof(std::complex); + break; + case CLFFT_HERMITIAN_PLANAR: + number_of_output_buffers = 2; + size_of_output_buffers_in_bytes = (outfftBatchSize + offsetOut) * sizeof(T); + break; + case CLFFT_REAL: + number_of_output_buffers = 1; + size_of_output_buffers_in_bytes = (outfftBatchSize + offsetOut) * sizeof(T); + break; + } + + // Fill the input buffers + switch (in_layout) { + case CLFFT_COMPLEX_INTERLEAVED: { + // This call creates our openCL context and sets up our devices; expected + //to throw on error + size_of_input_buffers_in_bytes = + (fftBatchSize + offsetIn) * sizeof(std::complex); + + device_id = + initializeCL(deviceType, deviceId, platformId, context, printInfo); + createOpenCLCommandQueue(context, command_queue_flags, queue, device_id, + size_of_input_buffers_in_bytes, 1, + input_cl_mem_buffers, + size_of_output_buffers_in_bytes, + number_of_output_buffers, output_cl_mem_buffers); + + std::vector> input(fftBatchSize + offsetIn); + + // set zero + for (cl_uint i = 0; i < (fftBatchSize + offsetIn); ++i) { + input[i] = 0; + } + + // impulse test case + for (size_t b = 0; b < batch_size; b++) { + size_t p3 = b * strides[3]; + for (size_t k = 0; k < lengths[2]; k++) { + size_t p2 = p3 + k * strides[2]; + for (size_t j = 0; j < lengths[1]; j++) { + size_t p1 = p2 + j * strides[1]; + for (size_t i = 0; i < lengths[0]; i++) { + size_t p0 = p1 + i * strides[0]; + input[p0] = 1; + } + } + } + } + + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[0], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &input[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + + } break; + case CLFFT_COMPLEX_PLANAR: { + // This call creates our openCL context and sets up our devices; expected + //to throw on error + size_of_input_buffers_in_bytes = (fftBatchSize + offsetIn) * sizeof(T); + + device_id = + initializeCL(deviceType, deviceId, platformId, context, printInfo); + createOpenCLCommandQueue(context, command_queue_flags, queue, device_id, + size_of_input_buffers_in_bytes, 2, + input_cl_mem_buffers, + size_of_output_buffers_in_bytes, + number_of_output_buffers, output_cl_mem_buffers); + + std::vector real(fftBatchSize + offsetIn); + std::vector imag(fftBatchSize + offsetIn); + + // set zero + for (cl_uint i = 0; i < (fftBatchSize + offsetIn); ++i) { + real[i] = 0; + imag[i] = 0; + } + + // impulse test case + for (size_t b = 0; b < batch_size; b++) { + size_t p3 = b * strides[3]; + for (size_t k = 0; k < lengths[2]; k++) { + size_t p2 = p3 + k * strides[2]; + for (size_t j = 0; j < lengths[1]; j++) { + size_t p1 = p2 + j * strides[1]; + for (size_t i = 0; i < lengths[0]; i++) { + size_t p0 = p1 + i * strides[0]; + real[p0] = 1; + } + } + } + } + + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[0], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[1], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &imag[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + } break; + case CLFFT_HERMITIAN_INTERLEAVED: { + // This call creates our openCL context and sets up our devices; expected + //to throw on error + size_of_input_buffers_in_bytes = + (fftBatchSize + offsetIn) * sizeof(std::complex); + + device_id = + initializeCL(deviceType, deviceId, platformId, context, printInfo); + createOpenCLCommandQueue(context, command_queue_flags, queue, device_id, + size_of_input_buffers_in_bytes, 1, + input_cl_mem_buffers, + size_of_output_buffers_in_bytes, + number_of_output_buffers, output_cl_mem_buffers); + + std::vector> input(fftBatchSize + offsetIn); + + // set zero + for (cl_uint i = 0; i < (fftBatchSize + offsetIn); ++i) { + input[i] = 0; + } + + // impulse test case + for (size_t b = 0; b < batch_size; b++) { + size_t p3 = b * strides[3]; + input[p3] = static_cast(outfftVectorSize); + } + + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[0], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &input[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + } break; + case CLFFT_HERMITIAN_PLANAR: { + // This call creates our openCL context and sets up our devices; expected + //to throw on error + size_of_input_buffers_in_bytes = (fftBatchSize + offsetIn) * sizeof(T); + + device_id = + initializeCL(deviceType, deviceId, platformId, context, printInfo); + createOpenCLCommandQueue(context, command_queue_flags, queue, device_id, + size_of_input_buffers_in_bytes, 2, + input_cl_mem_buffers, + size_of_output_buffers_in_bytes, + number_of_output_buffers, output_cl_mem_buffers); + + std::vector real(fftBatchSize + offsetIn); + std::vector imag(fftBatchSize + offsetIn); + + // set zero + for (cl_uint i = 0; i < (fftBatchSize + offsetIn); ++i) { + real[i] = 0; + imag[i] = 0; + } + + // impulse test case + for (size_t b = 0; b < batch_size; b++) { + size_t p3 = b * strides[3]; + real[p3] = static_cast(outfftVectorSize); + } + + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[0], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[1], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &imag[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + } break; + case CLFFT_REAL: { + // This call creates our openCL context and sets up our devices; expected + //to throw on error + size_of_input_buffers_in_bytes = (fftBatchSize + offsetIn) * sizeof(T); + + device_id = + initializeCL(deviceType, deviceId, platformId, context, printInfo); + createOpenCLCommandQueue(context, command_queue_flags, queue, device_id, + size_of_input_buffers_in_bytes, 1, + input_cl_mem_buffers, + size_of_output_buffers_in_bytes, + number_of_output_buffers, output_cl_mem_buffers); + + std::vector real(fftBatchSize + offsetIn); + + // set zero + for (cl_uint i = 0; i < (fftBatchSize + offsetIn); ++i) { + real[i] = 0; + } + + // impulse test case + for (size_t b = 0; b < batch_size; b++) { + size_t p3 = b * strides[3]; + for (size_t k = 0; k < lengths[2]; k++) { + size_t p2 = p3 + k * strides[2]; + for (size_t j = 0; j < lengths[1]; j++) { + size_t p1 = p2 + j * strides[1]; + for (size_t i = 0; i < lengths[0]; i++) { + size_t p0 = p1 + i * strides[0]; + real[p0] = 1; + } + } + } + } + + OPENCL_V_THROW(clEnqueueWriteBuffer(queue, input_cl_mem_buffers[0], CL_TRUE, + 0, size_of_input_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "clEnqueueWriteBuffer failed"); + } break; + default: { + throw std::runtime_error("Input layout format not yet supported"); + } break; + } + + // Discover and load the timer module if present + void *timerLibHandle = LoadSharedLibrary("lib", "StatTimer", false); + if (timerLibHandle == NULL) { + terr << _T( "Could not find the external timing library; timings disabled" ) + << std::endl; + } + + // Timer module discovered and loaded successfully + // Initialize function pointers to call into the shared module + PFGETSTATTIMER get_timer = reinterpret_cast( + LoadFunctionAddr(timerLibHandle, "getStatTimer")); + + OPENCL_V_THROW(clfftSetup(setupData.get()), "clfftSetup failed"); + OPENCL_V_THROW(clfftCreateDefaultPlan(&plan_handle, context, dim, lengths), + "clfftCreateDefaultPlan failed"); + + // Default plan creates a plan that expects an inPlace transform with + //interleaved complex numbers + OPENCL_V_THROW(clfftSetResultLocation(plan_handle, place), + "clfftSetResultLocation failed"); + OPENCL_V_THROW(clfftSetLayout(plan_handle, in_layout, out_layout), + "clfftSetLayout failed"); + OPENCL_V_THROW(clfftSetPlanBatchSize(plan_handle, batch_size), + "clfftSetPlanBatchSize failed"); + OPENCL_V_THROW(clfftSetPlanPrecision(plan_handle, precision), + "clfftSetPlanPrecision failed"); + + OPENCL_V_THROW(clfftSetPlanInStride(plan_handle, dim, strides), + "clfftSetPlanInStride failed"); + OPENCL_V_THROW(clfftSetPlanOutStride(plan_handle, dim, o_strides), + "clfftSetPlanOutStride failed"); + OPENCL_V_THROW(clfftSetPlanDistance(plan_handle, strides[3], o_strides[3]), + "clfftSetPlanDistance failed"); + + OPENCL_V_THROW(clfftSetPlanOffsetIn(plan_handle, offsetIn), + "clfftSetPlanOffsetIn failed"); + OPENCL_V_THROW(clfftSetPlanOffsetOut(plan_handle, offsetOut), + "clfftSetPlanOffsetOut failed"); + + // Set backward scale factor to 1.0 for non real FFTs to do correct output + // checks + if (dir == CLFFT_BACKWARD && in_layout != CLFFT_REAL && + out_layout != CLFFT_REAL) + OPENCL_V_THROW( + clfftSetPlanScale(plan_handle, CLFFT_BACKWARD, (cl_float)1.0f), + "clfftSetPlanScale failed"); + + OPENCL_V_THROW(clfftBakePlan(plan_handle, 1, &queue, NULL, NULL), + "clfftBakePlan failed"); + + // get the buffersize + size_t buffersize = 0; + OPENCL_V_THROW(clfftGetTmpBufSize(plan_handle, &buffersize), + "clfftGetTmpBufSize failed"); + + // allocate the intermediate buffer + cl_mem clMedBuffer = NULL; + + if (buffersize) { + cl_int medstatus; + clMedBuffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, buffersize, 0, &medstatus); + OPENCL_V_THROW(medstatus, "Creating intmediate Buffer failed"); + } + + switch (in_layout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + case CLFFT_REAL: + break; + default: + // Don't recognize input layout + return CLFFT_INVALID_ARG_VALUE; + } + + switch (out_layout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + case CLFFT_REAL: + break; + default: + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + + if ((place == CLFFT_INPLACE) && (in_layout != out_layout)) { + switch (in_layout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if ((out_layout == CLFFT_COMPLEX_PLANAR) || + (out_layout == CLFFT_HERMITIAN_PLANAR)) { + throw std::runtime_error("Cannot use the same buffer for " + "interleaved->planar in-place transforms"); + } + break; + } + case CLFFT_COMPLEX_PLANAR: { + if ((out_layout == CLFFT_COMPLEX_INTERLEAVED) || + (out_layout == CLFFT_HERMITIAN_INTERLEAVED)) { + throw std::runtime_error("Cannot use the same buffer for " + "planar->interleaved in-place transforms"); + } + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + if (out_layout != CLFFT_REAL) { + throw std::runtime_error("Cannot use the same buffer for " + "interleaved->planar in-place transforms"); + } + break; + } + case CLFFT_HERMITIAN_PLANAR: { + throw std::runtime_error("Cannot use the same buffer for " + "planar->interleaved in-place transforms"); + break; + } + case CLFFT_REAL: { + if ((out_layout == CLFFT_COMPLEX_PLANAR) || + (out_layout == CLFFT_HERMITIAN_PLANAR)) { + throw std::runtime_error("Cannot use the same buffer for " + "interleaved->planar in-place transforms"); + } + break; + } + } + } + + cl_mem *BuffersOut = + (place == CLFFT_INPLACE) ? NULL : &output_cl_mem_buffers[0]; + + // Execute once for basic functional test + OPENCL_V_THROW(clfftEnqueueTransform(plan_handle, dir, 1, &queue, 0, NULL, + NULL, &input_cl_mem_buffers[0], + BuffersOut, clMedBuffer), + "clfftEnqueueTransform failed"); + + OPENCL_V_THROW(clFinish(queue), "clFinish failed"); + + // Create and initialize our timer class, if the external timer shared + //library loaded + baseStatTimer *timer = NULL; + size_t clFFTID = 0; + if (get_timer) { + timer = get_timer(CLFFT_GPU); + timer->Reserve(1, profile_count); + timer->setNormalize(true); + + clFFTID = timer->getUniqueID("clFFT", 0); + } + + cl_event *outEvent = new cl_event[profile_count]; + for (cl_uint i = 0; i < profile_count; ++i) + outEvent[i] = 0; + + if (profile_count > 1) { + Timer tr; + tr.Start(); + for (cl_uint i = 0; i < profile_count; ++i) { + if (timer) + timer->Start(clFFTID); + + OPENCL_V_THROW(clfftEnqueueTransform( + plan_handle, dir, 1, &queue, 0, NULL, &outEvent[i], + &input_cl_mem_buffers[0], BuffersOut, clMedBuffer), + "clfftEnqueueTransform failed"); + + if (timer) + timer->Stop(clFFTID); + } + OPENCL_V_THROW(clWaitForEvents(profile_count, outEvent), + "clWaitForEvents failed"); + + double wtime = tr.Sample() / ((double)profile_count); + + OPENCL_V_THROW(clFinish(queue), "clFinish failed"); + + size_t totalLen = 1; + for (int i = 0; i < dim; i++) + totalLen *= lengths[i]; + + double constMultiplier = 1.0; + if ((in_layout == CLFFT_REAL) || (out_layout == CLFFT_REAL)) + constMultiplier = 2.5; + else + constMultiplier = 5.0; + + double opsconst = + constMultiplier * (double)totalLen * log((double)totalLen) / log(2.0); + + tout << "\nExecution wall time: " << 1000.0 * wtime << " ms" << std::endl; + tout << "Execution gflops: " + << ((double)batch_size * opsconst) / (1000000000.0 * wtime) + << std::endl; + } + + if (clMedBuffer) + clReleaseMemObject(clMedBuffer); + + if (timer && (command_queue_flags & CL_QUEUE_PROFILING_ENABLE)) { + // Remove all timings that are outside of 2 stddev (keep 65% of samples); + //we ignore outliers to get a more consistent result + timer->pruneOutliers(2.0); + timer->Print(); + timer->Reset(); + } + + /*****************/ + FreeSharedLibrary(timerLibHandle); + + for (cl_uint i = 0; i < profile_count; ++i) { + if (outEvent[i]) + clReleaseEvent(outEvent[i]); + } + + delete[] outEvent; + + // Read and check output data + // This check is not valid if the FFT is executed multiple times inplace. + // + if ((place == CLFFT_OUTOFPLACE) || (profile_count == 1)) { + bool checkflag = false; + switch (out_layout) { + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_COMPLEX_INTERLEAVED: { + std::vector> output(outfftBatchSize + offsetOut); + + if (place == CLFFT_INPLACE) { + OPENCL_V_THROW(clEnqueueReadBuffer(queue, input_cl_mem_buffers[0], + CL_TRUE, 0, + size_of_input_buffers_in_bytes, + &output[0], 0, NULL, NULL), + "Reading the result buffer failed"); + } else { + OPENCL_V_THROW(clEnqueueReadBuffer(queue, BuffersOut[0], CL_TRUE, 0, + size_of_output_buffers_in_bytes, + &output[0], 0, NULL, NULL), + "Reading the result buffer failed"); + } + + // check output data + for (cl_uint i = 0; i < (outfftBatchSize + offsetOut); ++i) { + if (0 == (i % outfftVectorSizePadded)) { + if (output[i].real() != outfftVectorSize) { + checkflag = true; + break; + } + } else { + if (output[i].real() != 0) { + checkflag = true; + break; + } + } + + if (output[i].imag() != 0) { + checkflag = true; + break; + } + } + } break; + case CLFFT_HERMITIAN_PLANAR: + case CLFFT_COMPLEX_PLANAR: { + std::valarray real(outfftBatchSize + offsetOut); + std::valarray imag(outfftBatchSize + offsetOut); + + if (place == CLFFT_INPLACE) { + OPENCL_V_THROW(clEnqueueReadBuffer(queue, input_cl_mem_buffers[0], + CL_TRUE, 0, + size_of_input_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "Reading the result buffer failed"); + OPENCL_V_THROW(clEnqueueReadBuffer(queue, input_cl_mem_buffers[1], + CL_TRUE, 0, + size_of_input_buffers_in_bytes, + &imag[0], 0, NULL, NULL), + "Reading the result buffer failed"); + } else { + OPENCL_V_THROW(clEnqueueReadBuffer(queue, BuffersOut[0], CL_TRUE, 0, + size_of_output_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "Reading the result buffer failed"); + OPENCL_V_THROW(clEnqueueReadBuffer(queue, BuffersOut[1], CL_TRUE, 0, + size_of_output_buffers_in_bytes, + &imag[0], 0, NULL, NULL), + "Reading the result buffer failed"); + } + + // Check output data + for (cl_uint i = 0; i < (outfftBatchSize + offsetOut); ++i) { + if (0 == (i % outfftVectorSizePadded)) { + if (real[i] != outfftVectorSize) { + checkflag = true; + break; + } + } else { + if (real[i] != 0) { + checkflag = true; + break; + } + } + + if (imag[i] != 0) { + checkflag = true; + break; + } + } + } break; + case CLFFT_REAL: { + std::valarray real(outfftBatchSize + offsetOut); + + if (place == CLFFT_INPLACE) { + OPENCL_V_THROW(clEnqueueReadBuffer(queue, input_cl_mem_buffers[0], + CL_TRUE, 0, + size_of_input_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "Reading the result buffer failed"); + } else { + OPENCL_V_THROW(clEnqueueReadBuffer(queue, BuffersOut[0], CL_TRUE, 0, + size_of_output_buffers_in_bytes, + &real[0], 0, NULL, NULL), + "Reading the result buffer failed"); + } + + ////check output data + + for (size_t b = 0; b < batch_size; b++) { + size_t p3 = b * o_strides[3]; + for (size_t k = 0; k < lengths[2]; k++) { + size_t p2 = p3 + k * o_strides[2]; + for (size_t j = 0; j < lengths[1]; j++) { + size_t p1 = p2 + j * o_strides[1]; + for (size_t i = 0; i < lengths[0]; i++) { + size_t p0 = p1 + i * o_strides[0]; + + if (real[p0] != 1) { + checkflag = true; + break; + } + } + } + } + } + } break; + default: { + throw std::runtime_error("Input layout format not yet supported"); + } break; + } + + if (checkflag) { + std::cout << "\n\n\t\tInternal Client Test *****FAIL*****" << std::endl; + } else { + std::cout << "\n\n\t\tInternal Client Test *****PASS*****" << std::endl; + } + } + + OPENCL_V_THROW(clfftDestroyPlan(&plan_handle), "clfftDestroyPlan failed"); + OPENCL_V_THROW(clfftTeardown(), "clfftTeardown failed"); + + cleanupCL(&context, &queue, countOf(input_cl_mem_buffers), + input_cl_mem_buffers, countOf(output_cl_mem_buffers), + output_cl_mem_buffers, NULL); + return 0; } -int _tmain( int argc, _TCHAR* argv[] ) -{ - // This helps with mixing output of both wide and narrow characters to the screen - std::ios::sync_with_stdio( false ); - - // Define MEMORYREPORT on windows platfroms to enable debug memory heap checking -#if defined( MEMORYREPORT ) && defined( _WIN32 ) - TCHAR logPath[ MAX_PATH ]; - ::GetCurrentDirectory( MAX_PATH, logPath ); - ::_tcscat_s( logPath, _T( "\\MemoryReport.txt") ); - - // We leak the handle to this file, on purpose, so that the ::_CrtSetReportFile() can output it's memory - // statistics on app shutdown - HANDLE hLogFile; - hLogFile = ::CreateFile( logPath, GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - - ::_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG ); - ::_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG ); - ::_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG ); - - ::_CrtSetReportFile( _CRT_ASSERT, hLogFile ); - ::_CrtSetReportFile( _CRT_ERROR, hLogFile ); - ::_CrtSetReportFile( _CRT_WARN, hLogFile ); - - int tmp = ::_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF; - ::_CrtSetDbgFlag( tmp ); - - // By looking at the memory leak report that is generated by this debug heap, there is a number with - // {} brackets that indicates the incremental allocation number of that block. If you wish to set - // a breakpoint on that allocation number, put it in the _CrtSetBreakAlloc() call below, and the heap - // will issue a bp on the request, allowing you to look at the call stack - // ::_CrtSetBreakAlloc( 1833 ); +int _tmain(int argc, _TCHAR *argv[]) { + // This helps with mixing output of both wide and narrow characters to the + //screen + std::ios::sync_with_stdio(false); + + // Define MEMORYREPORT on windows platfroms to enable debug memory heap + //checking +#if defined(MEMORYREPORT) && defined(_WIN32) + TCHAR logPath[MAX_PATH]; + ::GetCurrentDirectory(MAX_PATH, logPath); + ::_tcscat_s(logPath, _T( "\\MemoryReport.txt")); + + // We leak the handle to this file, on purpose, so that the + //::_CrtSetReportFile() can output it's memory statistics on app shutdown + HANDLE hLogFile; + hLogFile = + ::CreateFile(logPath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + ::_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | + _CRTDBG_MODE_DEBUG); + ::_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | + _CRTDBG_MODE_DEBUG); + ::_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + + ::_CrtSetReportFile(_CRT_ASSERT, hLogFile); + ::_CrtSetReportFile(_CRT_ERROR, hLogFile); + ::_CrtSetReportFile(_CRT_WARN, hLogFile); + + int tmp = ::_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF; + ::_CrtSetDbgFlag(tmp); + + // By looking at the memory leak report that is generated by this debug + //heap, there is a number with + // {} brackets that indicates the incremental allocation number of that + //block. If you wish to set a breakpoint on that allocation number, put it in + //the _CrtSetBreakAlloc() call below, and the heap will issue a bp on the + //request, allowing you to look at the call stack + // ::_CrtSetBreakAlloc( 1833 ); #endif /* MEMORYREPORT */ - // OpenCL state - cl_device_type deviceType = CL_DEVICE_TYPE_ALL; - cl_int deviceId = 0; - cl_int platformId = 0; - - // FFT state - - clfftResultLocation place = CLFFT_INPLACE; - clfftLayout inLayout = CLFFT_COMPLEX_INTERLEAVED; - clfftLayout outLayout = CLFFT_COMPLEX_INTERLEAVED; - clfftPrecision precision = CLFFT_SINGLE; - clfftDirection dir = CLFFT_FORWARD; - size_t lengths[ 3 ] = {1,1,1}; - size_t iStrides[ 4 ] = {0,0,0,0}; - size_t oStrides[ 4 ] = {0,0,0,0}; - cl_uint profile_count = 0; - - cl_uint command_queue_flags = 0; - size_t batchSize = 1; - size_t offsetIn = 0; - size_t offsetOut = 0; - - // Initialize flags for FFT library - std::auto_ptr< clfftSetupData > setupData( new clfftSetupData ); - OPENCL_V_THROW( clfftInitSetupData( setupData.get( ) ), - "clfftInitSetupData failed" ); - - try - { - // Declare the supported options. - po::options_description desc( "clFFT client command line options" ); - desc.add_options() - ( "help,h", "produces this help message" ) - ( "version,v", "Print queryable version information from the clFFT library" ) - ( "clinfo,i", "Print queryable information of all the OpenCL runtimes and devices" ) - ( "printChosen", "Print queryable information of the selected OpenCL runtime and device" ) - ( "gpu,g", "Force selection of OpenCL GPU devices only" ) - ( "cpu,c", "Force selection of OpenCL CPU devices only" ) - ( "all,a", "Force selection of all OpenCL devices (default)" ) - ( "platform", po::value< cl_int >( &platformId )->default_value( 0 ), "Select a specific OpenCL platform id as it is reported by clinfo" ) - ( "device", po::value< cl_int >( &deviceId )->default_value( 0 ), "Select a specific OpenCL device id as it is reported by clinfo" ) - ( "outPlace,o", "Out of place FFT transform (default: in place)" ) - ( "double", "Double precision transform (default: single)" ) - ( "inv", "Backward transform (default: forward)" ) - ( "dumpKernels,d", "FFT engine will dump generated OpenCL FFT kernels to disk (default: dump off)" ) - ( "lenX,x", po::value< size_t >( &lengths[ 0 ] )->default_value( 1024 ), "Specify the length of the 1st dimension of a test array" ) - ( "lenY,y", po::value< size_t >( &lengths[ 1 ] )->default_value( 1 ), "Specify the length of the 2nd dimension of a test array" ) - ( "lenZ,z", po::value< size_t >( &lengths[ 2 ] )->default_value( 1 ), "Specify the length of the 3rd dimension of a test array" ) - ( "isX", po::value< size_t >( &iStrides[ 0 ] )->default_value( 1 ), "Specify the input stride of the 1st dimension of a test array" ) - ( "isY", po::value< size_t >( &iStrides[ 1 ] )->default_value( 0 ), "Specify the input stride of the 2nd dimension of a test array" ) - ( "isZ", po::value< size_t >( &iStrides[ 2 ] )->default_value( 0 ), "Specify the input stride of the 3rd dimension of a test array" ) - ( "iD", po::value< size_t >( &iStrides[ 3 ] )->default_value( 0 ), "input distance between subsequent sets of data when batch size > 1" ) - ( "osX", po::value< size_t >( &oStrides[ 0 ] )->default_value( 1 ), "Specify the output stride of the 1st dimension of a test array" ) - ( "osY", po::value< size_t >( &oStrides[ 1 ] )->default_value( 0 ), "Specify the output stride of the 2nd dimension of a test array" ) - ( "osZ", po::value< size_t >( &oStrides[ 2 ] )->default_value( 0 ), "Specify the output stride of the 3rd dimension of a test array" ) - ( "oD", po::value< size_t >( &oStrides[ 3 ] )->default_value( 0 ), "output distance between subsequent sets of data when batch size > 1" ) - ( "batchSize,b", po::value< size_t >( &batchSize )->default_value( 1 ), "If this value is greater than one, arrays will be used " ) - ( "profile,p", po::value< cl_uint >( &profile_count )->default_value( 1 ), "Time and report the kernel speed of the FFT (default: profiling off)" ) - ( "inLayout", po::value< clfftLayout >( &inLayout )->default_value( CLFFT_COMPLEX_INTERLEAVED ), "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian interleaved\n4) hermitian planar\n5) real" ) - ( "outLayout", po::value< clfftLayout >( &outLayout )->default_value( CLFFT_COMPLEX_INTERLEAVED ), "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian interleaved\n4) hermitian planar\n5) real" ) - ( "offsetIn", po::value< size_t >( &offsetIn )->default_value( 0 ), "Input offset to be used in number of elements" ) - ( "offsetOut", po::value< size_t >( &offsetOut)->default_value( 0 ), "Output offset to be used in number of elements" ) - ; - - po::variables_map vm; - po::store( po::parse_command_line( argc, argv, desc ), vm ); - po::notify( vm ); - - if( vm.count( "version" ) ) - { - const int indent = countOf( "clFFT client API version: " ); - tout << std::left << std::setw( indent ) << _T( "clFFT client API version: " ) - << clfftVersionMajor << _T( "." ) - << clfftVersionMinor << _T( "." ) - << clfftVersionPatch << std::endl; - - cl_uint libMajor, libMinor, libPatch; - clfftGetVersion( &libMajor, &libMinor, &libPatch ); - - tout << std::left << std::setw( indent ) << _T( "clFFT runtime version: " ) - << libMajor << _T( "." ) - << libMinor << _T( "." ) - << libPatch << std::endl << std::endl; - } - - if( vm.count( "help" ) ) - { - // This needs to be 'cout' as program-options does not support wcout yet - std::cout << desc << std::endl; - return 0; - } - - size_t mutex = ((vm.count( "gpu" ) > 0) ? 1 : 0) - | ((vm.count( "cpu" ) > 0) ? 2 : 0) - | ((vm.count( "all" ) > 0) ? 4 : 0); - if ((mutex & (mutex-1)) != 0) { - terr << _T("You have selected mutually-exclusive OpenCL device options:") << std::endl; - if (vm.count ( "gpu" ) > 0) terr << _T(" gpu,g Force selection of OpenCL GPU devices only" ) << std::endl; - if (vm.count ( "cpu" ) > 0) terr << _T(" cpu,c Force selection of OpenCL CPU devices only" ) << std::endl; - if (vm.count ( "all" ) > 0) terr << _T(" all,a Force selection of all OpenCL devices (default)" ) << std::endl; - return 1; - } - - if( vm.count( "gpu" ) ) - { - deviceType = CL_DEVICE_TYPE_GPU; - } - - if( vm.count( "cpu" ) ) - { - deviceType = CL_DEVICE_TYPE_CPU; - } - - if( vm.count( "all" ) ) - { - deviceType = CL_DEVICE_TYPE_ALL; - } - - if( vm.count( "clinfo" ) ) - { - std::vector< cl_platform_id > platformInfos; - std::vector< std::vector< cl_device_id > > deviceInfos; - discoverCLPlatforms( deviceType, platformInfos, deviceInfos ); - prettyPrintCLPlatforms(platformInfos, deviceInfos); - return 0; - } - - bool printInfo = false; - if( vm.count( "printChosen" ) ) - { - printInfo = true; - } - - if( vm.count( "outPlace" ) ) - { - place = CLFFT_OUTOFPLACE; - } - - if( vm.count( "double" ) ) - { - precision = CLFFT_DOUBLE; - } - - if( vm.count( "inv" ) ) - { - dir = CLFFT_BACKWARD; - } - - if( profile_count > 1 ) - { - command_queue_flags |= CL_QUEUE_PROFILING_ENABLE; - } - - if( vm.count( "dumpKernels" ) ) - { - setupData->debugFlags |= CLFFT_DUMP_PROGRAMS; - } - - int inL = (int)inLayout; - int otL = (int)outLayout; - - // input output layout support matrix - int ioLayoutSupport[5][5] = { - { 1, 1, 0, 0, 1 }, - { 1, 1, 0, 0, 1 }, - { 0, 0, 0, 0, 1 }, - { 0, 0, 0, 0, 1 }, - { 1, 1, 1, 1, 0 }, - }; - - if((inL < 1) || (inL > 5)) throw std::runtime_error( "Invalid Input layout format" ); - if((otL < 1) || (otL > 5)) throw std::runtime_error( "Invalid Output layout format" ); - - if(ioLayoutSupport[inL-1][otL-1] == 0) throw std::runtime_error( "Invalid combination of Input/Output layout formats" ); - - if( ((inL == 1) || (inL == 2)) && ((otL == 1) || (otL == 2)) ) // Complex-Complex cases - { - iStrides[1] = iStrides[1] ? iStrides[1] : lengths[0] * iStrides[0]; - iStrides[2] = iStrides[2] ? iStrides[2] : lengths[1] * iStrides[1]; - iStrides[3] = iStrides[3] ? iStrides[3] : lengths[2] * iStrides[2]; - - - - if(place == CLFFT_INPLACE) - { - oStrides[0] = iStrides[0]; - oStrides[1] = iStrides[1]; - oStrides[2] = iStrides[2]; - oStrides[3] = iStrides[3]; - } - else - { - oStrides[1] = oStrides[1] ? oStrides[1] : lengths[0] * oStrides[0]; - oStrides[2] = oStrides[2] ? oStrides[2] : lengths[1] * oStrides[1]; - oStrides[3] = oStrides[3] ? oStrides[3] : lengths[2] * oStrides[2]; - } - } - else // Real-Complex and Complex-Real cases - { - size_t *rst, *cst; - size_t N = lengths[0]; - size_t Nt = 1 + lengths[0]/2; - bool iflag = false; - bool rcFull = (inL == 1) || (inL == 2) || (otL == 1) || (otL == 2); - - if(inLayout == CLFFT_REAL) { iflag = true; rst = iStrides; } - else { rst = oStrides; } // either in or out should be REAL - - // Set either in or out strides whichever is real - if(place == CLFFT_INPLACE) - { - if(rcFull) { rst[1] = rst[1] ? rst[1] : N * 2 * rst[0]; } - else { rst[1] = rst[1] ? rst[1] : Nt * 2 * rst[0]; } - - rst[2] = rst[2] ? rst[2] : lengths[1] * rst[1]; - rst[3] = rst[3] ? rst[3] : lengths[2] * rst[2]; - } - else - { - rst[1] = rst[1] ? rst[1] : lengths[0] * rst[0]; - rst[2] = rst[2] ? rst[2] : lengths[1] * rst[1]; - rst[3] = rst[3] ? rst[3] : lengths[2] * rst[2]; - } - - // Set the remaining of in or out strides that is not real - if(iflag) { cst = oStrides; } - else { cst = iStrides; } - - if(rcFull) { cst[1] = cst[1] ? cst[1] : N * cst[0]; } - else { cst[1] = cst[1] ? cst[1] : Nt * cst[0]; } - - cst[2] = cst[2] ? cst[2] : lengths[1] * cst[1]; - cst[3] = cst[3] ? cst[3] : lengths[2] * cst[2]; - } - - if( precision == CLFFT_SINGLE ) - transform( lengths, iStrides, oStrides, batchSize, offsetIn, offsetOut, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData ); - else - transform( lengths, iStrides, oStrides, batchSize, offsetIn, offsetOut, inLayout, outLayout, place, precision, dir, deviceType, deviceId, platformId, printInfo, command_queue_flags, profile_count, setupData ); - } - catch( std::exception& e ) - { - terr << _T( "clFFT error condition reported:" ) << std::endl << e.what() << std::endl; - return 1; - } - return 0; + // OpenCL state + cl_device_type deviceType = CL_DEVICE_TYPE_ALL; + cl_int deviceId = 0; + cl_int platformId = 0; + + // FFT state + + clfftResultLocation place = CLFFT_INPLACE; + clfftLayout inLayout = CLFFT_COMPLEX_INTERLEAVED; + clfftLayout outLayout = CLFFT_COMPLEX_INTERLEAVED; + clfftPrecision precision = CLFFT_SINGLE; + clfftDirection dir = CLFFT_FORWARD; + size_t lengths[3] = {1, 1, 1}; + size_t iStrides[4] = {0, 0, 0, 0}; + size_t oStrides[4] = {0, 0, 0, 0}; + cl_uint profile_count = 0; + + cl_uint command_queue_flags = 0; + size_t batchSize = 1; + size_t offsetIn = 0; + size_t offsetOut = 0; + + // Initialize flags for FFT library + std::auto_ptr setupData(new clfftSetupData); + OPENCL_V_THROW(clfftInitSetupData(setupData.get()), + "clfftInitSetupData failed"); + + try { + // Declare the supported options. + po::options_description desc("clFFT client command line options"); + desc.add_options()("help,h", "produces this help message")( + "version,v", + "Print queryable version information from the clFFT library")( + "clinfo,i", + "Print queryable information of all the OpenCL runtimes and devices")( + "printChosen", + "Print queryable information of the selected OpenCL runtime and " + "device")("gpu,g", "Force selection of OpenCL GPU devices only")( + "cpu,c", "Force selection of OpenCL CPU devices only")( + "all,a", "Force selection of all OpenCL devices (default)")( + "platform", po::value(&platformId)->default_value(0), + "Select a specific OpenCL platform id as it is reported by clinfo")( + "device", po::value(&deviceId)->default_value(0), + "Select a specific OpenCL device id as it is reported by clinfo")( + "outPlace,o", "Out of place FFT transform (default: in place)")( + "double", "Double precision transform (default: single)")( + "inv", "Backward transform (default: forward)")( + "dumpKernels,d", "FFT engine will dump generated OpenCL FFT kernels to " + "disk (default: dump off)")( + "lenX,x", po::value(&lengths[0])->default_value(1024), + "Specify the length of the 1st dimension of a test array")( + "lenY,y", po::value(&lengths[1])->default_value(1), + "Specify the length of the 2nd dimension of a test array")( + "lenZ,z", po::value(&lengths[2])->default_value(1), + "Specify the length of the 3rd dimension of a test array")( + "isX", po::value(&iStrides[0])->default_value(1), + "Specify the input stride of the 1st dimension of a test array")( + "isY", po::value(&iStrides[1])->default_value(0), + "Specify the input stride of the 2nd dimension of a test array")( + "isZ", po::value(&iStrides[2])->default_value(0), + "Specify the input stride of the 3rd dimension of a test array")( + "iD", po::value(&iStrides[3])->default_value(0), + "input distance between subsequent sets of data when batch size > 1")( + "osX", po::value(&oStrides[0])->default_value(1), + "Specify the output stride of the 1st dimension of a test array")( + "osY", po::value(&oStrides[1])->default_value(0), + "Specify the output stride of the 2nd dimension of a test array")( + "osZ", po::value(&oStrides[2])->default_value(0), + "Specify the output stride of the 3rd dimension of a test array")( + "oD", po::value(&oStrides[3])->default_value(0), + "output distance between subsequent sets of data when batch size > 1")( + "batchSize,b", po::value(&batchSize)->default_value(1), + "If this value is greater than one, arrays will be used ")( + "profile,p", po::value(&profile_count)->default_value(1), + "Time and report the kernel speed of the FFT (default: profiling off)")( + "inLayout", + po::value(&inLayout)->default_value( + CLFFT_COMPLEX_INTERLEAVED), + "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian " + "interleaved\n4) hermitian planar\n5) real")( + "outLayout", + po::value(&outLayout) + ->default_value(CLFFT_COMPLEX_INTERLEAVED), + "Layout of input data:\n1) interleaved\n2) planar\n3) hermitian " + "interleaved\n4) hermitian planar\n5) real")( + "offsetIn", po::value(&offsetIn)->default_value(0), + "Input offset to be used in number of elements")( + "offsetOut", po::value(&offsetOut)->default_value(0), + "Output offset to be used in number of elements"); + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("version")) { + const int indent = countOf("clFFT client API version: "); + tout << std::left << std::setw(indent) + << _T( "clFFT client API version: " ) << clfftVersionMajor + << _T( "." ) << clfftVersionMinor << _T( "." ) << clfftVersionPatch + << std::endl; + + cl_uint libMajor, libMinor, libPatch; + clfftGetVersion(&libMajor, &libMinor, &libPatch); + + tout << std::left << std::setw(indent) << _T( "clFFT runtime version: " ) + << libMajor << _T( "." ) << libMinor << _T( "." ) << libPatch + << std::endl + << std::endl; + } + + if (vm.count("help")) { + // This needs to be 'cout' as program-options does not support + //wcout yet + std::cout << desc << std::endl; + return 0; + } + + size_t mutex = ((vm.count("gpu") > 0) ? 1 : 0) | + ((vm.count("cpu") > 0) ? 2 : 0) | + ((vm.count("all") > 0) ? 4 : 0); + if ((mutex & (mutex - 1)) != 0) { + terr << _T("You have selected mutually-exclusive OpenCL device options:") + << std::endl; + if (vm.count("gpu") > 0) + terr << _T(" gpu,g Force selection of OpenCL GPU devices only" ) + << std::endl; + if (vm.count("cpu") > 0) + terr << _T(" cpu,c Force selection of OpenCL CPU devices only" ) + << std::endl; + if (vm.count("all") > 0) + terr + << _T(" all,a Force selection of all OpenCL devices (default)" ) + << std::endl; + return 1; + } + + if (vm.count("gpu")) { + deviceType = CL_DEVICE_TYPE_GPU; + } + + if (vm.count("cpu")) { + deviceType = CL_DEVICE_TYPE_CPU; + } + + if (vm.count("all")) { + deviceType = CL_DEVICE_TYPE_ALL; + } + + if (vm.count("clinfo")) { + std::vector platformInfos; + std::vector> deviceInfos; + discoverCLPlatforms(deviceType, platformInfos, deviceInfos); + prettyPrintCLPlatforms(platformInfos, deviceInfos); + return 0; + } + + bool printInfo = false; + if (vm.count("printChosen")) { + printInfo = true; + } + + if (vm.count("outPlace")) { + place = CLFFT_OUTOFPLACE; + } + + if (vm.count("double")) { + precision = CLFFT_DOUBLE; + } + + if (vm.count("inv")) { + dir = CLFFT_BACKWARD; + } + + if (profile_count > 1) { + command_queue_flags |= CL_QUEUE_PROFILING_ENABLE; + } + + if (vm.count("dumpKernels")) { + setupData->debugFlags |= CLFFT_DUMP_PROGRAMS; + } + + int inL = (int)inLayout; + int otL = (int)outLayout; + + // input output layout support matrix + int ioLayoutSupport[5][5] = { + {1, 1, 0, 0, 1}, {1, 1, 0, 0, 1}, {0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1}, {1, 1, 1, 1, 0}, + }; + + if ((inL < 1) || (inL > 5)) + throw std::runtime_error("Invalid Input layout format"); + if ((otL < 1) || (otL > 5)) + throw std::runtime_error("Invalid Output layout format"); + + if (ioLayoutSupport[inL - 1][otL - 1] == 0) + throw std::runtime_error( + "Invalid combination of Input/Output layout formats"); + + if (((inL == 1) || (inL == 2)) && + ((otL == 1) || (otL == 2))) // Complex-Complex cases + { + iStrides[1] = iStrides[1] ? iStrides[1] : lengths[0] * iStrides[0]; + iStrides[2] = iStrides[2] ? iStrides[2] : lengths[1] * iStrides[1]; + iStrides[3] = iStrides[3] ? iStrides[3] : lengths[2] * iStrides[2]; + + if (place == CLFFT_INPLACE) { + oStrides[0] = iStrides[0]; + oStrides[1] = iStrides[1]; + oStrides[2] = iStrides[2]; + oStrides[3] = iStrides[3]; + } else { + oStrides[1] = oStrides[1] ? oStrides[1] : lengths[0] * oStrides[0]; + oStrides[2] = oStrides[2] ? oStrides[2] : lengths[1] * oStrides[1]; + oStrides[3] = oStrides[3] ? oStrides[3] : lengths[2] * oStrides[2]; + } + } else // Real-Complex and Complex-Real cases + { + size_t *rst, *cst; + size_t N = lengths[0]; + size_t Nt = 1 + lengths[0] / 2; + bool iflag = false; + bool rcFull = (inL == 1) || (inL == 2) || (otL == 1) || (otL == 2); + + if (inLayout == CLFFT_REAL) { + iflag = true; + rst = iStrides; + } else { + rst = oStrides; + } // either in or out should be REAL + + // Set either in or out strides whichever is real + if (place == CLFFT_INPLACE) { + if (rcFull) { + rst[1] = rst[1] ? rst[1] : N * 2 * rst[0]; + } else { + rst[1] = rst[1] ? rst[1] : Nt * 2 * rst[0]; + } + + rst[2] = rst[2] ? rst[2] : lengths[1] * rst[1]; + rst[3] = rst[3] ? rst[3] : lengths[2] * rst[2]; + } else { + rst[1] = rst[1] ? rst[1] : lengths[0] * rst[0]; + rst[2] = rst[2] ? rst[2] : lengths[1] * rst[1]; + rst[3] = rst[3] ? rst[3] : lengths[2] * rst[2]; + } + + // Set the remaining of in or out strides that is not real + if (iflag) { + cst = oStrides; + } else { + cst = iStrides; + } + + if (rcFull) { + cst[1] = cst[1] ? cst[1] : N * cst[0]; + } else { + cst[1] = cst[1] ? cst[1] : Nt * cst[0]; + } + + cst[2] = cst[2] ? cst[2] : lengths[1] * cst[1]; + cst[3] = cst[3] ? cst[3] : lengths[2] * cst[2]; + } + + if (precision == CLFFT_SINGLE) + transform(lengths, iStrides, oStrides, batchSize, offsetIn, + offsetOut, inLayout, outLayout, place, precision, dir, + deviceType, deviceId, platformId, printInfo, + command_queue_flags, profile_count, setupData); + else + transform(lengths, iStrides, oStrides, batchSize, offsetIn, + offsetOut, inLayout, outLayout, place, precision, dir, + deviceType, deviceId, platformId, printInfo, + command_queue_flags, profile_count, setupData); + } catch (std::exception &e) { + terr << _T( "clFFT error condition reported:" ) << std::endl + << e.what() << std::endl; + return 1; + } + return 0; } diff --git a/src/client/client.h b/src/client/client.h index b4f30505..c32c16fd 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -14,9 +14,8 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLIENT_H ) +#if !defined(CLIENT_H) #define CLIENT_H // Boost headers that we want to use @@ -25,20 +24,19 @@ #ifdef WIN32 -struct Timer -{ - LARGE_INTEGER start, stop, freq; +struct Timer { + LARGE_INTEGER start, stop, freq; public: - Timer() { QueryPerformanceFrequency( &freq ); } - - void Start() { QueryPerformanceCounter(&start); } - double Sample() - { - QueryPerformanceCounter ( &stop ); - double time = (double)(stop.QuadPart-start.QuadPart) / (double)(freq.QuadPart); - return time; - } + Timer() { QueryPerformanceFrequency(&freq); } + + void Start() { QueryPerformanceCounter(&start); } + double Sample() { + QueryPerformanceCounter(&stop); + double time = + (double)(stop.QuadPart - start.QuadPart) / (double)(freq.QuadPart); + return time; + } }; #elif defined(__APPLE__) || defined(__MACOSX) @@ -46,43 +44,41 @@ struct Timer #include #include -struct Timer -{ - clock_serv_t clock; - mach_timespec_t start, end; +struct Timer { + clock_serv_t clock; + mach_timespec_t start, end; public: - Timer() { host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clock); } - ~Timer() { mach_port_deallocate(mach_task_self(), clock); } - - void Start() { clock_get_time(clock, &start); } - double Sample() - { - clock_get_time(clock, &end); - double time = 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; - return time * 1E-9; - } + Timer() { host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &clock); } + ~Timer() { mach_port_deallocate(mach_task_self(), clock); } + + void Start() { clock_get_time(clock, &start); } + double Sample() { + clock_get_time(clock, &end); + double time = + 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; + return time * 1E-9; + } }; #else -#include #include +#include -struct Timer -{ - struct timespec start, end; +struct Timer { + struct timespec start, end; public: - Timer() { } - - void Start() { clock_gettime(CLOCK_MONOTONIC, &start); } - double Sample() - { - clock_gettime(CLOCK_MONOTONIC, &end); - double time = 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; - return time * 1E-9; - } + Timer() {} + + void Start() { clock_gettime(CLOCK_MONOTONIC, &start); } + double Sample() { + clock_gettime(CLOCK_MONOTONIC, &end); + double time = + 1000000000L * (end.tv_sec - start.tv_sec) + end.tv_nsec - start.tv_nsec; + return time * 1E-9; + } }; #endif diff --git a/src/client/openCL.misc.cpp b/src/client/openCL.misc.cpp index 21d4cbc2..b1b1c4fa 100644 --- a/src/client/openCL.misc.cpp +++ b/src/client/openCL.misc.cpp @@ -14,526 +14,599 @@ * limitations under the License. * ************************************************************************/ - // clfft.opencl.cpp : Provides functions to set up openCL // +#include "openCL.misc.h" +#include "clFFT.h" #include "stdafx.h" -#include +#include #include #include -#include +#include #include -#include "clFFT.h" -#include "openCL.misc.h" - - - -void prettyPrintPlatformInfo( const cl_platform_id& pId ) -{ - size_t platformProfileSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_PROFILE, 0, NULL, &platformProfileSize ), - "Getting CL_PLATFORM_PROFILE Platform Info string size ( ::clGetPlatformInfo() )" ); - - std::vector< char > szPlatformProfile( platformProfileSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_PROFILE, platformProfileSize, &szPlatformProfile[ 0 ], NULL), - "Getting CL_PLATFORM_PROFILE Platform Info string ( ::clGetPlatformInfo() )" ); - - size_t platformVersionSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VERSION, 0, NULL, &platformVersionSize ), - "Getting CL_PLATFORM_VERSION Platform Info string size ( ::clGetPlatformInfo() )" ); - - std::vector< char > szPlatformVersion( platformVersionSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VERSION, platformVersionSize, &szPlatformVersion[ 0 ], NULL), - "Getting CL_PLATFORM_VERSION Platform Info string ( ::clGetPlatformInfo() )" ); - - size_t platformNameSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_NAME, 0, NULL, &platformNameSize ), - "Getting CL_PLATFORM_NAME Platform Info string size ( ::clGetPlatformInfo() )" ); - - std::vector< char > szPlatformName( platformNameSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_NAME, platformNameSize, &szPlatformName[ 0 ], NULL), - "Getting CL_PLATFORM_NAME Platform Info string ( ::clGetPlatformInfo() )" ); - size_t vendorStringSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VENDOR, 0, NULL, &vendorStringSize ), - "Getting CL_PLATFORM_VENDOR Platform Info string size ( ::clGetPlatformInfo() )" ); +void prettyPrintPlatformInfo(const cl_platform_id &pId) { + size_t platformProfileSize = 0; + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_PROFILE, 0, NULL, + &platformProfileSize), + "Getting CL_PLATFORM_PROFILE Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformProfile(platformProfileSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_PROFILE, + platformProfileSize, &szPlatformProfile[0], + NULL), + "Getting CL_PLATFORM_PROFILE Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t platformVersionSize = 0; + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_VERSION, 0, NULL, + &platformVersionSize), + "Getting CL_PLATFORM_VERSION Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformVersion(platformVersionSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_VERSION, + platformVersionSize, &szPlatformVersion[0], + NULL), + "Getting CL_PLATFORM_VERSION Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t platformNameSize = 0; + OPENCL_V_THROW( + ::clGetPlatformInfo(pId, CL_PLATFORM_NAME, 0, NULL, &platformNameSize), + "Getting CL_PLATFORM_NAME Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformName(platformNameSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_NAME, platformNameSize, + &szPlatformName[0], NULL), + "Getting CL_PLATFORM_NAME Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t vendorStringSize = 0; + OPENCL_V_THROW( + ::clGetPlatformInfo(pId, CL_PLATFORM_VENDOR, 0, NULL, &vendorStringSize), + "Getting CL_PLATFORM_VENDOR Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformVendor(vendorStringSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_VENDOR, vendorStringSize, + &szPlatformVendor[0], NULL), + "Getting CL_PLATFORM_VENDOR Platform Info string ( " + "::clGetPlatformInfo() )"); + + size_t platformExtensionsSize = 0; + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_EXTENSIONS, 0, NULL, + &platformExtensionsSize), + "Getting CL_PLATFORM_EXTENSIONS Platform Info string size ( " + "::clGetPlatformInfo() )"); + + std::vector szPlatformExtensions(platformExtensionsSize); + OPENCL_V_THROW(::clGetPlatformInfo(pId, CL_PLATFORM_EXTENSIONS, + platformExtensionsSize, + &szPlatformExtensions[0], NULL), + "Getting CL_PLATFORM_EXTENSIONS Platform Info string ( " + "::clGetPlatformInfo() )"); + + const int indent = countOf(" CL_PLATFORM_EXTENSIONS: "); + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_PROFILE: " << &szPlatformProfile[0] + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_VERSION: " << &szPlatformVersion[0] + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_NAME: " << &szPlatformName[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_VENDOR: " << &szPlatformVendor[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_PLATFORM_EXTENSIONS: " << &szPlatformExtensions[0] + << std::endl; + std::cout << std::right << std::endl; +} - std::vector< char > szPlatformVendor( vendorStringSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VENDOR, vendorStringSize, &szPlatformVendor[ 0 ], NULL), - "Getting CL_PLATFORM_VENDOR Platform Info string ( ::clGetPlatformInfo() )" ); +void prettyPrintDeviceInfo(const cl_device_id &dId) { + size_t deviceNameSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_NAME, 0, NULL, &deviceNameSize), + "Getting CL_DEVICE_NAME Platform Info string size ( ::clGetDeviceInfo() " + ")"); + + std::vector szDeviceName(deviceNameSize); + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_NAME, deviceNameSize, &szDeviceName[0], + NULL), + "Getting CL_DEVICE_NAME Platform Info string ( ::clGetDeviceInfo() )"); + + size_t deviceVersionSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_VERSION, 0, NULL, &deviceVersionSize), + "Getting CL_DEVICE_VERSION Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDeviceVersion(deviceVersionSize); + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_VERSION, deviceVersionSize, + &szDeviceVersion[0], NULL), + "Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )"); + + size_t driverVersionSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DRIVER_VERSION, 0, NULL, &driverVersionSize), + "Getting CL_DRIVER_VERSION Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDriverVersion(driverVersionSize); + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DRIVER_VERSION, driverVersionSize, + &szDriverVersion[0], NULL), + "Getting CL_DRIVER_VERSION Platform Info string ( ::clGetDeviceInfo() )"); + + size_t openCLVersionSize = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, + &openCLVersionSize), + "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string size " + "( ::clGetDeviceInfo() )"); + + std::vector szOpenCLVersion(openCLVersionSize); + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_OPENCL_C_VERSION, + openCLVersionSize, &szOpenCLVersion[0], + NULL), + "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string ( " + "::clGetDeviceInfo() )"); + + cl_device_type devType = CL_DEVICE_TYPE_DEFAULT; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_TYPE, sizeof(cl_device_type), + &devType, NULL), + "Getting CL_DEVICE_TYPE device info ( ::clGetDeviceInfo() )"); + + cl_uint devAddrBits = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), + &devAddrBits, NULL), + "Getting CL_DEVICE_ADDRESS_BITS device info ( ::clGetDeviceInfo() )"); + + cl_uint maxClockFreq = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_CLOCK_FREQUENCY, + sizeof(cl_uint), &maxClockFreq, NULL), + "Getting CL_DEVICE_MAX_CLOCK_FREQUENCY device info ( " + "::clGetDeviceInfo() )"); + + cl_bool devAvailable = CL_FALSE; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_AVAILABLE, sizeof(cl_bool), + &devAvailable, NULL), + "Getting CL_DEVICE_AVAILABLE device info ( ::clGetDeviceInfo() )"); + + cl_bool devCompAvailable = CL_FALSE; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_COMPILER_AVAILABLE, + sizeof(cl_bool), &devCompAvailable, NULL), + "Getting CL_DEVICE_COMPILER_AVAILABLE device info ( " + "::clGetDeviceInfo() )"); + + size_t devMaxWorkGroup = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_WORK_GROUP_SIZE, + sizeof(size_t), &devMaxWorkGroup, NULL), + "Getting CL_DEVICE_MAX_WORK_GROUP_SIZE device info ( " + "::clGetDeviceInfo() )"); + + cl_uint devMaxWorkItemDim = CL_FALSE; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, + sizeof(cl_uint), &devMaxWorkItemDim, NULL), + "Getting CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS device info ( " + "::clGetDeviceInfo() )"); + + std::vector devMaxWorkItemSizes(devMaxWorkItemDim); + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_WORK_ITEM_SIZES, + sizeof(size_t) * devMaxWorkItemSizes.size(), + &devMaxWorkItemSizes[0], NULL), + "Getting CL_DEVICE_MAX_WORK_ITEM_SIZES device info ( " + "::clGetDeviceInfo() )"); + + cl_bool deviceHostUnified = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_HOST_UNIFIED_MEMORY, + sizeof(cl_bool), &deviceHostUnified, NULL), + "Getting CL_DEVICE_HOST_UNIFIED_MEMORY Platform Info string ( " + "::clGetDeviceInfo() )"); + + cl_ulong devMaxConstantBuffer = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, + sizeof(cl_ulong), &devMaxConstantBuffer, + NULL), + "Getting CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE device info ( " + "::clGetDeviceInfo() )"); + + cl_ulong devLocalMemSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), + &devLocalMemSize, NULL), + "Getting CL_DEVICE_LOCAL_MEM_SIZE device info ( ::clGetDeviceInfo() )"); + + cl_ulong deviceGlobalMemSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), + &deviceGlobalMemSize, NULL), + "Getting CL_DEVICE_GLOBAL_MEM_SIZE device info ( ::clGetDeviceInfo() )"); + + cl_ulong deviceMaxMemAllocSize = 0; + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_MAX_MEM_ALLOC_SIZE, + sizeof(cl_ulong), &deviceMaxMemAllocSize, + NULL), + "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( " + "::clGetDeviceInfo() )"); + + size_t deviceExtSize = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(dId, CL_DEVICE_EXTENSIONS, 0, NULL, &deviceExtSize), + "Getting CL_DEVICE_EXTENSIONS Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDeviceExt(deviceExtSize); + OPENCL_V_THROW(::clGetDeviceInfo(dId, CL_DEVICE_EXTENSIONS, deviceExtSize, + &szDeviceExt[0], NULL), + "Getting CL_DEVICE_EXTENSIONS Platform Info string ( " + "::clGetDeviceInfo() )"); + + const int indent = countOf(" CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: "); + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_NAME: " << &szDeviceName[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_VERSION: " << &szDeviceVersion[0] << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DRIVER_VERSION: " << &szDriverVersion[0] << std::endl; + std::cout << std::left << std::setw(indent) << " CL_DEVICE_TYPE: " + << (CL_DEVICE_TYPE_DEFAULT & devType ? "default" : "") + << (CL_DEVICE_TYPE_CPU & devType ? "CPU" : "") + << (CL_DEVICE_TYPE_GPU & devType ? "GPU" : "") + << (CL_DEVICE_TYPE_ACCELERATOR & devType ? "Accelerator" : "") + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_CLOCK_FREQUENCY: " << maxClockFreq + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_ADDRESS_BITS: " << devAddrBits << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_AVAILABLE: " << (devAvailable ? "TRUE" : "FALSE") + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_COMPILER_AVAILABLE: " + << (devCompAvailable ? "TRUE" : "FALSE") << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_OPENCL_C_VERSION: " << &szOpenCLVersion[0] + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_WORK_GROUP_SIZE: " << devMaxWorkGroup + << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " << devMaxWorkItemDim + << std::endl; + for (cl_uint wis = 0; wis < devMaxWorkItemSizes.size(); ++wis) { + std::stringstream dimString; + dimString << "Dimension[ " << wis << " ] "; + std::cout << std::right << std::setw(indent) << dimString.str() + << devMaxWorkItemSizes[wis] << std::endl; + } + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_HOST_UNIFIED_MEMORY: " + << (deviceHostUnified ? "TRUE" : "FALSE") << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: " + << devMaxConstantBuffer; + std::cout << " ( " << devMaxConstantBuffer / 1024 << " KB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_LOCAL_MEM_SIZE: " << devLocalMemSize; + std::cout << " ( " << devLocalMemSize / 1024 << " KB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_GLOBAL_MEM_SIZE: " << deviceGlobalMemSize; + std::cout << " ( " << deviceGlobalMemSize / 1048576 << " MB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_MAX_MEM_ALLOC_SIZE: " << deviceMaxMemAllocSize; + std::cout << " ( " << deviceMaxMemAllocSize / 1048576 << " MB )" << std::endl; + std::cout << std::left << std::setw(indent) + << " CL_DEVICE_EXTENSIONS: " << &szDeviceExt[0] << std::endl; + + std::cout << std::right << std::endl; +} - size_t platformExtensionsSize = 0; - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_EXTENSIONS, 0, NULL, &platformExtensionsSize ), - "Getting CL_PLATFORM_EXTENSIONS Platform Info string size ( ::clGetPlatformInfo() )" ); +void prettyPrintCLPlatforms(std::vector &platforms, + std::vector> &devices) { + for (unsigned int i = 0; i < platforms.size(); ++i) { + std::cout << "OpenCL platform [ " << i << " ]:" << std::endl; + prettyPrintPlatformInfo(platforms[i]); - std::vector< char > szPlatformExtensions( platformExtensionsSize ); - OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_EXTENSIONS, platformExtensionsSize, &szPlatformExtensions[ 0 ], NULL), - "Getting CL_PLATFORM_EXTENSIONS Platform Info string ( ::clGetPlatformInfo() )" ); + for (unsigned int n = 0; n < devices[i].size(); ++n) { + std::cout << "OpenCL platform [ " << i << " ], device [ " << n + << " ]:" << std::endl; + prettyPrintDeviceInfo((devices[i])[n]); + } + } +} - const int indent = countOf( " CL_PLATFORM_EXTENSIONS: " ); - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_PROFILE: " << &szPlatformProfile[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_VERSION: " << &szPlatformVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_NAME: " << &szPlatformName[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_VENDOR: " << &szPlatformVendor[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_EXTENSIONS: " << &szPlatformExtensions[ 0 ] << std::endl; - std::cout << std::right << std::endl; +// Verify a failed condition; return true on fail +inline cl_bool OPENCL_V_FAIL(cl_int res) { + if (res == CL_SUCCESS) + return CL_FALSE; + else + return CL_TRUE; } -void prettyPrintDeviceInfo( const cl_device_id& dId ) -{ - size_t deviceNameSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_NAME, 0, NULL, &deviceNameSize ), - "Getting CL_DEVICE_NAME Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDeviceName( deviceNameSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_NAME, deviceNameSize, &szDeviceName[ 0 ], NULL ), - "Getting CL_DEVICE_NAME Platform Info string ( ::clGetDeviceInfo() )" ); - - size_t deviceVersionSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_VERSION, 0, NULL, &deviceVersionSize ), - "Getting CL_DEVICE_VERSION Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDeviceVersion( deviceVersionSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_VERSION, deviceVersionSize, &szDeviceVersion[ 0 ], NULL ), - "Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )" ); - - size_t driverVersionSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DRIVER_VERSION, 0, NULL, &driverVersionSize ), - "Getting CL_DRIVER_VERSION Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDriverVersion( driverVersionSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DRIVER_VERSION, driverVersionSize, &szDriverVersion[ 0 ], NULL ), - "Getting CL_DRIVER_VERSION Platform Info string ( ::clGetDeviceInfo() )" ); - - size_t openCLVersionSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, &openCLVersionSize ), - "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szOpenCLVersion( openCLVersionSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_OPENCL_C_VERSION, openCLVersionSize, &szOpenCLVersion[ 0 ], NULL ), - "Getting CL_DEVICE_OPENCL_C_VERSION Platform Info string ( ::clGetDeviceInfo() )" ); - - cl_device_type devType = CL_DEVICE_TYPE_DEFAULT; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_TYPE, sizeof( cl_device_type ), &devType, NULL ), - "Getting CL_DEVICE_TYPE device info ( ::clGetDeviceInfo() )" ); - - cl_uint devAddrBits = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_ADDRESS_BITS, sizeof( cl_uint ), &devAddrBits, NULL ), - "Getting CL_DEVICE_ADDRESS_BITS device info ( ::clGetDeviceInfo() )" ); - - cl_uint maxClockFreq = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof( cl_uint ), &maxClockFreq, NULL ), - "Getting CL_DEVICE_MAX_CLOCK_FREQUENCY device info ( ::clGetDeviceInfo() )" ); - - cl_bool devAvailable = CL_FALSE; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_AVAILABLE, sizeof( cl_bool ), &devAvailable, NULL ), - "Getting CL_DEVICE_AVAILABLE device info ( ::clGetDeviceInfo() )" ); - - cl_bool devCompAvailable = CL_FALSE; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_COMPILER_AVAILABLE, sizeof( cl_bool ), &devCompAvailable, NULL ), - "Getting CL_DEVICE_COMPILER_AVAILABLE device info ( ::clGetDeviceInfo() )" ); - - size_t devMaxWorkGroup = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof( size_t ), &devMaxWorkGroup, NULL ), - "Getting CL_DEVICE_MAX_WORK_GROUP_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_uint devMaxWorkItemDim = CL_FALSE; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof( cl_uint ), &devMaxWorkItemDim, NULL ), - "Getting CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS device info ( ::clGetDeviceInfo() )" ); - - std::vector< size_t > devMaxWorkItemSizes( devMaxWorkItemDim ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof( size_t )*devMaxWorkItemSizes.size( ), &devMaxWorkItemSizes[0], NULL), - "Getting CL_DEVICE_MAX_WORK_ITEM_SIZES device info ( ::clGetDeviceInfo() )" ); - - cl_bool deviceHostUnified = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof( cl_bool ), &deviceHostUnified, NULL ), - "Getting CL_DEVICE_HOST_UNIFIED_MEMORY Platform Info string ( ::clGetDeviceInfo() )" ); - - cl_ulong devMaxConstantBuffer = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof( cl_ulong ), &devMaxConstantBuffer, NULL ), - "Getting CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_ulong devLocalMemSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_LOCAL_MEM_SIZE, sizeof( cl_ulong ), &devLocalMemSize, NULL ), - "Getting CL_DEVICE_LOCAL_MEM_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_ulong deviceGlobalMemSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( cl_ulong ), &deviceGlobalMemSize, NULL ), - "Getting CL_DEVICE_GLOBAL_MEM_SIZE device info ( ::clGetDeviceInfo() )" ); - - cl_ulong deviceMaxMemAllocSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( cl_ulong ), &deviceMaxMemAllocSize, NULL ), - "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( ::clGetDeviceInfo() )" ); - - size_t deviceExtSize = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_EXTENSIONS, 0, NULL, &deviceExtSize ), - "Getting CL_DEVICE_EXTENSIONS Platform Info string size ( ::clGetDeviceInfo() )" ); - - std::vector< char > szDeviceExt( deviceExtSize ); - OPENCL_V_THROW( ::clGetDeviceInfo( dId, CL_DEVICE_EXTENSIONS, deviceExtSize, &szDeviceExt[ 0 ], NULL ), - "Getting CL_DEVICE_EXTENSIONS Platform Info string ( ::clGetDeviceInfo() )" ); - - const int indent = countOf( " CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " ); - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_NAME: " << &szDeviceName[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_VERSION: " << &szDeviceVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DRIVER_VERSION: " << &szDriverVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_TYPE: " - << (CL_DEVICE_TYPE_DEFAULT & devType ? "default" : "") - << (CL_DEVICE_TYPE_CPU & devType ? "CPU" : "") - << (CL_DEVICE_TYPE_GPU & devType ? "GPU" : "") - << (CL_DEVICE_TYPE_ACCELERATOR & devType ? "Accelerator" : "") - << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_CLOCK_FREQUENCY: " << maxClockFreq << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_ADDRESS_BITS: " << devAddrBits << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_AVAILABLE: " << ( devAvailable ? "TRUE": "FALSE") << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_COMPILER_AVAILABLE: " << ( devCompAvailable ? "TRUE": "FALSE") << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_OPENCL_C_VERSION: " << &szOpenCLVersion[ 0 ] << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_WORK_GROUP_SIZE: " << devMaxWorkGroup << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: " << devMaxWorkItemDim << std::endl; - for( cl_uint wis = 0; wis < devMaxWorkItemSizes.size( ); ++wis ) - { - std::stringstream dimString; - dimString << "Dimension[ " << wis << " ] "; - std::cout << std::right << std::setw( indent ) << dimString.str( ) << devMaxWorkItemSizes[wis] << std::endl; - } - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_HOST_UNIFIED_MEMORY: " << ( deviceHostUnified ? "TRUE": "FALSE") << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: " << devMaxConstantBuffer; - std::cout << " ( " << devMaxConstantBuffer / 1024 << " KB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_LOCAL_MEM_SIZE: " << devLocalMemSize; - std::cout << " ( " << devLocalMemSize / 1024 << " KB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_GLOBAL_MEM_SIZE: " << deviceGlobalMemSize; - std::cout << " ( " << deviceGlobalMemSize / 1048576 << " MB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_MAX_MEM_ALLOC_SIZE: " << deviceMaxMemAllocSize; - std::cout << " ( " << deviceMaxMemAllocSize / 1048576 << " MB )" << std::endl; - std::cout << std::left << std::setw( indent ) << " CL_DEVICE_EXTENSIONS: " << &szDeviceExt[ 0 ] << std::endl; - - std::cout << std::right << std::endl; +std::string prettyPrintclFFTStatus(const cl_int &status) { + switch (status) { + case CLFFT_INVALID_GLOBAL_WORK_SIZE: + return "CLFFT_INVALID_GLOBAL_WORK_SIZE"; + case CLFFT_INVALID_MIP_LEVEL: + return "CLFFT_INVALID_MIP_LEVEL"; + case CLFFT_INVALID_BUFFER_SIZE: + return "CLFFT_INVALID_BUFFER_SIZE"; + case CLFFT_INVALID_GL_OBJECT: + return "CLFFT_INVALID_GL_OBJECT"; + case CLFFT_INVALID_OPERATION: + return "CLFFT_INVALID_OPERATION"; + case CLFFT_INVALID_EVENT: + return "CLFFT_INVALID_EVENT"; + case CLFFT_INVALID_EVENT_WAIT_LIST: + return "CLFFT_INVALID_EVENT_WAIT_LIST"; + case CLFFT_INVALID_GLOBAL_OFFSET: + return "CLFFT_INVALID_GLOBAL_OFFSET"; + case CLFFT_INVALID_WORK_ITEM_SIZE: + return "CLFFT_INVALID_WORK_ITEM_SIZE"; + case CLFFT_INVALID_WORK_GROUP_SIZE: + return "CLFFT_INVALID_WORK_GROUP_SIZE"; + case CLFFT_INVALID_WORK_DIMENSION: + return "CLFFT_INVALID_WORK_DIMENSION"; + case CLFFT_INVALID_KERNEL_ARGS: + return "CLFFT_INVALID_KERNEL_ARGS"; + case CLFFT_INVALID_ARG_SIZE: + return "CLFFT_INVALID_ARG_SIZE"; + case CLFFT_INVALID_ARG_VALUE: + return "CLFFT_INVALID_ARG_VALUE"; + case CLFFT_INVALID_ARG_INDEX: + return "CLFFT_INVALID_ARG_INDEX"; + case CLFFT_INVALID_KERNEL: + return "CLFFT_INVALID_KERNEL"; + case CLFFT_INVALID_KERNEL_DEFINITION: + return "CLFFT_INVALID_KERNEL_DEFINITION"; + case CLFFT_INVALID_KERNEL_NAME: + return "CLFFT_INVALID_KERNEL_NAME"; + case CLFFT_INVALID_PROGRAM_EXECUTABLE: + return "CLFFT_INVALID_PROGRAM_EXECUTABLE"; + case CLFFT_INVALID_PROGRAM: + return "CLFFT_INVALID_PROGRAM"; + case CLFFT_INVALID_BUILD_OPTIONS: + return "CLFFT_INVALID_BUILD_OPTIONS"; + case CLFFT_INVALID_BINARY: + return "CLFFT_INVALID_BINARY"; + case CLFFT_INVALID_SAMPLER: + return "CLFFT_INVALID_SAMPLER"; + case CLFFT_INVALID_IMAGE_SIZE: + return "CLFFT_INVALID_IMAGE_SIZE"; + case CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR: + return "CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR"; + case CLFFT_INVALID_MEM_OBJECT: + return "CLFFT_INVALID_MEM_OBJECT"; + case CLFFT_INVALID_HOST_PTR: + return "CLFFT_INVALID_HOST_PTR"; + case CLFFT_INVALID_COMMAND_QUEUE: + return "CLFFT_INVALID_COMMAND_QUEUE"; + case CLFFT_INVALID_QUEUE_PROPERTIES: + return "CLFFT_INVALID_QUEUE_PROPERTIES"; + case CLFFT_INVALID_CONTEXT: + return "CLFFT_INVALID_CONTEXT"; + case CLFFT_INVALID_DEVICE: + return "CLFFT_INVALID_DEVICE"; + case CLFFT_INVALID_PLATFORM: + return "CLFFT_INVALID_PLATFORM"; + case CLFFT_INVALID_DEVICE_TYPE: + return "CLFFT_INVALID_DEVICE_TYPE"; + case CLFFT_INVALID_VALUE: + return "CLFFT_INVALID_VALUE"; + case CLFFT_MAP_FAILURE: + return "CLFFT_MAP_FAILURE"; + case CLFFT_BUILD_PROGRAM_FAILURE: + return "CLFFT_BUILD_PROGRAM_FAILURE"; + case CLFFT_IMAGE_FORMAT_NOT_SUPPORTED: + return "CLFFT_IMAGE_FORMAT_NOT_SUPPORTED"; + case CLFFT_IMAGE_FORMAT_MISMATCH: + return "CLFFT_IMAGE_FORMAT_MISMATCH"; + case CLFFT_MEM_COPY_OVERLAP: + return "CLFFT_MEM_COPY_OVERLAP"; + case CLFFT_PROFILING_INFO_NOT_AVAILABLE: + return "CLFFT_PROFILING_INFO_NOT_AVAILABLE"; + case CLFFT_OUT_OF_HOST_MEMORY: + return "CLFFT_OUT_OF_HOST_MEMORY"; + case CLFFT_OUT_OF_RESOURCES: + return "CLFFT_OUT_OF_RESOURCES"; + case CLFFT_MEM_OBJECT_ALLOCATION_FAILURE: + return "CLFFT_MEM_OBJECT_ALLOCATION_FAILURE"; + case CLFFT_COMPILER_NOT_AVAILABLE: + return "CLFFT_COMPILER_NOT_AVAILABLE"; + case CLFFT_DEVICE_NOT_AVAILABLE: + return "CLFFT_DEVICE_NOT_AVAILABLE"; + case CLFFT_DEVICE_NOT_FOUND: + return "CLFFT_DEVICE_NOT_FOUND"; + case CLFFT_SUCCESS: + return "CLFFT_SUCCESS"; + case CLFFT_NOTIMPLEMENTED: + return "CLFFT_NOTIMPLEMENTED"; + case CLFFT_TRANSPOSED_NOTIMPLEMENTED: + return "CLFFT_TRANSPOSED_NOTIMPLEMENTED"; + case CLFFT_FILE_NOT_FOUND: + return "CLFFT_FILE_NOT_FOUND"; + case CLFFT_FILE_CREATE_FAILURE: + return "CLFFT_FILE_CREATE_FAILURE"; + case CLFFT_VERSION_MISMATCH: + return "CLFFT_VERSION_MISMATCH"; + case CLFFT_INVALID_PLAN: + return "CLFFT_INVALID_PLAN"; + default: + return "Error code not defined"; + break; + } } -void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices) -{ - for (unsigned int i = 0; i < platforms.size(); ++i) - { - std::cout << "OpenCL platform [ " << i << " ]:" << std::endl; - prettyPrintPlatformInfo(platforms[i]); - - for (unsigned int n = 0; n < devices[i].size(); ++n) - { - std::cout << "OpenCL platform [ " << i << " ], device [ " << n << " ]:" << std::endl; - prettyPrintDeviceInfo((devices[i])[n]); - } - } +int discoverCLPlatforms(cl_device_type deviceType, + std::vector &platforms, + std::vector> &devices) { + cl_int status = 0; -} + /* + * Find all OpenCL platforms this system has to offer. + */ -// Verify a failed condition; return true on fail -inline cl_bool OPENCL_V_FAIL( cl_int res ) -{ - if( res == CL_SUCCESS ) - return CL_FALSE; - else - return CL_TRUE; -} + cl_uint numPlatforms = 0; + cl_platform_id platform = NULL; + OPENCL_V_THROW(::clGetPlatformIDs(0, NULL, &numPlatforms), + "Getting number of platforms( ::clGetPlatformsIDs() )"); + + if (numPlatforms > 0) { + platforms.resize(numPlatforms); + devices.resize(numPlatforms); + OPENCL_V_THROW(::clGetPlatformIDs(numPlatforms, &platforms[0], NULL), + "Getting Platform Id's ( ::clGetPlatformsIDs() )"); -std::string prettyPrintclFFTStatus( const cl_int& status ) -{ - switch( status ) - { - case CLFFT_INVALID_GLOBAL_WORK_SIZE: - return "CLFFT_INVALID_GLOBAL_WORK_SIZE"; - case CLFFT_INVALID_MIP_LEVEL: - return "CLFFT_INVALID_MIP_LEVEL"; - case CLFFT_INVALID_BUFFER_SIZE: - return "CLFFT_INVALID_BUFFER_SIZE"; - case CLFFT_INVALID_GL_OBJECT: - return "CLFFT_INVALID_GL_OBJECT"; - case CLFFT_INVALID_OPERATION: - return "CLFFT_INVALID_OPERATION"; - case CLFFT_INVALID_EVENT: - return "CLFFT_INVALID_EVENT"; - case CLFFT_INVALID_EVENT_WAIT_LIST: - return "CLFFT_INVALID_EVENT_WAIT_LIST"; - case CLFFT_INVALID_GLOBAL_OFFSET: - return "CLFFT_INVALID_GLOBAL_OFFSET"; - case CLFFT_INVALID_WORK_ITEM_SIZE: - return "CLFFT_INVALID_WORK_ITEM_SIZE"; - case CLFFT_INVALID_WORK_GROUP_SIZE: - return "CLFFT_INVALID_WORK_GROUP_SIZE"; - case CLFFT_INVALID_WORK_DIMENSION: - return "CLFFT_INVALID_WORK_DIMENSION"; - case CLFFT_INVALID_KERNEL_ARGS: - return "CLFFT_INVALID_KERNEL_ARGS"; - case CLFFT_INVALID_ARG_SIZE: - return "CLFFT_INVALID_ARG_SIZE"; - case CLFFT_INVALID_ARG_VALUE: - return "CLFFT_INVALID_ARG_VALUE"; - case CLFFT_INVALID_ARG_INDEX: - return "CLFFT_INVALID_ARG_INDEX"; - case CLFFT_INVALID_KERNEL: - return "CLFFT_INVALID_KERNEL"; - case CLFFT_INVALID_KERNEL_DEFINITION: - return "CLFFT_INVALID_KERNEL_DEFINITION"; - case CLFFT_INVALID_KERNEL_NAME: - return "CLFFT_INVALID_KERNEL_NAME"; - case CLFFT_INVALID_PROGRAM_EXECUTABLE: - return "CLFFT_INVALID_PROGRAM_EXECUTABLE"; - case CLFFT_INVALID_PROGRAM: - return "CLFFT_INVALID_PROGRAM"; - case CLFFT_INVALID_BUILD_OPTIONS: - return "CLFFT_INVALID_BUILD_OPTIONS"; - case CLFFT_INVALID_BINARY: - return "CLFFT_INVALID_BINARY"; - case CLFFT_INVALID_SAMPLER: - return "CLFFT_INVALID_SAMPLER"; - case CLFFT_INVALID_IMAGE_SIZE: - return "CLFFT_INVALID_IMAGE_SIZE"; - case CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR: - return "CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR"; - case CLFFT_INVALID_MEM_OBJECT: - return "CLFFT_INVALID_MEM_OBJECT"; - case CLFFT_INVALID_HOST_PTR: - return "CLFFT_INVALID_HOST_PTR"; - case CLFFT_INVALID_COMMAND_QUEUE: - return "CLFFT_INVALID_COMMAND_QUEUE"; - case CLFFT_INVALID_QUEUE_PROPERTIES: - return "CLFFT_INVALID_QUEUE_PROPERTIES"; - case CLFFT_INVALID_CONTEXT: - return "CLFFT_INVALID_CONTEXT"; - case CLFFT_INVALID_DEVICE: - return "CLFFT_INVALID_DEVICE"; - case CLFFT_INVALID_PLATFORM: - return "CLFFT_INVALID_PLATFORM"; - case CLFFT_INVALID_DEVICE_TYPE: - return "CLFFT_INVALID_DEVICE_TYPE"; - case CLFFT_INVALID_VALUE: - return "CLFFT_INVALID_VALUE"; - case CLFFT_MAP_FAILURE: - return "CLFFT_MAP_FAILURE"; - case CLFFT_BUILD_PROGRAM_FAILURE: - return "CLFFT_BUILD_PROGRAM_FAILURE"; - case CLFFT_IMAGE_FORMAT_NOT_SUPPORTED: - return "CLFFT_IMAGE_FORMAT_NOT_SUPPORTED"; - case CLFFT_IMAGE_FORMAT_MISMATCH: - return "CLFFT_IMAGE_FORMAT_MISMATCH"; - case CLFFT_MEM_COPY_OVERLAP: - return "CLFFT_MEM_COPY_OVERLAP"; - case CLFFT_PROFILING_INFO_NOT_AVAILABLE: - return "CLFFT_PROFILING_INFO_NOT_AVAILABLE"; - case CLFFT_OUT_OF_HOST_MEMORY: - return "CLFFT_OUT_OF_HOST_MEMORY"; - case CLFFT_OUT_OF_RESOURCES: - return "CLFFT_OUT_OF_RESOURCES"; - case CLFFT_MEM_OBJECT_ALLOCATION_FAILURE: - return "CLFFT_MEM_OBJECT_ALLOCATION_FAILURE"; - case CLFFT_COMPILER_NOT_AVAILABLE: - return "CLFFT_COMPILER_NOT_AVAILABLE"; - case CLFFT_DEVICE_NOT_AVAILABLE: - return "CLFFT_DEVICE_NOT_AVAILABLE"; - case CLFFT_DEVICE_NOT_FOUND: - return "CLFFT_DEVICE_NOT_FOUND"; - case CLFFT_SUCCESS: - return "CLFFT_SUCCESS"; - case CLFFT_NOTIMPLEMENTED: - return "CLFFT_NOTIMPLEMENTED"; - case CLFFT_TRANSPOSED_NOTIMPLEMENTED: - return "CLFFT_TRANSPOSED_NOTIMPLEMENTED"; - case CLFFT_FILE_NOT_FOUND: - return "CLFFT_FILE_NOT_FOUND"; - case CLFFT_FILE_CREATE_FAILURE: - return "CLFFT_FILE_CREATE_FAILURE"; - case CLFFT_VERSION_MISMATCH: - return "CLFFT_VERSION_MISMATCH"; - case CLFFT_INVALID_PLAN: - return "CLFFT_INVALID_PLAN"; - default: - return "Error code not defined"; - break; + if (NULL == platforms[0]) { + throw std::runtime_error("No appropriate OpenCL platform could be found"); } -} + /* + * Now, for each platform get all available devices matching deviceType. + */ + for (unsigned int i = 0; i < numPlatforms; ++i) { + // Get the device list for deviceType. + // + cl_uint numDevices = 0; + OPENCL_V_WARN( + ::clGetDeviceIDs(platforms[i], deviceType, 0, NULL, &numDevices), + "Getting OpenCL devices ( ::clGetDeviceIDs() )"); + if (0 == numDevices) { + // OPENCL_V_WARN(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); + continue; + } + + devices[i].resize(numDevices); + OPENCL_V_THROW(::clGetDeviceIDs(platforms[i], deviceType, numDevices, + &(devices[i])[0], NULL), + "Getting OpenCL deviceIDs ( ::clGetDeviceIDs() )"); + } + } -int discoverCLPlatforms( cl_device_type deviceType, - std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices ) -{ - cl_int status = 0; - - /* - * Find all OpenCL platforms this system has to offer. - */ - - cl_uint numPlatforms = 0; - cl_platform_id platform = NULL; - OPENCL_V_THROW(::clGetPlatformIDs(0, NULL, &numPlatforms), - "Getting number of platforms( ::clGetPlatformsIDs() )"); - - if (numPlatforms > 0) - { - platforms.resize( numPlatforms ); - devices.resize( numPlatforms ); - OPENCL_V_THROW(::clGetPlatformIDs(numPlatforms, &platforms[0], NULL), - "Getting Platform Id's ( ::clGetPlatformsIDs() )"); - - if (NULL == platforms[0]) - { - throw std::runtime_error("No appropriate OpenCL platform could be found"); - } - - /* - * Now, for each platform get all available devices matching deviceType. - */ - for (unsigned int i = 0; i < numPlatforms; ++i) - { - // Get the device list for deviceType. - // - cl_uint numDevices = 0; - OPENCL_V_WARN(::clGetDeviceIDs(platforms[i], deviceType, 0, NULL, &numDevices), - "Getting OpenCL devices ( ::clGetDeviceIDs() )"); - if (0 == numDevices) - { - // OPENCL_V_WARN(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); - continue; - } - - devices[i].resize(numDevices); - OPENCL_V_THROW(::clGetDeviceIDs(platforms[i], deviceType, numDevices, &(devices[i])[0], NULL), - "Getting OpenCL deviceIDs ( ::clGetDeviceIDs() )"); - } - } - - return 0; + return 0; } -std::vector< cl_device_id > initializeCL( cl_device_type deviceType, - cl_int deviceId, - cl_int platformId, - cl_context& context, - bool printclInfo ) -{ - cl_int status = 0; - cl_platform_id platform = NULL; - std::vector< cl_device_id > devices(1); - devices[0] = NULL; - - // Have a look at all the available platforms on this system - std::vector< cl_platform_id > platformInfos; - std::vector< std::vector< cl_device_id > > deviceInfos; - discoverCLPlatforms( deviceType, platformInfos, deviceInfos ); - - - for (unsigned int i = 0; i < platformInfos.size(); ++i) - { - if(i == platformId) - { - for (unsigned int n = 0; n < deviceInfos[i].size(); ++n) - { - if (n == deviceId) - { - platform = platformInfos[i]; - devices[0] = deviceInfos[i][n]; - - if(printclInfo) - { - prettyPrintPlatformInfo(platform); - prettyPrintDeviceInfo(devices[0]); - } - - break; - } - } - - break; - } - } - - - - // Do some error checking if we really selected a valid platform and a valid device - if (NULL == devices[0]) - { - OPENCL_V_THROW(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); - } - - if (NULL == platform) - { - throw std::runtime_error("No appropriate OpenCL platform could be found"); - } - - // Create an OpenCL context - cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties) platform, 0 }; - context = clCreateContext(cps, - (cl_uint)devices.size(), - &devices[0], - NULL, - NULL, - &status); - OPENCL_V_THROW(status, "Creating Context ( ::clCreateContextFromType() )"); - - return devices; +std::vector initializeCL(cl_device_type deviceType, + cl_int deviceId, cl_int platformId, + cl_context &context, bool printclInfo) { + cl_int status = 0; + cl_platform_id platform = NULL; + std::vector devices(1); + devices[0] = NULL; + + // Have a look at all the available platforms on this system + std::vector platformInfos; + std::vector> deviceInfos; + discoverCLPlatforms(deviceType, platformInfos, deviceInfos); + + for (unsigned int i = 0; i < platformInfos.size(); ++i) { + if (i == platformId) { + for (unsigned int n = 0; n < deviceInfos[i].size(); ++n) { + if (n == deviceId) { + platform = platformInfos[i]; + devices[0] = deviceInfos[i][n]; + + if (printclInfo) { + prettyPrintPlatformInfo(platform); + prettyPrintDeviceInfo(devices[0]); + } + + break; + } + } + + break; + } + } + + // Do some error checking if we really selected a valid platform and a valid + // device + if (NULL == devices[0]) { + OPENCL_V_THROW(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available"); + } + + if (NULL == platform) { + throw std::runtime_error("No appropriate OpenCL platform could be found"); + } + + // Create an OpenCL context + cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM, + (cl_context_properties)platform, 0}; + context = clCreateContext(cps, (cl_uint)devices.size(), &devices[0], NULL, + NULL, &status); + OPENCL_V_THROW(status, "Creating Context ( ::clCreateContextFromType() )"); + + return devices; } -int cleanupCL( cl_context* context, cl_command_queue* commandQueue, - const cl_uint numBuffersIn, cl_mem inputBuffer[], const cl_uint numBuffersOut, cl_mem outputBuffer[], cl_event* outEvent ) -{ - if(outEvent != NULL) - { - if( *outEvent != NULL ) - OPENCL_V_THROW( clReleaseEvent( *outEvent ), "Error: In clReleaseEvent\n" ); - } +int cleanupCL(cl_context *context, cl_command_queue *commandQueue, + const cl_uint numBuffersIn, cl_mem inputBuffer[], + const cl_uint numBuffersOut, cl_mem outputBuffer[], + cl_event *outEvent) { + if (outEvent != NULL) { + if (*outEvent != NULL) + OPENCL_V_THROW(clReleaseEvent(*outEvent), "Error: In clReleaseEvent\n"); + } - releaseOpenCLMemBuffer( numBuffersIn, inputBuffer); - releaseOpenCLMemBuffer( numBuffersOut, outputBuffer); + releaseOpenCLMemBuffer(numBuffersIn, inputBuffer); + releaseOpenCLMemBuffer(numBuffersOut, outputBuffer); - if( *commandQueue != NULL ) - OPENCL_V_THROW( clReleaseCommandQueue( *commandQueue ), "Error: In clReleaseCommandQueue\n" ); + if (*commandQueue != NULL) + OPENCL_V_THROW(clReleaseCommandQueue(*commandQueue), + "Error: In clReleaseCommandQueue\n"); - if( *context != NULL ) - OPENCL_V_THROW( clReleaseContext( *context ), "Error: In clReleaseContext\n" ); + if (*context != NULL) + OPENCL_V_THROW(clReleaseContext(*context), "Error: In clReleaseContext\n"); - return 0; + return 0; } -int createOpenCLMemoryBuffer( cl_context& context, const size_t bufferSizeBytes, const cl_uint numBuffers, cl_mem buffer[], cl_mem_flags accessibility) { - cl_int status = 0; +int createOpenCLMemoryBuffer(cl_context &context, const size_t bufferSizeBytes, + const cl_uint numBuffers, cl_mem buffer[], + cl_mem_flags accessibility) { + cl_int status = 0; - for( cl_uint i = 0; i < numBuffers; ++i ) - { - buffer[ i ] = ::clCreateBuffer( context, accessibility, bufferSizeBytes, NULL, &status); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - } + for (cl_uint i = 0; i < numBuffers; ++i) { + buffer[i] = ::clCreateBuffer(context, accessibility, bufferSizeBytes, NULL, + &status); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + } - return 0; + return 0; } -int releaseOpenCLMemBuffer( const cl_uint numBuffers, cl_mem buffer[]) -{ - for( cl_uint i = 0; i < numBuffers; ++i ) - { - if( buffer[ i ] != NULL ) - OPENCL_V_THROW( clReleaseMemObject( buffer[ i ] ), "Error: In clReleaseMemObject\n" ); - } +int releaseOpenCLMemBuffer(const cl_uint numBuffers, cl_mem buffer[]) { + for (cl_uint i = 0; i < numBuffers; ++i) { + if (buffer[i] != NULL) + OPENCL_V_THROW(clReleaseMemObject(buffer[i]), + "Error: In clReleaseMemObject\n"); + } - return 0; + return 0; } -void createOpenCLCommandQueue( cl_context& context, - cl_uint commandQueueFlags, - cl_command_queue& commandQueue, - std::vector< cl_device_id > devices, - const size_t bufferSizeBytesIn, - const cl_uint numBuffersIn, - cl_mem clMemBufferIn[], - const size_t bufferSizeBytesOut, - const cl_uint numBuffersOut, - cl_mem clMemBufferOut[] ) -{ - cl_int status = 0; - commandQueue = ::clCreateCommandQueue( context, devices[0], commandQueueFlags, &status ); - OPENCL_V_THROW( status, "Creating Command Queue ( ::clCreateCommandQueue() )" ); - - createOpenCLMemoryBuffer( context, bufferSizeBytesIn, numBuffersIn, clMemBufferIn, CL_MEM_READ_WRITE); - createOpenCLMemoryBuffer( context, bufferSizeBytesOut, numBuffersOut, clMemBufferOut, CL_MEM_READ_WRITE); +void createOpenCLCommandQueue( + cl_context &context, cl_uint commandQueueFlags, + cl_command_queue &commandQueue, std::vector devices, + const size_t bufferSizeBytesIn, const cl_uint numBuffersIn, + cl_mem clMemBufferIn[], const size_t bufferSizeBytesOut, + const cl_uint numBuffersOut, cl_mem clMemBufferOut[]) { + cl_int status = 0; + commandQueue = + ::clCreateCommandQueue(context, devices[0], commandQueueFlags, &status); + OPENCL_V_THROW(status, "Creating Command Queue ( ::clCreateCommandQueue() )"); + + createOpenCLMemoryBuffer(context, bufferSizeBytesIn, numBuffersIn, + clMemBufferIn, CL_MEM_READ_WRITE); + createOpenCLMemoryBuffer(context, bufferSizeBytesOut, numBuffersOut, + clMemBufferOut, CL_MEM_READ_WRITE); } - diff --git a/src/client/openCL.misc.h b/src/client/openCL.misc.h index 95158581..ee730fef 100644 --- a/src/client/openCL.misc.h +++ b/src/client/openCL.misc.h @@ -19,30 +19,30 @@ #endif #pragma once -#if !defined( OPENCL_MISC_H ) +#if !defined(OPENCL_MISC_H) #define OPENCL_MISC_H +#include "unicode.compatibility.h" #include #include -#include "unicode.compatibility.h" // Creating a portable defintion of countof -#if defined( _MSC_VER ) - #define countOf _countof +#if defined(_MSC_VER) +#define countOf _countof #else - #define countOf( arr ) ( sizeof( arr ) / sizeof( arr[ 0 ] ) ) +#define countOf(arr) (sizeof(arr) / sizeof(arr[0])) #endif /* * \brief OpenCL platform and device discovery * Creates a list of OpenCL platforms - * and their associated devices + * and their associated devices */ -int discoverCLPlatforms( cl_device_type deviceType, - std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices ); +int discoverCLPlatforms(cl_device_type deviceType, + std::vector &platforms, + std::vector> &devices); -void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms, - std::vector< std::vector< cl_device_id > >& devices); +void prettyPrintCLPlatforms(std::vector &platforms, + std::vector> &devices); /* * \brief OpenCL related initialization @@ -50,105 +50,96 @@ void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms, * Load CL file, compile, link CL source * Build program and kernel objects */ -std::vector< cl_device_id > initializeCL( cl_device_type deviceType, - cl_int deviceId, - cl_int platformId, - cl_context& context, - bool printclInfo ); +std::vector initializeCL(cl_device_type deviceType, + cl_int deviceId, cl_int platformId, + cl_context &context, bool printclInfo); /* * \brief OpenCL memory buffer creation */ -int createOpenCLMemoryBuffer( - cl_context& context, - const size_t bufferSizeBytes, - const cl_uint numBuffers, - cl_mem buffer[], - cl_mem_flags accessibility - ); +int createOpenCLMemoryBuffer(cl_context &context, const size_t bufferSizeBytes, + const cl_uint numBuffers, cl_mem buffer[], + cl_mem_flags accessibility); /* * \brief OpenCL command queue creation * Create Command Queue * Create OpenCL memory buffer objects */ -void createOpenCLCommandQueue( cl_context& context, - cl_uint commandQueueFlags, - cl_command_queue& commandQueue, - std::vector< cl_device_id > devices, - const size_t bufferSizeBytesIn, - const cl_uint numBuffersIn, - cl_mem clMemBufferIn[], - const size_t bufferSizeBytesOut, - const cl_uint numBuffersOut, - cl_mem clMemBufferOut[] ); +void createOpenCLCommandQueue( + cl_context &context, cl_uint commandQueueFlags, + cl_command_queue &commandQueue, std::vector devices, + const size_t bufferSizeBytesIn, const cl_uint numBuffersIn, + cl_mem clMemBufferIn[], const size_t bufferSizeBytesOut, + const cl_uint numBuffersOut, cl_mem clMemBufferOut[]); /* * \brief release OpenCL memory buffer */ -int releaseOpenCLMemBuffer( const cl_uint numBuffers, cl_mem buffer[] ); - -std::string prettyPrintclFFTStatus( const cl_int& status ); - -// This is used to either wrap an OpenCL function call, or to explicitly check a variable for an OpenCL error condition. -// If an error occurs, we throw. -// Note: std::runtime_error does not take unicode strings as input, so only strings supported -inline cl_int OpenCL_V_Throw ( cl_int res, const std::string& msg, size_t lineno ) -{ - switch( res ) - { - case CL_SUCCESS: /**< No error */ - break; - default: - { - std::stringstream tmp; - tmp << "OPENCL_V_THROWERROR< "; - tmp << prettyPrintclFFTStatus( res ); - tmp << " > ("; - tmp << lineno; - tmp << "): "; - tmp << msg; - std::string errorm (tmp.str()); - std::cout << errorm<< std::endl; - throw std::runtime_error( errorm ); - } - } - - return res; +int releaseOpenCLMemBuffer(const cl_uint numBuffers, cl_mem buffer[]); + +std::string prettyPrintclFFTStatus(const cl_int &status); + +// This is used to either wrap an OpenCL function call, or to explicitly +//check a variable for an OpenCL error condition. If an error occurs, we throw. +// Note: std::runtime_error does not take unicode strings as input, so only +//strings supported +inline cl_int OpenCL_V_Throw(cl_int res, const std::string &msg, + size_t lineno) { + switch (res) { + case CL_SUCCESS: /**< No error */ + break; + default: { + std::stringstream tmp; + tmp << "OPENCL_V_THROWERROR< "; + tmp << prettyPrintclFFTStatus(res); + tmp << " > ("; + tmp << lineno; + tmp << "): "; + tmp << msg; + std::string errorm(tmp.str()); + std::cout << errorm << std::endl; + throw std::runtime_error(errorm); + } + } + + return res; } -#define OPENCL_V_THROW(_status,_message) OpenCL_V_Throw (_status, _message, __LINE__) - -inline cl_int OpenCL_V_Warn(cl_int res, const std::string& msg, size_t lineno) -{ - switch (res) - { - case CL_SUCCESS: /**< No error */ - break; - case CL_DEVICE_NOT_FOUND: - // This happens all the time when discovering the OpenCL capabilities of the system, - // so do nothing here. - break; - default: - { - std::stringstream tmp; - tmp << "OPENCL_V_WARN< "; - tmp << prettyPrintclFFTStatus(res); - tmp << " > ("; - tmp << lineno; - tmp << "): "; - tmp << msg; - std::string errorm(tmp.str()); - std::cout << errorm << std::endl; - } - } - - return res; +#define OPENCL_V_THROW(_status, _message) \ + OpenCL_V_Throw(_status, _message, __LINE__) + +inline cl_int OpenCL_V_Warn(cl_int res, const std::string &msg, size_t lineno) { + switch (res) { + case CL_SUCCESS: /**< No error */ + break; + case CL_DEVICE_NOT_FOUND: + // This happens all the time when discovering the OpenCL capabilities of the + // system, so do nothing here. + break; + default: { + std::stringstream tmp; + tmp << "OPENCL_V_WARN< "; + tmp << prettyPrintclFFTStatus(res); + tmp << " > ("; + tmp << lineno; + tmp << "): "; + tmp << msg; + std::string errorm(tmp.str()); + std::cout << errorm << std::endl; + } + } + + return res; } -#define OPENCL_V_WARN(_status,_message) OpenCL_V_Warn (_status, _message, __LINE__); +#define OPENCL_V_WARN(_status, _message) \ + OpenCL_V_Warn(_status, _message, __LINE__); /* * \brief Release OpenCL resources (Context, Memory etc.) */ -int cleanupCL( cl_context* context, cl_command_queue* commandQueue, const cl_uint numBuffersIn, cl_mem inputBuffer[], const cl_uint numBuffersOut, cl_mem outputBuffer[], cl_event* outEvent ); +int cleanupCL(cl_context *context, cl_command_queue *commandQueue, + const cl_uint numBuffersIn, cl_mem inputBuffer[], + const cl_uint numBuffersOut, cl_mem outputBuffer[], + cl_event *outEvent); #endif diff --git a/src/client/stdafx.cpp b/src/client/stdafx.cpp index 2587b2c1..fec08b6f 100644 --- a/src/client/stdafx.cpp +++ b/src/client/stdafx.cpp @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - // stdafx.cpp : source file that includes just the standard includes // clFFT.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information diff --git a/src/examples/fft1d.c b/src/examples/fft1d.c index 30903853..291e967e 100644 --- a/src/examples/fft1d.c +++ b/src/examples/fft1d.c @@ -20,117 +20,118 @@ /* No need to explicitely include the OpenCL headers */ #include -int main( void ) -{ - cl_int err; - cl_platform_id platform = 0; - cl_device_id device = 0; - cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 }; - cl_context ctx = 0; - cl_command_queue queue = 0; - cl_mem bufX; - float *X; - cl_event event = NULL; - int ret = 0; - size_t N = 16; - char platform_name[128]; - char device_name[128]; - - /* FFT library realted declarations */ - clfftPlanHandle planHandle; - clfftDim dim = CLFFT_1D; - size_t clLengths[1] = {N}; - - /* Setup OpenCL environment. */ - err = clGetPlatformIDs( 1, &platform, NULL ); - - size_t ret_param_size = 0; - err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, - sizeof(platform_name), platform_name, - &ret_param_size); - printf("Platform found: %s\n", platform_name); - - err = clGetDeviceIDs( platform, CL_DEVICE_TYPE_DEFAULT, 1, &device, NULL ); - - err = clGetDeviceInfo(device, CL_DEVICE_NAME, - sizeof(device_name), device_name, - &ret_param_size); - printf("Device found on the above platform: %s\n", device_name); - - props[1] = (cl_context_properties)platform; - ctx = clCreateContext( props, 1, &device, NULL, NULL, &err ); - queue = clCreateCommandQueue( ctx, device, 0, &err ); - - /* Setup clFFT. */ - clfftSetupData fftSetup; - err = clfftInitSetupData(&fftSetup); - err = clfftSetup(&fftSetup); - - /* Allocate host & initialize data. */ - /* Only allocation shown for simplicity. */ - X = (float *)malloc(N * 2 * sizeof(*X)); - - /* print input array */ - printf("\nPerforming fft on an one dimensional array of size N = %lu\n", (unsigned long)N); - int print_iter = 0; - while(print_iter -int main( void ) -{ - cl_int err; - cl_platform_id platform = 0; - cl_device_id device = 0; - cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 }; - cl_context ctx = 0; - cl_command_queue queue = 0; - cl_mem bufX; - float *X; - cl_event event = NULL; - int ret = 0; - - const size_t N0 = 8, N1 = 8; - char platform_name[128]; - char device_name[128]; - - /* FFT library realted declarations */ - clfftPlanHandle planHandle; - clfftDim dim = CLFFT_2D; - size_t clLengths[2] = {N0, N1}; - - /* Setup OpenCL environment. */ - err = clGetPlatformIDs( 1, &platform, NULL ); - - size_t ret_param_size = 0; - err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, - sizeof(platform_name), platform_name, - &ret_param_size); - printf("Platform found: %s\n", platform_name); - - err = clGetDeviceIDs( platform, CL_DEVICE_TYPE_DEFAULT, 1, &device, NULL ); - - err = clGetDeviceInfo(device, CL_DEVICE_NAME, - sizeof(device_name), device_name, - &ret_param_size); - printf("Device found on the above platform: %s\n", device_name); - - props[1] = (cl_context_properties)platform; - ctx = clCreateContext( props, 1, &device, NULL, NULL, &err ); - queue = clCreateCommandQueue( ctx, device, 0, &err ); - - /* Setup clFFT. */ - clfftSetupData fftSetup; - err = clfftInitSetupData(&fftSetup); - err = clfftSetup(&fftSetup); - - /* Allocate host & initialize data. */ - /* Only allocation shown for simplicity. */ - size_t buffer_size = N0 * N1 * 2 * sizeof(*X); - X = (float *)malloc(buffer_size); - - /* print input array just using the - * indices to fill the array with data */ - printf("\nPerforming fft on an two dimensional array of size N0 x N1 : %lu x %lu\n", (unsigned long)N0, (unsigned long)N1); - size_t i, j; - - i = j = 0; - for (i=0; i -int main( void ) -{ - cl_int err; - cl_platform_id platform = 0; - cl_device_id device = 0; - cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 }; - cl_context ctx = 0; - cl_command_queue queue = 0; - cl_mem bufX; - float *X; - cl_event event = NULL; - int ret = 0; - - const size_t N0 = 4, N1 = 4, N2 = 4; - char platform_name[128]; - char device_name[128]; - - /* FFT library realted declarations */ - clfftPlanHandle planHandle; - clfftDim dim = CLFFT_3D; - size_t clLengths[3] = {N0, N1, N2}; - - /* Setup OpenCL environment. */ - err = clGetPlatformIDs( 1, &platform, NULL ); - - size_t ret_param_size = 0; - err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, - sizeof(platform_name), platform_name, - &ret_param_size); - printf("Platform found: %s\n", platform_name); - - err = clGetDeviceIDs( platform, CL_DEVICE_TYPE_DEFAULT, 1, &device, NULL ); - - err = clGetDeviceInfo(device, CL_DEVICE_NAME, - sizeof(device_name), device_name, - &ret_param_size); - printf("Device found on the above platform: %s\n", device_name); - - props[1] = (cl_context_properties)platform; - ctx = clCreateContext( props, 1, &device, NULL, NULL, &err ); - queue = clCreateCommandQueue( ctx, device, 0, &err ); - - /* Setup clFFT. */ - clfftSetupData fftSetup; - err = clfftInitSetupData(&fftSetup); - err = clfftSetup(&fftSetup); - - /* Allocate host & initialize data. */ - /* Only allocation shown for simplicity. */ - size_t buffer_size = N0 * N1 * N2 * 2 * sizeof(*X); - X = (float *)malloc(buffer_size); - - /* print input array just using the - * indices to fill the array with data */ - printf("\nPerforming fft on an two dimensional array of size N0 x N1 x N2 : %lu x %lu x %lu\n", (unsigned long)N0, (unsigned long)N1, (unsigned long)N2); - size_t i, j, k; - i = j = k = 0; - for (i=0; i Users should assume that this function will take a long time to execute. If a plan is not baked before being executed, - * users should assume that the first call to clAmdFftEnqueueTransform will take a long time to execute. - *

If any significant parameter of a plan is changed after the plan is baked (by a subsequent call to one of - * the clAmdFftSetPlan____ functions), that will not be considered an error. Instead, the plan will revert back to - * the unbaked state, discarding the benefits of the baking operation. - * @param[in] plHandle Handle to a plan previously created - * @param[in] numQueues Number of command queues in commQueueFFT; 0 is a valid value, in which case client does not want - * the runtime to run load experiments and only pre-calculate state information - * @param[in] commQueueFFT An array of cl_command_queues created by the client; the command queues must be a proper subset of - * the devices included in the plan context - * @param[in] pfn_notify A function pointer to a notification routine. The notification routine is a callback function that - * an application can register and which will be called when the program executable has been built (successfully or unsuccessfully). - * Currently, this parameter MUST be NULL or nullptr. - * @param[in] user_data Passed as an argument when pfn_notify is called. - * Currently, this parameter MUST be NULL or nullptr. - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftBakePlan( clAmdFftPlanHandle plHandle, cl_uint numQueues, cl_command_queue* commQueueFFT, - void (CL_CALLBACK *pfn_notify)(clAmdFftPlanHandle plHandle, void *user_data), void* user_data ) - { - return clfftBakePlan( plHandle, numQueues, commQueueFFT, pfn_notify, user_data ); - } - - /*! @brief Release the resources of a plan. - * @details A plan may include kernels, programs and buffers associated with it that consume memory. When a plan - * is not needed anymore, the client should release the plan. - * @param[in,out] plHandle Handle to a plan previously created - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftDestroyPlan( clAmdFftPlanHandle* plHandle ) - { - return clfftDestroyPlan( plHandle ); - } - - /*! @brief Retrieve the OpenCL context of a previously created plan. - * @details User should pass a reference to an cl_context variable, which will be changed to point to a - * context set in the specified plan. - * @param[in] plHandle Handle to a plan previously created - * @param[out] context Reference to user allocated cl_context, which will point to context set in plan - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftGetPlanContext( const clAmdFftPlanHandle plHandle, cl_context* context ) - { - return clfftGetPlanContext( plHandle, context ); - } - - /*! @brief Retrieve the floating point precision of the FFT data - * @details User should pass a reference to an clAmdFftPrecision variable, which will be set to the - * precision of the FFT complex data in the plan. - * @param[in] plHandle Handle to a plan previously created - * @param[out] precision Reference to user clAmdFftPrecision enum - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftGetPlanPrecision( const clAmdFftPlanHandle plHandle, clAmdFftPrecision* precision ) - { - return clfftGetPlanPrecision( plHandle, precision ); - } - - /*! @brief Set the floating point precision of the FFT data - * @details Set the plan property which will be the precision of the FFT complex data in the plan. - * @param[in] plHandle Handle to a plan previously created - * @param[in] precision Reference to user clAmdFftPrecision enum - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftSetPlanPrecision( clAmdFftPlanHandle plHandle, clAmdFftPrecision precision ) - { - return clfftSetPlanPrecision( plHandle, precision ); - } - - /*! @brief Retrieve the scaling factor that should be applied to the FFT data - * @details User should pass a reference to an cl_float variable, which will be set to the - * floating point scaling factor that will be multiplied across the FFT data. - * @param[in] plHandle Handle to a plan previously created - * @param[in] dir Which direction does the scaling factor apply to - * @param[out] scale Reference to user cl_float variable - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftGetPlanScale( const clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_float* scale ) - { - return clfftGetPlanScale( plHandle, dir, scale ); - } - - /*! @brief Set the scaling factor that should be applied to the FFT data - * @details Set the plan property which will be the floating point scaling factor that will be - * multiplied across the FFT data. - * @param[in] plHandle Handle to a plan previously created - * @param[in] dir Which direction does the scaling factor apply to - * @param[in] scale Reference to user cl_float variable - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftSetPlanScale( clAmdFftPlanHandle plHandle, clAmdFftDirection dir, cl_float scale ) - { - return clfftSetPlanScale( plHandle, dir, scale ); - } - - /*! @brief Retrieve the number of discrete arrays that this plan can handle concurrently - * @details User should pass a reference to an cl_uint variable, which will be set to the - * number of discrete arrays (1D or 2D) that will be batched together for this plan - * @param[in] plHandle Handle to a plan previously created - * @param[out] batchSize How many discrete number of FFT's are to be performed - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftGetPlanBatchSize( const clAmdFftPlanHandle plHandle, size_t* batchSize ) - { - return clfftGetPlanBatchSize( plHandle, batchSize ); - } - - /*! @brief Set the number of discrete arrays that this plan can handle concurrently - * @details Set the plan property which will be set to the number of discrete arrays (1D or 2D) - * that will be batched together for this plan - * @param[in] plHandle Handle to a plan previously created - * @param[in] batchSize How many discrete number of FFT's are to be performed - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftSetPlanBatchSize( clAmdFftPlanHandle plHandle, size_t batchSize ) - { - return clfftSetPlanBatchSize( plHandle, batchSize ); - } - - /*! @brief Retrieve the dimensionality of FFT's to be transformed in the plan - * @details Queries a plan object and retrieves the dimensionality that the plan is set for. A size is returned to - * help the client allocate the proper storage to hold the dimensions in a further call to clAmdFftGetPlanLength - * @param[in] plHandle Handle to a plan previously created - * @param[out] dim The dimensionality of the FFT's to be transformed - * @param[out] size Value used to allocate an array to hold the FFT dimensions. - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftGetPlanDim( const clAmdFftPlanHandle plHandle, clAmdFftDim* dim, cl_uint* size ) - { - return clfftGetPlanDim( plHandle, dim, size ); - } - - /*! @brief Set the dimensionality of FFT's to be transformed by the plan - * @details Set the dimensionality of FFT's to be transformed by the plan - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimensionality of the FFT's to be transformed - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftSetPlanDim( clAmdFftPlanHandle plHandle, const clAmdFftDim dim ) - { - return clfftSetPlanDim( plHandle, dim ); - } - - /*! @brief Retrieve the length of each dimension of the FFT - * @details User should pass a reference to a size_t array, which will be set to the - * length of each discrete dimension of the FFT - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimension of the length parameters; describes how many elements are in the array - * @param[out] clLengths An array of lengths, of size 'dim'. Each array value describes the length of each dimension - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftGetPlanLength( const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clLengths ) - { - return clfftGetPlanLength( plHandle, dim, clLengths ); - } - - /*! @brief Set the length of each dimension of the FFT - * @details Set the plan property which will be the length of each discrete dimension of the FFT - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimension of the length parameters; describes how many elements are in the array - * @param[in] clLengths An array of lengths, of size 'dim'. Each value describes the length of additional dimensions - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftSetPlanLength( clAmdFftPlanHandle plHandle, const clAmdFftDim dim, const size_t* clLengths ) - { - return clfftSetPlanLength( plHandle, dim, clLengths ); - } - - /*! @brief Retrieve the distance between consecutive elements for input buffers in a dimension. - * @details Depending on how the dimension is set in the plan (for 2D or 3D FFT's), strideY or strideZ can be safely - * ignored - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimension of the stride parameters; describes how many elements are in the array - * @param[out] clStrides An array of strides, of size 'dim'. - */ - __inline clAmdFftStatus clAmdFftGetPlanInStride( const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides ) - { - return clfftGetPlanInStride( plHandle, dim, clStrides ); - } - - /*! @brief Set the distance between consecutive elements for input buffers in a dimension. - * @details Set the plan properties which will be the distance between elements in a given dimension - * (units are in terms of clAmdFftPrecision) - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimension of the stride parameters; describes how many elements are in the array - * @param[in] clStrides An array of strides, of size 'dim'. Usually strideX=1 so that successive elements in the first dimension are stored contiguously. - * Typically strideY=LenX, strideZ=LenX*LenY such that successive elements in the second and third dimensions are stored in packed format. - * See @ref DistanceStridesandPitches for details. - */ - __inline clAmdFftStatus clAmdFftSetPlanInStride( clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides ) - { - return clfftSetPlanInStride( plHandle, dim, clStrides ); - } - - /*! @brief Retrieve the distance between consecutive elements for output buffers in a dimension. - * @details Depending on how the dimension is set in the plan (for 2D or 3D FFT's), strideY or strideZ can be safely - * ignored - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimension of the stride parameters; describes how many elements are in the array - * @param[out] clStrides An array of strides, of size 'dim'. - */ - __inline clAmdFftStatus clAmdFftGetPlanOutStride( const clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides ) - { - return clfftGetPlanOutStride( plHandle, dim, clStrides ); - } - - /*! @brief Set the distance between consecutive elements for output buffers in a dimension. - * @details Set the plan properties which will be the distance between elements in a given dimension - * (units are in terms of clAmdFftPrecision) - * @param[in] plHandle Handle to a plan previously created - * @param[in] dim The dimension of the stride parameters; describes how many elements are in the array - * @param[in] clStrides An array of strides, of size 'dim'. Usually strideX=1 so that successive elements in the first dimension are stored contiguously. - * Typically strideY=LenX, strideZ=LenX*LenY such that successive elements in the second and third dimensions are stored in packed format. - * @sa clAmdFftSetPlanInStride - */ - __inline clAmdFftStatus clAmdFftSetPlanOutStride( clAmdFftPlanHandle plHandle, const clAmdFftDim dim, size_t* clStrides ) - { - return clfftSetPlanOutStride( plHandle, dim, clStrides ); - } - - /*! @brief Retrieve the distance between Array objects - * @details Pitch is the distance between each discrete array object in an FFT array. This is only used - * for 'array' dimensions in clAmdFftDim; see clAmdFftSetPlanDimension (units are in terms of clAmdFftPrecision) - * @param[in] plHandle Handle to a plan previously created - * @param[out] iDist The distance between the beginning elements of the discrete array objects in memory on input. - * For contiguous arrays in memory, iDist=(strideX*strideY*strideZ) - * @param[out] oDist The distance between the beginning elements of the discrete array objects in memory on output. - * For contiguous arrays in memory, oDist=(strideX*strideY*strideZ) - */ - __inline clAmdFftStatus clAmdFftGetPlanDistance( const clAmdFftPlanHandle plHandle, size_t* iDist, size_t* oDist ) - { - return clfftGetPlanDistance( plHandle, iDist, oDist ); - } - - /*! @brief Set the distance between Array objects - * @details Pitch is the distance between each discrete array object in an FFT array. This is only used - * for 'array' dimensions in clAmdFftDim; see clAmdFftSetPlanDimension (units are in terms of clAmdFftPrecision) - * @param[in] plHandle Handle to a plan previously created - * @param[out] iDist The distance between the beginning elements of the discrete array objects in memory on input. - * For contiguous arrays in memory, iDist=(strideX*strideY*strideZ) - * @param[out] oDist The distance between the beginning elements of the discrete array objects in memory on output. - * For contiguous arrays in memory, oDist=(strideX*strideY*strideZ) - */ - __inline clAmdFftStatus clAmdFftSetPlanDistance( clAmdFftPlanHandle plHandle, size_t iDist, size_t oDist ) - { - return clfftSetPlanDistance( plHandle, iDist, oDist ); - } - - /*! @brief Retrieve the expected layout of the input and output buffers - * @details Output buffers can be filled with either hermitian or complex numbers. Complex numbers can be stored - * in various layouts; this informs the FFT engine what layout to produce on output - * @param[in] plHandle Handle to a plan previously created - * @param[out] iLayout Indicates how the input buffers are laid out in memory - * @param[out] oLayout Indicates how the output buffers are laid out in memory - */ - __inline clAmdFftStatus clAmdFftGetLayout( const clAmdFftPlanHandle plHandle, clAmdFftLayout* iLayout, clAmdFftLayout* oLayout ) - { - return clfftGetLayout( plHandle, iLayout, oLayout ); - } - - /*! @brief Set the expected layout of the input and output buffers - * @details Output buffers can be filled with either hermitian or complex numbers. Complex numbers can be stored - * in various layouts; this informs the FFT engine what layout to produce on output - * @param[in] plHandle Handle to a plan previously created - * @param[in] iLayout Indicates how the input buffers are laid out in memory - * @param[in] oLayout Indicates how the output buffers are laid out in memory - */ - __inline clAmdFftStatus clAmdFftSetLayout( clAmdFftPlanHandle plHandle, clAmdFftLayout iLayout, clAmdFftLayout oLayout ) - { - return clfftSetLayout( plHandle, iLayout, oLayout ); - } - - /*! @brief Retrieve whether the input buffers are going to be overwritten with results - * @details If the setting is to do an in-place transform, the input buffers are overwritten with the results of the - * transform. If the setting is for out-of-place transforms, the engine knows to look for separate output buffers - * on the Enqueue call. - * @param[in] plHandle Handle to a plan previously created - * @param[out] placeness Tells the FFT engine to clobber the input buffers or to expect output buffers for results - */ - __inline clAmdFftStatus clAmdFftGetResultLocation( const clAmdFftPlanHandle plHandle, clAmdFftResultLocation* placeness ) - { - return clfftGetResultLocation( plHandle, placeness ); - } - - /*! @brief Set whether the input buffers are going to be overwritten with results - * @details If the setting is to do an in-place transform, the input buffers are overwritten with the results of the - * transform. If the setting is for out-of-place transforms, the engine knows to look for separate output buffers - * on the Enqueue call. - * @param[in] plHandle Handle to a plan previously created - * @param[in] placeness Tells the FFT engine to clobber the input buffers or to expect output buffers for results - */ - __inline clAmdFftStatus clAmdFftSetResultLocation( clAmdFftPlanHandle plHandle, clAmdFftResultLocation placeness ) - { - return clfftSetResultLocation( plHandle, placeness ); - } - - /*! @brief Retrieve the final transpose setting of a muti-dimensional FFT - * @details A multi-dimensional FFT typically transposes the data several times during calculation. If the client - * does not care about the final transpose to put data back in proper dimension, the final transpose can be skipped - * for possible speed improvements - * @param[in] plHandle Handle to a plan previously created - * @param[out] transposed Parameter specifies whether the final transpose can be skipped - */ - __inline clAmdFftStatus clAmdFftGetPlanTransposeResult( const clAmdFftPlanHandle plHandle, clAmdFftResultTransposed * transposed ) - { - return clfftGetPlanTransposeResult( plHandle, transposed ); - } - - /*! @brief Set the final transpose setting of a muti-dimensional FFT - * @details A multi-dimensional FFT typically transposes the data several times during calculation. If the client - * does not care about the final transpose to put data back in proper dimension, the final transpose can be skipped - * for possible speed improvements - * @param[in] plHandle Handle to a plan previously created - * @param[in] transposed Parameter specifies whether the final transpose can be skipped - */ - __inline clAmdFftStatus clAmdFftSetPlanTransposeResult( clAmdFftPlanHandle plHandle, clAmdFftResultTransposed transposed ) - { - return clfftSetPlanTransposeResult( plHandle, transposed ); - } - - /*! @brief Get buffer size (in bytes), which may be needed internally for an intermediate buffer - * @details Very large FFT transforms may need multiple passes, and the operation would need a temporary buffer to hold - * intermediate results. This function is only valid after the plan is baked, otherwise an invalid operation error - * is returned. If buffersize returns as 0, the runtime needs no temporary buffer. - * @param[in] plHandle Handle to a plan previously created - * @param[out] buffersize Size in bytes for intermediate buffer - */ - __inline clAmdFftStatus clAmdFftGetTmpBufSize( const clAmdFftPlanHandle plHandle, size_t* buffersize ) - { - return clfftGetTmpBufSize( plHandle, buffersize ); - } - - /*! @brief Enqueue an FFT transform operation, and return immediately (non-blocking) - * @details This transform API is the function that actually computes the FFT transfrom. It is non-blocking as it - * only enqueues the OpenCL kernels for execution. The synchronization step has to be managed by the user. - * @param[in] plHandle Handle to a plan previously created - * @param[in] dir Forwards or backwards transform - * @param[in] numQueuesAndEvents Number of command queues in commQueues; number of expected events to be returned in outEvents - * @param[in] commQueues An array of cl_command_queues created by the client; the command queues must be a proper subset of - * the devices included in the plan context - * @param[in] numWaitEvents Specify the number of elements in the eventWaitList array - * @param[in] waitEvents Events that this transform should wait to complete before executing on the device - * @param[out] outEvents The runtime fills this array with events corresponding 1 to 1 with the input command queues passed - * in commQueues. This parameter can be NULL or nullptr, in which case client is not interested in receiving notifications - * when transforms are finished, otherwise if not NULL the client is responsible for allocating this array, with at least - * as many elements as specified in numQueuesAndEvents. - * @param[in] inputBuffers An array of cl_mem objects that contain data for processing by the FFT runtime. If the transform - * is in place, the FFT results will overwrite the input buffers - * @param[out] outputBuffers An array of cl_mem objects that will store the results of out of place transforms. If the transform - * is in place, this parameter may be NULL or nullptr. It is completely ignored - * @param[in] tmpBuffer A cl_mem object that is reserved as a temporary buffer for FFT processing. If clTmpBuffers is NULL or nullptr, - * and the runtime needs temporary storage, an internal temporary buffer will be created on the fly managed by the runtime. - * @return Enum describing error condition; superset of OpenCL error codes - */ - __inline clAmdFftStatus clAmdFftEnqueueTransform( - clAmdFftPlanHandle plHandle, - clAmdFftDirection dir, - cl_uint numQueuesAndEvents, - cl_command_queue* commQueues, - cl_uint numWaitEvents, - const cl_event* waitEvents, - cl_event* outEvents, - cl_mem* inputBuffers, - cl_mem* outputBuffers, - cl_mem tmpBuffer - ) - { - return clfftEnqueueTransform( plHandle, dir, numQueuesAndEvents, commQueues, numWaitEvents, waitEvents, outEvents, - inputBuffers, outputBuffers, tmpBuffer ); - } +/*! @brief Initialize an clAmdFftSetupData struct for the client + * @details clAmdFftSetupData is passed to clAmdFftSetup to control behavior of + * the FFT runtime + * @param[out] setupData Data structure is cleared, initialized with version + * information and default values + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftInitSetupData(clAmdFftSetupData *setupData) { + return clfftInitSetupData(setupData); +} + +/*! @brief Initialize internal FFT resources. + * @details AMD's FFT implementation caches kernels, programs and buffers for + * its internal use. + * @param[in] setupData Data structure that can be passed into the setup + * routine to control FFT generation behavior and debug functionality + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftSetup(const clAmdFftSetupData *setupData) { + return clfftSetup(setupData); +} + +/*! @brief Release all internal resources. + * @details Call when client is done with this FFT library, allowing the + * library to destroy all resources it has cached + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftTeardown() { return clfftTeardown(); } + +/*! @brief Query the FFT library for version information + * @details Return the major, minor and patch version numbers associated with + * this FFT library + * @param[out] major Major functionality change + * @param[out] minor Minor functionality change + * @param[out] patch Bug fixes, documentation changes, no new features + * introduced + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftGetVersion(cl_uint *major, cl_uint *minor, + cl_uint *patch) { + return clfftGetVersion(major, minor, patch); +} + +/*! @brief Create a plan object initialized entirely with default values. + * @details A plan is a repository of state for calculating FFT's. Allows the + * runtime to pre-calculate kernels, programs and buffers and associate them + * with buffers of specified dimensions. + * @param[out] plHandle Handle to the newly created plan + * @param[in] context Client is responsible for providing an OpenCL context for + * the plan + * @param[in] dim The dimensionality of the FFT transform; describes how many + * elements are in the array + * @param[in] clLengths An array of lengths, of size 'dim'. Each value + * describes the length of additional dimensions + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftCreateDefaultPlan(clAmdFftPlanHandle *plHandle, + cl_context context, + const clAmdFftDim dim, + const size_t *clLengths) { + return clfftCreateDefaultPlan(plHandle, context, dim, clLengths); +} + +/*! @brief Create a copy of an existing plan. + * @details This API allows a client to create a new plan based upon an + * existing plan. This is a convenience function provided for quickly creating + * plans that are similar, but may differ slightly. + * @param[out] out_plHandle Handle to the newly created plan that is based on + * in_plHandle + * @param[in] new_context Client is responsible for providing a new context for + * the new plan + * @param[in] in_plHandle Handle to a plan to be copied, previously created + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftCopyPlan(clAmdFftPlanHandle *out_plHandle, + cl_context new_context, + clAmdFftPlanHandle in_plHandle) { + return clfftCopyPlan(out_plHandle, new_context, in_plHandle); +} + +/*! @brief Prepare the plan for execution. + * @details After all plan parameters are set, the client has the option of + * 'baking' the plan, which tells the runtime that no more changes to the plan's + * parameters are expected, and the OpenCL kernels should be compiled. This + * optional function allows the client application to perform this function when + * the application is being initialized instead of on the first execution. At + * this point, the clAmdFft runtime will apply all implimented optimizations, + * possibly including running kernel experiments on the devices in the plan + * context.

Users should assume that this function will take a long time to + * execute. If a plan is not baked before being executed, users should assume + * that the first call to clAmdFftEnqueueTransform will take a long time to + * execute.

If any significant parameter of a plan is changed after the + * plan is baked (by a subsequent call to one of the clAmdFftSetPlan____ + * functions), that will not be considered an error. Instead, the plan will + * revert back to the unbaked state, discarding the benefits of the baking + * operation. + * @param[in] plHandle Handle to a plan previously created + * @param[in] numQueues Number of command queues in commQueueFFT; 0 is a valid + * value, in which case client does not want the runtime to run load experiments + * and only pre-calculate state information + * @param[in] commQueueFFT An array of cl_command_queues created by the client; + * the command queues must be a proper subset of the devices included in the + * plan context + * @param[in] pfn_notify A function pointer to a notification routine. The + * notification routine is a callback function that an application can register + * and which will be called when the program executable has been built + * (successfully or unsuccessfully). Currently, this parameter MUST be NULL or + * nullptr. + * @param[in] user_data Passed as an argument when pfn_notify is called. + * Currently, this parameter MUST be NULL or nullptr. + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftBakePlan( + clAmdFftPlanHandle plHandle, cl_uint numQueues, + cl_command_queue *commQueueFFT, + void(CL_CALLBACK *pfn_notify)(clAmdFftPlanHandle plHandle, void *user_data), + void *user_data) { + return clfftBakePlan(plHandle, numQueues, commQueueFFT, pfn_notify, + user_data); +} + +/*! @brief Release the resources of a plan. + * @details A plan may include kernels, programs and buffers associated with it + * that consume memory. When a plan is not needed anymore, the client should + * release the plan. + * @param[in,out] plHandle Handle to a plan previously created + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftDestroyPlan(clAmdFftPlanHandle *plHandle) { + return clfftDestroyPlan(plHandle); +} + +/*! @brief Retrieve the OpenCL context of a previously created plan. + * @details User should pass a reference to an cl_context variable, which will + * be changed to point to a context set in the specified plan. + * @param[in] plHandle Handle to a plan previously created + * @param[out] context Reference to user allocated cl_context, which will point + * to context set in plan + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus +clAmdFftGetPlanContext(const clAmdFftPlanHandle plHandle, cl_context *context) { + return clfftGetPlanContext(plHandle, context); +} + +/*! @brief Retrieve the floating point precision of the FFT data + * @details User should pass a reference to an clAmdFftPrecision variable, + * which will be set to the precision of the FFT complex data in the plan. + * @param[in] plHandle Handle to a plan previously created + * @param[out] precision Reference to user clAmdFftPrecision enum + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus +clAmdFftGetPlanPrecision(const clAmdFftPlanHandle plHandle, + clAmdFftPrecision *precision) { + return clfftGetPlanPrecision(plHandle, precision); +} + +/*! @brief Set the floating point precision of the FFT data + * @details Set the plan property which will be the precision of the FFT + * complex data in the plan. + * @param[in] plHandle Handle to a plan previously created + * @param[in] precision Reference to user clAmdFftPrecision enum + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftSetPlanPrecision(clAmdFftPlanHandle plHandle, + clAmdFftPrecision precision) { + return clfftSetPlanPrecision(plHandle, precision); +} + +/*! @brief Retrieve the scaling factor that should be applied to the FFT data + * @details User should pass a reference to an cl_float variable, which will be + * set to the floating point scaling factor that will be multiplied across the + * FFT data. + * @param[in] plHandle Handle to a plan previously created + * @param[in] dir Which direction does the scaling factor apply to + * @param[out] scale Reference to user cl_float variable + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftGetPlanScale(const clAmdFftPlanHandle plHandle, + clAmdFftDirection dir, + cl_float *scale) { + return clfftGetPlanScale(plHandle, dir, scale); +} + +/*! @brief Set the scaling factor that should be applied to the FFT data + * @details Set the plan property which will be the floating point scaling + * factor that will be multiplied across the FFT data. + * @param[in] plHandle Handle to a plan previously created + * @param[in] dir Which direction does the scaling factor apply to + * @param[in] scale Reference to user cl_float variable + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftSetPlanScale(clAmdFftPlanHandle plHandle, + clAmdFftDirection dir, + cl_float scale) { + return clfftSetPlanScale(plHandle, dir, scale); +} + +/*! @brief Retrieve the number of discrete arrays that this plan can handle + * concurrently + * @details User should pass a reference to an cl_uint variable, which will be + * set to the number of discrete arrays (1D or 2D) that will be batched together + * for this plan + * @param[in] plHandle Handle to a plan previously created + * @param[out] batchSize How many discrete number of FFT's are to be performed + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus +clAmdFftGetPlanBatchSize(const clAmdFftPlanHandle plHandle, size_t *batchSize) { + return clfftGetPlanBatchSize(plHandle, batchSize); +} + +/*! @brief Set the number of discrete arrays that this plan can handle + * concurrently + * @details Set the plan property which will be set to the number of discrete + * arrays (1D or 2D) that will be batched together for this plan + * @param[in] plHandle Handle to a plan previously created + * @param[in] batchSize How many discrete number of FFT's are to be performed + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftSetPlanBatchSize(clAmdFftPlanHandle plHandle, + size_t batchSize) { + return clfftSetPlanBatchSize(plHandle, batchSize); +} + +/*! @brief Retrieve the dimensionality of FFT's to be transformed in the plan + * @details Queries a plan object and retrieves the dimensionality that the + * plan is set for. A size is returned to help the client allocate the proper + * storage to hold the dimensions in a further call to clAmdFftGetPlanLength + * @param[in] plHandle Handle to a plan previously created + * @param[out] dim The dimensionality of the FFT's to be transformed + * @param[out] size Value used to allocate an array to hold the FFT dimensions. + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftGetPlanDim(const clAmdFftPlanHandle plHandle, + clAmdFftDim *dim, cl_uint *size) { + return clfftGetPlanDim(plHandle, dim, size); +} + +/*! @brief Set the dimensionality of FFT's to be transformed by the plan + * @details Set the dimensionality of FFT's to be transformed by the plan + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimensionality of the FFT's to be transformed + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftSetPlanDim(clAmdFftPlanHandle plHandle, + const clAmdFftDim dim) { + return clfftSetPlanDim(plHandle, dim); +} + +/*! @brief Retrieve the length of each dimension of the FFT + * @details User should pass a reference to a size_t array, which will be set + * to the length of each discrete dimension of the FFT + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimension of the length parameters; describes how many + * elements are in the array + * @param[out] clLengths An array of lengths, of size 'dim'. Each array value + * describes the length of each dimension + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftGetPlanLength(const clAmdFftPlanHandle plHandle, + const clAmdFftDim dim, + size_t *clLengths) { + return clfftGetPlanLength(plHandle, dim, clLengths); +} + +/*! @brief Set the length of each dimension of the FFT + * @details Set the plan property which will be the length of each discrete + * dimension of the FFT + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimension of the length parameters; describes how many + * elements are in the array + * @param[in] clLengths An array of lengths, of size 'dim'. Each value + * describes the length of additional dimensions + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftSetPlanLength(clAmdFftPlanHandle plHandle, + const clAmdFftDim dim, + const size_t *clLengths) { + return clfftSetPlanLength(plHandle, dim, clLengths); +} + +/*! @brief Retrieve the distance between consecutive elements for input buffers + * in a dimension. + * @details Depending on how the dimension is set in the plan (for 2D or 3D + * FFT's), strideY or strideZ can be safely ignored + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimension of the stride parameters; describes how many + * elements are in the array + * @param[out] clStrides An array of strides, of size 'dim'. + */ +__inline clAmdFftStatus +clAmdFftGetPlanInStride(const clAmdFftPlanHandle plHandle, + const clAmdFftDim dim, size_t *clStrides) { + return clfftGetPlanInStride(plHandle, dim, clStrides); +} + +/*! @brief Set the distance between consecutive elements for input buffers in a + * dimension. + * @details Set the plan properties which will be the distance between elements + * in a given dimension (units are in terms of clAmdFftPrecision) + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimension of the stride parameters; describes how many + * elements are in the array + * @param[in] clStrides An array of strides, of size 'dim'. Usually strideX=1 + * so that successive elements in the first dimension are stored contiguously. + * Typically strideY=LenX, strideZ=LenX*LenY such that successive elements + * in the second and third dimensions are stored in packed format. See @ref + * DistanceStridesandPitches for details. + */ +__inline clAmdFftStatus clAmdFftSetPlanInStride(clAmdFftPlanHandle plHandle, + const clAmdFftDim dim, + size_t *clStrides) { + return clfftSetPlanInStride(plHandle, dim, clStrides); +} + +/*! @brief Retrieve the distance between consecutive elements for output buffers + * in a dimension. + * @details Depending on how the dimension is set in the plan (for 2D or 3D + * FFT's), strideY or strideZ can be safely ignored + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimension of the stride parameters; describes how many + * elements are in the array + * @param[out] clStrides An array of strides, of size 'dim'. + */ +__inline clAmdFftStatus +clAmdFftGetPlanOutStride(const clAmdFftPlanHandle plHandle, + const clAmdFftDim dim, size_t *clStrides) { + return clfftGetPlanOutStride(plHandle, dim, clStrides); +} + +/*! @brief Set the distance between consecutive elements for output buffers in a + * dimension. + * @details Set the plan properties which will be the distance between elements + * in a given dimension (units are in terms of clAmdFftPrecision) + * @param[in] plHandle Handle to a plan previously created + * @param[in] dim The dimension of the stride parameters; describes how many + * elements are in the array + * @param[in] clStrides An array of strides, of size 'dim'. Usually strideX=1 + * so that successive elements in the first dimension are stored contiguously. + * Typically strideY=LenX, strideZ=LenX*LenY such that successive elements + * in the second and third dimensions are stored in packed format. + * @sa clAmdFftSetPlanInStride + */ +__inline clAmdFftStatus clAmdFftSetPlanOutStride(clAmdFftPlanHandle plHandle, + const clAmdFftDim dim, + size_t *clStrides) { + return clfftSetPlanOutStride(plHandle, dim, clStrides); +} + +/*! @brief Retrieve the distance between Array objects + * @details Pitch is the distance between each discrete array object in an FFT + * array. This is only used for 'array' dimensions in clAmdFftDim; see + * clAmdFftSetPlanDimension (units are in terms of clAmdFftPrecision) + * @param[in] plHandle Handle to a plan previously created + * @param[out] iDist The distance between the beginning elements of the + * discrete array objects in memory on input. For contiguous arrays in memory, + * iDist=(strideX*strideY*strideZ) + * @param[out] oDist The distance between the beginning elements of the + * discrete array objects in memory on output. For contiguous arrays in memory, + * oDist=(strideX*strideY*strideZ) + */ +__inline clAmdFftStatus +clAmdFftGetPlanDistance(const clAmdFftPlanHandle plHandle, size_t *iDist, + size_t *oDist) { + return clfftGetPlanDistance(plHandle, iDist, oDist); +} + +/*! @brief Set the distance between Array objects + * @details Pitch is the distance between each discrete array object in an FFT + * array. This is only used for 'array' dimensions in clAmdFftDim; see + * clAmdFftSetPlanDimension (units are in terms of clAmdFftPrecision) + * @param[in] plHandle Handle to a plan previously created + * @param[out] iDist The distance between the beginning elements of the + * discrete array objects in memory on input. For contiguous arrays in memory, + * iDist=(strideX*strideY*strideZ) + * @param[out] oDist The distance between the beginning elements of the + * discrete array objects in memory on output. For contiguous arrays in memory, + * oDist=(strideX*strideY*strideZ) + */ +__inline clAmdFftStatus clAmdFftSetPlanDistance(clAmdFftPlanHandle plHandle, + size_t iDist, size_t oDist) { + return clfftSetPlanDistance(plHandle, iDist, oDist); +} + +/*! @brief Retrieve the expected layout of the input and output buffers + * @details Output buffers can be filled with either hermitian or complex + * numbers. Complex numbers can be stored in various layouts; this informs the + * FFT engine what layout to produce on output + * @param[in] plHandle Handle to a plan previously created + * @param[out] iLayout Indicates how the input buffers are laid out in memory + * @param[out] oLayout Indicates how the output buffers are laid out in memory + */ +__inline clAmdFftStatus clAmdFftGetLayout(const clAmdFftPlanHandle plHandle, + clAmdFftLayout *iLayout, + clAmdFftLayout *oLayout) { + return clfftGetLayout(plHandle, iLayout, oLayout); +} + +/*! @brief Set the expected layout of the input and output buffers + * @details Output buffers can be filled with either hermitian or complex + * numbers. Complex numbers can be stored in various layouts; this informs the + * FFT engine what layout to produce on output + * @param[in] plHandle Handle to a plan previously created + * @param[in] iLayout Indicates how the input buffers are laid out in memory + * @param[in] oLayout Indicates how the output buffers are laid out in memory + */ +__inline clAmdFftStatus clAmdFftSetLayout(clAmdFftPlanHandle plHandle, + clAmdFftLayout iLayout, + clAmdFftLayout oLayout) { + return clfftSetLayout(plHandle, iLayout, oLayout); +} + +/*! @brief Retrieve whether the input buffers are going to be overwritten with + * results + * @details If the setting is to do an in-place transform, the input buffers + * are overwritten with the results of the transform. If the setting is for + * out-of-place transforms, the engine knows to look for separate output buffers + * on the Enqueue call. + * @param[in] plHandle Handle to a plan previously created + * @param[out] placeness Tells the FFT engine to clobber the input buffers or + * to expect output buffers for results + */ +__inline clAmdFftStatus +clAmdFftGetResultLocation(const clAmdFftPlanHandle plHandle, + clAmdFftResultLocation *placeness) { + return clfftGetResultLocation(plHandle, placeness); +} + +/*! @brief Set whether the input buffers are going to be overwritten with + * results + * @details If the setting is to do an in-place transform, the input buffers + * are overwritten with the results of the transform. If the setting is for + * out-of-place transforms, the engine knows to look for separate output buffers + * on the Enqueue call. + * @param[in] plHandle Handle to a plan previously created + * @param[in] placeness Tells the FFT engine to clobber the input buffers or to + * expect output buffers for results + */ +__inline clAmdFftStatus +clAmdFftSetResultLocation(clAmdFftPlanHandle plHandle, + clAmdFftResultLocation placeness) { + return clfftSetResultLocation(plHandle, placeness); +} + +/*! @brief Retrieve the final transpose setting of a muti-dimensional FFT + * @details A multi-dimensional FFT typically transposes the data several times + * during calculation. If the client does not care about the final transpose to + * put data back in proper dimension, the final transpose can be skipped for + * possible speed improvements + * @param[in] plHandle Handle to a plan previously created + * @param[out] transposed Parameter specifies whether the final transpose can + * be skipped + */ +__inline clAmdFftStatus +clAmdFftGetPlanTransposeResult(const clAmdFftPlanHandle plHandle, + clAmdFftResultTransposed *transposed) { + return clfftGetPlanTransposeResult(plHandle, transposed); +} + +/*! @brief Set the final transpose setting of a muti-dimensional FFT + * @details A multi-dimensional FFT typically transposes the data several times + * during calculation. If the client does not care about the final transpose to + * put data back in proper dimension, the final transpose can be skipped for + * possible speed improvements + * @param[in] plHandle Handle to a plan previously created + * @param[in] transposed Parameter specifies whether the final transpose can be + * skipped + */ +__inline clAmdFftStatus +clAmdFftSetPlanTransposeResult(clAmdFftPlanHandle plHandle, + clAmdFftResultTransposed transposed) { + return clfftSetPlanTransposeResult(plHandle, transposed); +} + +/*! @brief Get buffer size (in bytes), which may be needed internally for an + * intermediate buffer + * @details Very large FFT transforms may need multiple passes, and the + * operation would need a temporary buffer to hold intermediate results. This + * function is only valid after the plan is baked, otherwise an invalid + * operation error is returned. If buffersize returns as 0, the runtime needs no + * temporary buffer. + * @param[in] plHandle Handle to a plan previously created + * @param[out] buffersize Size in bytes for intermediate buffer + */ +__inline clAmdFftStatus clAmdFftGetTmpBufSize(const clAmdFftPlanHandle plHandle, + size_t *buffersize) { + return clfftGetTmpBufSize(plHandle, buffersize); +} + +/*! @brief Enqueue an FFT transform operation, and return immediately + *(non-blocking) + * @details This transform API is the function that actually computes the FFT + *transfrom. It is non-blocking as it only enqueues the OpenCL kernels for + *execution. The synchronization step has to be managed by the user. + * @param[in] plHandle Handle to a plan previously created + * @param[in] dir Forwards or backwards transform + * @param[in] numQueuesAndEvents Number of command queues in commQueues; number + *of expected events to be returned in outEvents + * @param[in] commQueues An array of cl_command_queues created by the client; + *the command queues must be a proper subset of the devices included in the plan + *context + * @param[in] numWaitEvents Specify the number of elements in the eventWaitList + *array + * @param[in] waitEvents Events that this transform should wait to complete + *before executing on the device + * @param[out] outEvents The runtime fills this array with events corresponding + *1 to 1 with the input command queues passed in commQueues. This parameter can + *be NULL or nullptr, in which case client is not interested in receiving + *notifications when transforms are finished, otherwise if not NULL the client + *is responsible for allocating this array, with at least as many elements as + *specified in numQueuesAndEvents. + * @param[in] inputBuffers An array of cl_mem objects that contain data for + *processing by the FFT runtime. If the transform is in place, the FFT results + *will overwrite the input buffers + * @param[out] outputBuffers An array of cl_mem objects that will store the + *results of out of place transforms. If the transform is in place, this + *parameter may be NULL or nullptr. It is completely ignored + * @param[in] tmpBuffer A cl_mem object that is reserved as a temporary buffer + *for FFT processing. If clTmpBuffers is NULL or nullptr, and the runtime needs + *temporary storage, an internal temporary buffer will be created on the fly + *managed by the runtime. + * @return Enum describing error condition; superset of OpenCL error codes + */ +__inline clAmdFftStatus clAmdFftEnqueueTransform( + clAmdFftPlanHandle plHandle, clAmdFftDirection dir, + cl_uint numQueuesAndEvents, cl_command_queue *commQueues, + cl_uint numWaitEvents, const cl_event *waitEvents, cl_event *outEvents, + cl_mem *inputBuffers, cl_mem *outputBuffers, cl_mem tmpBuffer) { + return clfftEnqueueTransform(plHandle, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, outEvents, + inputBuffers, outputBuffers, tmpBuffer); +} #ifdef __cplusplus } diff --git a/src/include/clAmdFft.version.h b/src/include/clAmdFft.version.h index ec9ef542..bfa3d23d 100644 --- a/src/include/clAmdFft.version.h +++ b/src/include/clAmdFft.version.h @@ -15,11 +15,13 @@ * ************************************************************************/ /*! @file clAmdFft.version.h - * /note clAmdFft.version.h is a deprecated header file. - * This header is provided to help projects that were written with the older clAmdFft codebase, to help them - * port to the new API at their own schedule. It will not be maintained or updated, and will be removed after - * a reasonable amount of time has passed. All new code should be written against clFFT.h. - * Older projects should migrate to the new header at their earliest convenience. + * /note clAmdFft.version.h is a deprecated header file. + * This header is provided to help projects that were written with the older + * clAmdFft codebase, to help them port to the new API at their own schedule. It + * will not be maintained or updated, and will be removed after a reasonable + * amount of time has passed. All new code should be written against clFFT.h. + * Older projects should migrate to the new header at their earliest + * convenience. */ /* the configured version and settings for clFFT diff --git a/src/include/clFFT.h b/src/include/clFFT.h index 66820008..d79dd7fa 100644 --- a/src/include/clFFT.h +++ b/src/include/clFFT.h @@ -14,617 +14,763 @@ * limitations under the License. * ************************************************************************/ - /*! @file clFFT.h - * clFFT.h defines all the public interfaces and types that are used by clFFT clients - * This is the only public header file that should be consumed by clFFT clients. It is written to adhere to native "C" - * interfaces to make clFFT library as portable as possible; it should be callable from C, C++, .NET and Fortran, - * either with the proper linking or using wrapper classes. + * clFFT.h defines all the public interfaces and types that are used by clFFT + * clients This is the only public header file that should be consumed by clFFT + * clients. It is written to adhere to native "C" interfaces to make clFFT + * library as portable as possible; it should be callable from C, C++, .NET and + * Fortran, either with the proper linking or using wrapper classes. * */ #pragma once -#if !defined( CLFFT_H ) +#if !defined(CLFFT_H) #define CLFFT_H #if defined(__APPLE__) || defined(__MACOSX) - #include +#include #else - #include +#include #endif #include "clFFT.version.h" /*! This preprocessor definition is the standard way to export APIs - * from a DLL simpler. All files within this DLL are compiled with the CLFFT_EXPORTS - * symbol defined on the command line. This symbol must not be defined on any project - * that uses this DLL. This ensures source files of any other project that include this file see - * clfft functions as being imported from a DLL, whereas the DLL sees symbols - * defined with this macro as being exported. - */ -#if defined( _WIN32 ) - #if !defined( __cplusplus ) - #define inline __inline - #endif - - #if defined( CLFFT_STATIC ) - #define CLFFTAPI - #elif defined( CLFFT_EXPORTS ) - #define CLFFTAPI __declspec( dllexport ) - #else - #define CLFFTAPI __declspec( dllimport ) - #endif + * from a DLL simpler. All files within this DLL are compiled with the + * CLFFT_EXPORTS symbol defined on the command line. This symbol must not be + * defined on any project that uses this DLL. This ensures source files of any + * other project that include this file see clfft functions as being imported + * from a DLL, whereas the DLL sees symbols defined with this macro as being + * exported. + */ +#if defined(_WIN32) +#if !defined(__cplusplus) +#define inline __inline +#endif + +#if defined(CLFFT_STATIC) +#define CLFFTAPI +#elif defined(CLFFT_EXPORTS) +#define CLFFTAPI __declspec(dllexport) +#else +#define CLFFTAPI __declspec(dllimport) +#endif #else - #define CLFFTAPI +#define CLFFTAPI #endif -/* In general, you cannot use namespaces for strict C compliance, so we prefix our public accessible names - * with the string clfft +/* In general, you cannot use namespaces for strict C compliance, so we + *prefix our public accessible names with the string clfft */ -/* All functions return pre-defined error codes, and do NOT throw exceptions to the caller. +/* All functions return pre-defined error codes, and do NOT throw + * exceptions to the caller. */ /*! @brief clfft error codes definition(incorporating OpenCL error definitions) * - * This enumeration is a superset of the OpenCL error codes. For example, CL_OUT_OF_HOST_MEMORY, - * which is defined in cl.h is aliased as CLFFT_OUT_OF_HOST_MEMORY. The set of basic OpenCL - * error codes is extended to add extra values specific to the clfft package. - */ -enum clfftStatus_ -{ - CLFFT_INVALID_GLOBAL_WORK_SIZE = CL_INVALID_GLOBAL_WORK_SIZE, - CLFFT_INVALID_MIP_LEVEL = CL_INVALID_MIP_LEVEL, - CLFFT_INVALID_BUFFER_SIZE = CL_INVALID_BUFFER_SIZE, - CLFFT_INVALID_GL_OBJECT = CL_INVALID_GL_OBJECT, - CLFFT_INVALID_OPERATION = CL_INVALID_OPERATION, - CLFFT_INVALID_EVENT = CL_INVALID_EVENT, - CLFFT_INVALID_EVENT_WAIT_LIST = CL_INVALID_EVENT_WAIT_LIST, - CLFFT_INVALID_GLOBAL_OFFSET = CL_INVALID_GLOBAL_OFFSET, - CLFFT_INVALID_WORK_ITEM_SIZE = CL_INVALID_WORK_ITEM_SIZE, - CLFFT_INVALID_WORK_GROUP_SIZE = CL_INVALID_WORK_GROUP_SIZE, - CLFFT_INVALID_WORK_DIMENSION = CL_INVALID_WORK_DIMENSION, - CLFFT_INVALID_KERNEL_ARGS = CL_INVALID_KERNEL_ARGS, - CLFFT_INVALID_ARG_SIZE = CL_INVALID_ARG_SIZE, - CLFFT_INVALID_ARG_VALUE = CL_INVALID_ARG_VALUE, - CLFFT_INVALID_ARG_INDEX = CL_INVALID_ARG_INDEX, - CLFFT_INVALID_KERNEL = CL_INVALID_KERNEL, - CLFFT_INVALID_KERNEL_DEFINITION = CL_INVALID_KERNEL_DEFINITION, - CLFFT_INVALID_KERNEL_NAME = CL_INVALID_KERNEL_NAME, - CLFFT_INVALID_PROGRAM_EXECUTABLE = CL_INVALID_PROGRAM_EXECUTABLE, - CLFFT_INVALID_PROGRAM = CL_INVALID_PROGRAM, - CLFFT_INVALID_BUILD_OPTIONS = CL_INVALID_BUILD_OPTIONS, - CLFFT_INVALID_BINARY = CL_INVALID_BINARY, - CLFFT_INVALID_SAMPLER = CL_INVALID_SAMPLER, - CLFFT_INVALID_IMAGE_SIZE = CL_INVALID_IMAGE_SIZE, - CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR = CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, - CLFFT_INVALID_MEM_OBJECT = CL_INVALID_MEM_OBJECT, - CLFFT_INVALID_HOST_PTR = CL_INVALID_HOST_PTR, - CLFFT_INVALID_COMMAND_QUEUE = CL_INVALID_COMMAND_QUEUE, - CLFFT_INVALID_QUEUE_PROPERTIES = CL_INVALID_QUEUE_PROPERTIES, - CLFFT_INVALID_CONTEXT = CL_INVALID_CONTEXT, - CLFFT_INVALID_DEVICE = CL_INVALID_DEVICE, - CLFFT_INVALID_PLATFORM = CL_INVALID_PLATFORM, - CLFFT_INVALID_DEVICE_TYPE = CL_INVALID_DEVICE_TYPE, - CLFFT_INVALID_VALUE = CL_INVALID_VALUE, - CLFFT_MAP_FAILURE = CL_MAP_FAILURE, - CLFFT_BUILD_PROGRAM_FAILURE = CL_BUILD_PROGRAM_FAILURE, - CLFFT_IMAGE_FORMAT_NOT_SUPPORTED = CL_IMAGE_FORMAT_NOT_SUPPORTED, - CLFFT_IMAGE_FORMAT_MISMATCH = CL_IMAGE_FORMAT_MISMATCH, - CLFFT_MEM_COPY_OVERLAP = CL_MEM_COPY_OVERLAP, - CLFFT_PROFILING_INFO_NOT_AVAILABLE = CL_PROFILING_INFO_NOT_AVAILABLE, - CLFFT_OUT_OF_HOST_MEMORY = CL_OUT_OF_HOST_MEMORY, - CLFFT_OUT_OF_RESOURCES = CL_OUT_OF_RESOURCES, - CLFFT_MEM_OBJECT_ALLOCATION_FAILURE = CL_MEM_OBJECT_ALLOCATION_FAILURE, - CLFFT_COMPILER_NOT_AVAILABLE = CL_COMPILER_NOT_AVAILABLE, - CLFFT_DEVICE_NOT_AVAILABLE = CL_DEVICE_NOT_AVAILABLE, - CLFFT_DEVICE_NOT_FOUND = CL_DEVICE_NOT_FOUND, - CLFFT_SUCCESS = CL_SUCCESS, - //-------------------------- Extended status codes for clfft ---------------------------------------- - CLFFT_BUGCHECK = 4*1024, /*!< Bugcheck. */ - CLFFT_NOTIMPLEMENTED, /*!< Functionality is not implemented yet. */ - CLFFT_TRANSPOSED_NOTIMPLEMENTED, /*!< Transposed functionality is not implemented for this transformation. */ - CLFFT_FILE_NOT_FOUND, /*!< Tried to open an existing file on the host system, but failed. */ - CLFFT_FILE_CREATE_FAILURE, /*!< Tried to create a file on the host system, but failed. */ - CLFFT_VERSION_MISMATCH, /*!< Version conflict between client and library. */ - CLFFT_INVALID_PLAN, /*!< Requested plan could not be found. */ - CLFFT_DEVICE_NO_DOUBLE, /*!< Double precision not supported on this device. */ - CLFFT_DEVICE_MISMATCH, /*!< Attempt to run on a device using a plan baked for a different device. */ - CLFFT_ENDSTATUS /* The last value of the enum, and marks the length of clfftStatus. */ + * This enumeration is a superset of the OpenCL error codes. For example, + * CL_OUT_OF_HOST_MEMORY, which is defined in cl.h is aliased as + * CLFFT_OUT_OF_HOST_MEMORY. The set of basic OpenCL error codes is extended to + * add extra values specific to the clfft package. + */ +enum clfftStatus_ { + CLFFT_INVALID_GLOBAL_WORK_SIZE = CL_INVALID_GLOBAL_WORK_SIZE, + CLFFT_INVALID_MIP_LEVEL = CL_INVALID_MIP_LEVEL, + CLFFT_INVALID_BUFFER_SIZE = CL_INVALID_BUFFER_SIZE, + CLFFT_INVALID_GL_OBJECT = CL_INVALID_GL_OBJECT, + CLFFT_INVALID_OPERATION = CL_INVALID_OPERATION, + CLFFT_INVALID_EVENT = CL_INVALID_EVENT, + CLFFT_INVALID_EVENT_WAIT_LIST = CL_INVALID_EVENT_WAIT_LIST, + CLFFT_INVALID_GLOBAL_OFFSET = CL_INVALID_GLOBAL_OFFSET, + CLFFT_INVALID_WORK_ITEM_SIZE = CL_INVALID_WORK_ITEM_SIZE, + CLFFT_INVALID_WORK_GROUP_SIZE = CL_INVALID_WORK_GROUP_SIZE, + CLFFT_INVALID_WORK_DIMENSION = CL_INVALID_WORK_DIMENSION, + CLFFT_INVALID_KERNEL_ARGS = CL_INVALID_KERNEL_ARGS, + CLFFT_INVALID_ARG_SIZE = CL_INVALID_ARG_SIZE, + CLFFT_INVALID_ARG_VALUE = CL_INVALID_ARG_VALUE, + CLFFT_INVALID_ARG_INDEX = CL_INVALID_ARG_INDEX, + CLFFT_INVALID_KERNEL = CL_INVALID_KERNEL, + CLFFT_INVALID_KERNEL_DEFINITION = CL_INVALID_KERNEL_DEFINITION, + CLFFT_INVALID_KERNEL_NAME = CL_INVALID_KERNEL_NAME, + CLFFT_INVALID_PROGRAM_EXECUTABLE = CL_INVALID_PROGRAM_EXECUTABLE, + CLFFT_INVALID_PROGRAM = CL_INVALID_PROGRAM, + CLFFT_INVALID_BUILD_OPTIONS = CL_INVALID_BUILD_OPTIONS, + CLFFT_INVALID_BINARY = CL_INVALID_BINARY, + CLFFT_INVALID_SAMPLER = CL_INVALID_SAMPLER, + CLFFT_INVALID_IMAGE_SIZE = CL_INVALID_IMAGE_SIZE, + CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR = CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, + CLFFT_INVALID_MEM_OBJECT = CL_INVALID_MEM_OBJECT, + CLFFT_INVALID_HOST_PTR = CL_INVALID_HOST_PTR, + CLFFT_INVALID_COMMAND_QUEUE = CL_INVALID_COMMAND_QUEUE, + CLFFT_INVALID_QUEUE_PROPERTIES = CL_INVALID_QUEUE_PROPERTIES, + CLFFT_INVALID_CONTEXT = CL_INVALID_CONTEXT, + CLFFT_INVALID_DEVICE = CL_INVALID_DEVICE, + CLFFT_INVALID_PLATFORM = CL_INVALID_PLATFORM, + CLFFT_INVALID_DEVICE_TYPE = CL_INVALID_DEVICE_TYPE, + CLFFT_INVALID_VALUE = CL_INVALID_VALUE, + CLFFT_MAP_FAILURE = CL_MAP_FAILURE, + CLFFT_BUILD_PROGRAM_FAILURE = CL_BUILD_PROGRAM_FAILURE, + CLFFT_IMAGE_FORMAT_NOT_SUPPORTED = CL_IMAGE_FORMAT_NOT_SUPPORTED, + CLFFT_IMAGE_FORMAT_MISMATCH = CL_IMAGE_FORMAT_MISMATCH, + CLFFT_MEM_COPY_OVERLAP = CL_MEM_COPY_OVERLAP, + CLFFT_PROFILING_INFO_NOT_AVAILABLE = CL_PROFILING_INFO_NOT_AVAILABLE, + CLFFT_OUT_OF_HOST_MEMORY = CL_OUT_OF_HOST_MEMORY, + CLFFT_OUT_OF_RESOURCES = CL_OUT_OF_RESOURCES, + CLFFT_MEM_OBJECT_ALLOCATION_FAILURE = CL_MEM_OBJECT_ALLOCATION_FAILURE, + CLFFT_COMPILER_NOT_AVAILABLE = CL_COMPILER_NOT_AVAILABLE, + CLFFT_DEVICE_NOT_AVAILABLE = CL_DEVICE_NOT_AVAILABLE, + CLFFT_DEVICE_NOT_FOUND = CL_DEVICE_NOT_FOUND, + CLFFT_SUCCESS = CL_SUCCESS, + //-------------------------- Extended status codes for clfft + //---------------------------------------- + CLFFT_BUGCHECK = 4 * 1024, /*!< Bugcheck. */ + CLFFT_NOTIMPLEMENTED, /*!< Functionality is not implemented yet. */ + CLFFT_TRANSPOSED_NOTIMPLEMENTED, /*!< Transposed functionality is not + implemented for this transformation. */ + CLFFT_FILE_NOT_FOUND, /*!< Tried to open an existing file on the host system, + but failed. */ + CLFFT_FILE_CREATE_FAILURE, /*!< Tried to create a file on the host system, but + failed. */ + CLFFT_VERSION_MISMATCH, /*!< Version conflict between client and library. */ + CLFFT_INVALID_PLAN, /*!< Requested plan could not be found. */ + CLFFT_DEVICE_NO_DOUBLE, /*!< Double precision not supported on this device. */ + CLFFT_DEVICE_MISMATCH, /*!< Attempt to run on a device using a plan baked for + a different device. */ + CLFFT_ENDSTATUS /* The last value of the enum, and marks the length of + clfftStatus. */ }; typedef enum clfftStatus_ clfftStatus; -/*! @brief The dimension of the input and output buffers that is fed into all FFT transforms */ -typedef enum clfftDim_ -{ - CLFFT_1D = 1, /*!< 1 Dimensional FFT transform (default). */ - CLFFT_2D, /*!< 2 Dimensional FFT transform. */ - CLFFT_3D, /*!< 3 Dimensional FFT transform. */ - ENDDIMENSION /*!< The last value of the enum, and marks the length of clfftDim. */ +/*! @brief The dimension of the input and output buffers that is fed into all + * FFT transforms */ +typedef enum clfftDim_ { + CLFFT_1D = 1, /*!< 1 Dimensional FFT transform (default). */ + CLFFT_2D, /*!< 2 Dimensional FFT transform. */ + CLFFT_3D, /*!< 3 Dimensional FFT transform. */ + ENDDIMENSION /*!< The last value of the enum, and marks the length of + clfftDim. */ } clfftDim; /*! @brief Specify the expected layouts of the buffers */ -typedef enum clfftLayout_ -{ - CLFFT_COMPLEX_INTERLEAVED = 1, /*!< An array of complex numbers, with real and imaginary components together (default). */ - CLFFT_COMPLEX_PLANAR, /*!< Separate arrays of real components and imaginary components. */ - CLFFT_HERMITIAN_INTERLEAVED, /*!< Compressed form of complex numbers; complex-conjugates are not stored, real and imaginary components are stored in the same array. */ - CLFFT_HERMITIAN_PLANAR, /*!< Compressed form of complex numbers; complex-conjugates are not stored, real and imaginary components are stored in separate arrays. */ - CLFFT_REAL, /*!< An array of real numbers, with no corresponding imaginary components. */ - ENDLAYOUT /*!< The last value of the enum, and marks the length of clfftLayout. */ +typedef enum clfftLayout_ { + CLFFT_COMPLEX_INTERLEAVED = 1, /*!< An array of complex numbers, with real and + imaginary components together (default). */ + CLFFT_COMPLEX_PLANAR, /*!< Separate arrays of real components and imaginary + components. */ + CLFFT_HERMITIAN_INTERLEAVED, /*!< Compressed form of complex numbers; + complex-conjugates are not stored, real and + imaginary components are stored in the same + array. */ + CLFFT_HERMITIAN_PLANAR, /*!< Compressed form of complex numbers; + complex-conjugates are not stored, real and + imaginary components are stored in separate arrays. + */ + CLFFT_REAL, /*!< An array of real numbers, with no corresponding imaginary + components. */ + ENDLAYOUT /*!< The last value of the enum, and marks the length of + clfftLayout. */ } clfftLayout; /*! @brief Specify the expected precision of each FFT. */ -typedef enum clfftPrecision_ -{ - CLFFT_SINGLE = 1, /*!< An array of complex numbers, with real and imaginary components saved as floats (default). */ - CLFFT_DOUBLE, /*!< An array of complex numbers, with real and imaginary components saved as doubles. */ - CLFFT_SINGLE_FAST, /*!< Faster implementation preferred. */ - CLFFT_DOUBLE_FAST, /*!< Faster implementation preferred. */ - ENDPRECISION /*!< The last value of the enum, and marks the length of clfftPrecision. */ +typedef enum clfftPrecision_ { + CLFFT_SINGLE = 1, /*!< An array of complex numbers, with real and imaginary + components saved as floats (default). */ + CLFFT_DOUBLE, /*!< An array of complex numbers, with real and imaginary + components saved as doubles. */ + CLFFT_SINGLE_FAST, /*!< Faster implementation preferred. */ + CLFFT_DOUBLE_FAST, /*!< Faster implementation preferred. */ + ENDPRECISION /*!< The last value of the enum, and marks the length of + clfftPrecision. */ } clfftPrecision; -/*! @brief Specify the expected direction of each FFT, time or the frequency domains */ -typedef enum clfftDirection_ -{ - CLFFT_FORWARD = -1, /*!< FFT transform from time to frequency domain. */ - CLFFT_BACKWARD = 1, /*!< FFT transform from frequency to time domain. */ - CLFFT_MINUS = -1, /*!< Alias for the forward transform. */ - CLFFT_PLUS = 1, /*!< Alias for the backward transform. */ - ENDDIRECTION /*!< The last value of the enum, and marks the length of clfftDirection. */ +/*! @brief Specify the expected direction of each FFT, time or the frequency + * domains */ +typedef enum clfftDirection_ { + CLFFT_FORWARD = -1, /*!< FFT transform from time to frequency domain. */ + CLFFT_BACKWARD = 1, /*!< FFT transform from frequency to time domain. */ + CLFFT_MINUS = -1, /*!< Alias for the forward transform. */ + CLFFT_PLUS = 1, /*!< Alias for the backward transform. */ + ENDDIRECTION /*!< The last value of the enum, and marks the length of + clfftDirection. */ } clfftDirection; /*! @brief Specify wheter the input buffers are overwritten with results */ -typedef enum clfftResultLocation_ -{ - CLFFT_INPLACE = 1, /*!< Input and output buffers are the same (default). */ - CLFFT_OUTOFPLACE, /*!< Input and output buffers are separate. */ - ENDPLACE /*!< The last value of the enum, and marks the length of clfftPlaceness. */ +typedef enum clfftResultLocation_ { + CLFFT_INPLACE = 1, /*!< Input and output buffers are the same (default). */ + CLFFT_OUTOFPLACE, /*!< Input and output buffers are separate. */ + ENDPLACE /*!< The last value of the enum, and marks the length of + clfftPlaceness. */ } clfftResultLocation; -/*! @brief Determines whether the result is returned in original order. It is valid only for -dimensions greater than 1. */ +/*! @brief Determines whether the result is returned in original order. It is +valid only for dimensions greater than 1. */ typedef enum clfftResultTransposed_ { - CLFFT_NOTRANSPOSE = 1, /*!< The result is returned in the original order (default) */ - CLFFT_TRANSPOSED, /*!< The result is transposed where transpose kernel is supported (possibly faster) */ - ENDTRANSPOSED /*!< The last value of the enum, and marks the length of clfftResultTransposed */ + CLFFT_NOTRANSPOSE = + 1, /*!< The result is returned in the original order (default) */ + CLFFT_TRANSPOSED, /*!< The result is transposed where transpose kernel is + supported (possibly faster) */ + ENDTRANSPOSED /*!< The last value of the enum, and marks the length of + clfftResultTransposed */ } clfftResultTransposed; /*! BitMasks to be used with clfftSetupData.debugFlags */ #define CLFFT_DUMP_PROGRAMS 0x1 -/*! @brief Data structure that can be passed to clfftSetup() to control the behavior of the FFT runtime - * @details This structure contains values that can be initialized before instantiation of the FFT runtime - * with ::clfftSetup(). To initialize this structure, pass a pointer to a user struct to ::clfftInitSetupData( ), - * which clears the structure and sets the version member variables to the current values. - */ -struct clfftSetupData_ -{ - cl_uint major; /*!< Major version number of the project; signifies possible major API changes. */ - cl_uint minor; /*!< Minor version number of the project; minor API changes that can break backward compatibility. */ - cl_uint patch; /*!< Patch version number of the project; always incrementing number, signifies change over time. */ - - /*! Bitwise flags that control the behavior of library debug logic. */ - cl_ulong debugFlags; /*! This must be set to zero, except when debugging the clfft library. - *

debugFlags can be set to CLFFT_DUMP_PROGRAMS, in which case the dynamically generated OpenCL kernels are - * written to text files in the current working directory. These files have a *.cl suffix. - */ +/*! @brief Data structure that can be passed to clfftSetup() to control the + * behavior of the FFT runtime + * @details This structure contains values that can be initialized before + * instantiation of the FFT runtime with ::clfftSetup(). To initialize this + * structure, pass a pointer to a user struct to ::clfftInitSetupData( ), which + * clears the structure and sets the version member variables to the current + * values. + */ +struct clfftSetupData_ { + cl_uint major; /*!< Major version number of the project; signifies possible + major API changes. */ + cl_uint minor; /*!< Minor version number of the project; minor API changes + that can break backward compatibility. */ + cl_uint patch; /*!< Patch version number of the project; always incrementing + number, signifies change over time. */ + + /*! Bitwise flags that control the behavior of library debug logic. */ + cl_ulong + debugFlags; /*! This must be set to zero, except when debugging the clfft + * library.

debugFlags can be set to CLFFT_DUMP_PROGRAMS, + * in which case the dynamically generated OpenCL kernels are + * written to text files in the current working directory. + * These files have a *.cl suffix. + */ }; typedef struct clfftSetupData_ clfftSetupData; /*! @brief Type of Callback function. -*/ -typedef enum clfftCallbackType_ -{ - PRECALLBACK, /*!< Callback function is invoked only once for every point of input at the beginning of FFT transform. */ - POSTCALLBACK /*!< Callback function is invoked only once for every point of output at the end of FFT transform. */ -}clfftCallbackType; - -/*! @brief An abstract handle to the object that represents the state of the FFT(s) */ + */ +typedef enum clfftCallbackType_ { + PRECALLBACK, /*!< Callback function is invoked only once for every point of + input at the beginning of FFT transform. */ + POSTCALLBACK /*!< Callback function is invoked only once for every point of + output at the end of FFT transform. */ +} clfftCallbackType; + +/*! @brief An abstract handle to the object that represents the state of the + * FFT(s) */ typedef size_t clfftPlanHandle; #ifdef __cplusplus extern "C" { #endif - /*! @brief Initialize a clfftSetupData struct for the client - * @details clfftSetupData is passed to clfftSetup to control behavior of the FFT runtime. - * @param[out] setupData Data structure is cleared and initialized with version information and default values - * @return Enum describes the error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftInitSetupData( clfftSetupData* setupData ); - - - /*! @brief Initialize the internal FFT resources. - * @details The internal resources include FFT implementation caches kernels, programs, and buffers. - * @param[in] setupData Data structure that is passed into the setup routine to control FFT generation behavior - * and debug functionality - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetup( const clfftSetupData* setupData ); - - /*! @brief Release all internal resources. - * @details Called when client is done with the FFT library, allowing the library to destroy all resources it has cached - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftTeardown( ); - - /*! @brief Query the FFT library for version information - * @details Returns the major, minor and patch version numbers associated with the FFT library - * @param[out] major Major functionality change - * @param[out] minor Minor functionality change - * @param[out] patch Bug fixes, documentation changes, no new features introduced - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetVersion( cl_uint* major, cl_uint* minor, cl_uint* patch ); - - /*! @brief Create a plan object initialized entirely with default values. - * @details A plan is a repository of state for calculating FFT's. Allows the runtime to pre-calculate kernels, programs - * and buffers and associate them with buffers of specified dimensions. - * @param[out] plHandle Handle to the newly created plan - * @param[in] context Client is responsible for providing an OpenCL context for the plan - * @param[in] dim Dimensionality of the FFT transform; describes how many elements are in the array - * @param[in] clLengths An array of length of size 'dim'; each array value describes the length of each dimension - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftCreateDefaultPlan( clfftPlanHandle* plHandle, cl_context context, const clfftDim dim, - const size_t* clLengths ); - - /*! @brief Create a copy of an existing plan. - * @details This API allows a client to create a new plan based upon an existing plan. This function can be used to - * quickly create plans that are similar, but may differ slightly. - * @param[out] out_plHandle Handle to the newly created plan that is based on in_plHandle - * @param[in] new_context Client is responsible for providing a new context for the new plan - * @param[in] in_plHandle Handle to a previously created plan that is to be copied - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftCopyPlan( clfftPlanHandle* out_plHandle, cl_context new_context, clfftPlanHandle in_plHandle ); - - /*! @brief Prepare the plan for execution. - * @details After all plan parameters are set, the client has the option of 'baking' the plan, which informs the runtime that - * no more change to the parameters of the plan is expected, and the OpenCL kernels can be compiled. This optional function - * allows the client application to perform the OpenCL kernel compilation when the application is initialized instead of during the first - * execution. - * At this point, the clfft runtime applies all implimented optimizations, including - * running kernel experiments on the devices in the plan context. - *

This function takes a long time to execute. If a plan is not baked before being executed, - * the first call to clfftEnqueueTransform takes a long time to execute. - *

If any significant parameter of a plan is changed after the plan is baked (by a subsequent call to any one of - * the functions that has the prefix "clfftSetPlan"), it is not considered an error. Instead, the plan reverts back to - * the unbaked state, discarding the benefits of the baking operation. - * @param[in] plHandle Handle to a previously created plan - * @param[in] numQueues Number of command queues in commQueueFFT; 0 is a valid value, in which case the client does not want - * the runtime to run load experiments and only pre-calculate state information - * @param[in] commQueueFFT An array of cl_command_queues created by the client; the command queues must be a proper subset of - * the devices included in the plan context - * @param[in] pfn_notify A function pointer to a notification routine. The notification routine is a callback function that - * an application can register and is called when the program executable is built (successfully or unsuccessfully). - * Currently, this parameter MUST be NULL or nullptr. - * @param[in] user_data Passed as an argument when pfn_notify is called. - * Currently, this parameter MUST be NULL or nullptr. - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftBakePlan( clfftPlanHandle plHandle, cl_uint numQueues, cl_command_queue* commQueueFFT, - void (CL_CALLBACK *pfn_notify)(clfftPlanHandle plHandle, void *user_data), void* user_data ); - - /*! @brief Release the resources of a plan. - * @details A plan may include resources, such as kernels, programs, and buffers that consume memory. When a plan - * is no more needed, the client must release the plan. - * @param[in,out] plHandle Handle to a previously created plan - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftDestroyPlan( clfftPlanHandle* plHandle ); - - /*! @brief Retrieve the OpenCL context of a previously created plan. - * @details The user must pass a reference to a cl_context variable, which is modified to point to a - * context set in the specified plan. - * @param[in] plHandle Handle to a previously created plan - * @param[out] context Reference to the user allocated cl_context, which points to context set in the plan - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanContext( const clfftPlanHandle plHandle, cl_context* context ); - - /*! @brief Retrieve the floating point precision of the FFT data - * @details The user must pass a reference to a clfftPrecision variable, which is set to the - * precision of the FFT complex data in the plan. - * @param[in] plHandle Handle to a previously created plan - * @param[out] precision Reference to the user clfftPrecision enum - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanPrecision( const clfftPlanHandle plHandle, clfftPrecision* precision ); - - /*! @brief Set the floating point precision of the FFT data - * @details Sets the floating point precision of the FFT complex data in the plan. - * @param[in] plHandle Handle to a previously created plan - * @param[in] precision Reference to the user clfftPrecision enum - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanPrecision( clfftPlanHandle plHandle, clfftPrecision precision ); - - /*! @brief Set the offset in number of elements for the input array - * @details Sets the plan property which sets offset in number elements for the input array - * @param[in] plHandle Handle to a previously created plan - * @param[in] offset size - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanOffsetIn( clfftPlanHandle plHandle, size_t offsetIn ); - - /*! @brief Retrieve the offset in number of elements for the input array - * @details Queries a plan object and retrieves the value of the offset in number of elements for the input array - * @param[in] plHandle Handle to a previously created plan - * @param[out] offset size - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanOffsetIn( const clfftPlanHandle plHandle, size_t* offsetIn ); - - /*! @brief Retrieve the offset in number of elements for the output array - * @details Queries a plan object and retrieves the value of the offset in number of elements for the input array - * @param[in] plHandle Handle to a previously created plan - * @param[out] offset size - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanOffsetOut( clfftPlanHandle plHandle, size_t offsetOut ); - - /*! @brief Retrieve the offset in number of elements for the output array - * @details Queries a plan object and retrieves the value of the offset in number of elements for the input array - * @param[in] plHandle Handle to a previously created plan - * @param[out] offset size - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanOffsetOut( const clfftPlanHandle plHandle, size_t* offsetOut ); - - /*! @brief Retrieve the scaling factor that is applied to the FFT data - * @details The user must pass a reference to a cl_float variable, which is set to the - * floating point scaling factor that is multiplied across the FFT data. - * @param[in] plHandle Handle to a previously created plan - * @param[in] dir Direction of the applied scaling factor - * @param[out] scale Reference to the user cl_float variable - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanScale( const clfftPlanHandle plHandle, clfftDirection dir, cl_float* scale ); - - /*! @brief Set the scaling factor that is applied to the FFT data - * @details Sets the floating point scaling factor that is - * multiplied across the FFT data. - * @param[in] plHandle Handle to a previously created plan - * @param[in] dir Direction of the applied scaling factor - * @param[in] scale Reference to the user cl_float variable - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanScale( clfftPlanHandle plHandle, clfftDirection dir, cl_float scale ); - - /*! @brief Retrieve the number of discrete arrays that the plan can concurrently handle - * @details The user must pass a reference to a cl_uint variable, which is set to the - * number of discrete arrays (1D or 2D) that is batched together for the plan - * @param[in] plHandle Handle to a previously created plan - * @param[out] batchSize Number of discrete FFTs performed - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanBatchSize( const clfftPlanHandle plHandle, size_t* batchSize ); - - /*! @brief Set the number of discrete arrays that the plan can concurrently handle - * @details Sets the plan property which sets the number of discrete arrays (1D or 2D) - * that is batched together for the plan - * @param[in] plHandle Handle to a previously created plan - * @param[in] batchSize Number of discrete FFTs performed - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanBatchSize( clfftPlanHandle plHandle, size_t batchSize ); - - /*! @brief Retrieve the dimensionality of the data that is transformed - * @details Queries a plan object and retrieves the value of the dimensionality that the plan is set for. A size is returned to - * help the client allocate sufficient storage to hold the dimensions in a further call to clfftGetPlanLength - * @param[in] plHandle Handle to a previously created plan - * @param[out] dim The dimensionality of the FFT to be transformed - * @param[out] size Value to allocate an array to hold the FFT dimensions. - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanDim( const clfftPlanHandle plHandle, clfftDim* dim, cl_uint* size ); - - /*! @brief Set the dimensionality of the data that is transformed - * @details Set the dimensionality of the data that is transformed by the plan - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim The dimensionality of the FFT to be transformed - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanDim( clfftPlanHandle plHandle, const clfftDim dim ); - - /*! @brief Retrieve the length of each dimension of the FFT - * @details The user must pass a reference to a size_t array, which is set to the - * length of each discrete dimension of the FFT - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim Dimension of the FFT; describes how many elements are in the clLengths array - * @param[out] clLengths An array of length of size 'dim'; each array value describes the length of each dimension - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftGetPlanLength( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clLengths ); - - /*! @brief Set the length of each dimension of the FFT - * @details Sets the plan property which is the length of each discrete dimension of the FFT - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim The dimension of the FFT; describes how many elements are in the clLengths array - * @param[in] clLengths An array of length of size 'dim'; each array value describes the length of each dimension - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftSetPlanLength( clfftPlanHandle plHandle, const clfftDim dim, const size_t* clLengths ); - - /*! @brief Retrieve the distance between consecutive elements of input buffers in each dimension. - * @details Depending on how the dimension is set in the plan (for 2D or 3D FFT), strideY or strideZ can be safely - * ignored - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim The dimension of the stride parameters; provides the number of elements in the array - * @param[out] clStrides An array of strides, of size 'dim'. - */ - CLFFTAPI clfftStatus clfftGetPlanInStride( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ); - - /*! @brief Set the distance between consecutive elements of input buffers in each dimension. - * @details Set the plan properties which is the distance between elements in all dimensions of the input buffer - * (units are in terms of clfftPrecision) - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim The dimension of the stride parameters; provides the number of elements in the clStrides array - * @param[in] clStrides An array of strides of size 'dim'. Usually, strideX=1 so that successive elements in the first dimension are stored contiguously. - * Typically, strideY=LenX and strideZ=LenX*LenY with the successive elements in the second and third dimensions stored in packed format. - * See @ref DistanceStridesandPitches for details. - */ - CLFFTAPI clfftStatus clfftSetPlanInStride( clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ); - - /*! @brief Retrieve the distance between consecutive elements of output buffers in each dimension. - * @details Depending on how the dimension is set in the plan (for 2D or 3D FFT), strideY or strideZ can be safely - * ignored - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim The dimension of the stride parameters; provides the number of elements in the clStrides array - * @param[out] clStrides An array of strides, of size 'dim'. - */ - CLFFTAPI clfftStatus clfftGetPlanOutStride( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ); - - /*! @brief Set the distance between consecutive elements of output buffers in a dimension. - * @details Sets the plan properties which is the distance between elements in all dimensions of the output buffer - * (units are in terms of clfftPrecision) - * @param[in] plHandle Handle to a previously created plan - * @param[in] dim The dimension of the stride parameters; provides the number of elements in the clStrides array - * @param[in] clStrides An array of strides of size 'dim'. Usually, strideX=1 so that successive elements in the first dimension are stored contiguously. - * Typically, strideY=LenX and strideZ=LenX*LenY cause the successive elements in the second and third dimensions be stored in packed format. - * @sa clfftSetPlanInStride - */ - CLFFTAPI clfftStatus clfftSetPlanOutStride( clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ); - - /*! @brief Retrieve the distance between array objects - * @details Pitch is the distance between each discrete array object in an FFT array. This is only used - * for 'array' dimensions in clfftDim; see clfftSetPlanDimension (units are in terms of clfftPrecision) - * @param[in] plHandle Handle to a previously created plan - * @param[out] iDist The distance between the beginning elements of the discrete array objects in input buffer. - * For contiguous arrays in memory, iDist=(strideX*strideY*strideZ) - * @param[out] oDist The distance between the beginning elements of the discrete array objects in output buffer. - * For contiguous arrays in memory, oDist=(strideX*strideY*strideZ) - */ - CLFFTAPI clfftStatus clfftGetPlanDistance( const clfftPlanHandle plHandle, size_t* iDist, size_t* oDist ); - - /*! @brief Set the distance between array objects - * @details Pitch is the distance between each discrete array object in an FFT array. This is only used - * for 'array' dimensions in clfftDim; see clfftSetPlanDimension (units are in terms of clfftPrecision) - * @param[in] plHandle Handle to a previously created plan - * @param[out] iDist The distance between the beginning elements of the discrete array objects in input buffer. - * For contiguous arrays in memory, iDist=(strideX*strideY*strideZ) - * @param[out] oDist The distance between the beginning elements of the discrete array objects in output buffer. - * For contiguous arrays in memory, oDist=(strideX*strideY*strideZ) - */ - CLFFTAPI clfftStatus clfftSetPlanDistance( clfftPlanHandle plHandle, size_t iDist, size_t oDist ); - - /*! @brief Retrieve the expected layout of the input and output buffers - * @details Input and output buffers can be filled with either Hermitian, complex, or real numbers. Complex numbers are stored - * in various layouts; this function retrieves the layouts used by input and output - * @param[in] plHandle Handle to a previously created plan - * @param[out] iLayout Indicates how the input buffers are laid out in memory - * @param[out] oLayout Indicates how the output buffers are laid out in memory - */ - CLFFTAPI clfftStatus clfftGetLayout( const clfftPlanHandle plHandle, clfftLayout* iLayout, clfftLayout* oLayout ); - - /*! @brief Set the expected layout of the input and output buffers - * @details Input and output buffers can be filled with either Hermitian, complex, or real numbers. Complex numbers can be stored - * in various layouts; this function informs the library what layouts to use for input and output - * @param[in] plHandle Handle to a previously created plan - * @param[in] iLayout Indicates how the input buffers are laid out in memory - * @param[in] oLayout Indicates how the output buffers are laid out in memory - */ - CLFFTAPI clfftStatus clfftSetLayout( clfftPlanHandle plHandle, clfftLayout iLayout, clfftLayout oLayout ); - - /*! @brief Retrieve whether the input buffers are to be overwritten with results - * @details If the setting performs an in-place transform, the input buffers are overwritten with the results of the - * transform. If the setting performs an out-of-place transforms, the library looks for separate output buffers - * on the Enqueue call. - * @param[in] plHandle Handle to a previously created plan - * @param[out] placeness Informs the library to either overwrite the input buffers with results or to write them in separate output buffers - */ - CLFFTAPI clfftStatus clfftGetResultLocation( const clfftPlanHandle plHandle, clfftResultLocation* placeness ); - - /*! @brief Set whether the input buffers are to be overwritten with results - * @details If the setting performs an in-place transform, the input buffers are overwritten with the results of the - * transform. If the setting performs an out-of-place transforms, the library looks for separate output buffers - * on the Enqueue call. - * @param[in] plHandle Handle to a previously created plan - * @param[in] placeness Informs the library to either overwrite the input buffers with results or to write them in separate output buffers - */ - CLFFTAPI clfftStatus clfftSetResultLocation( clfftPlanHandle plHandle, clfftResultLocation placeness ); - - /*! @brief Retrieve the final transpose setting of a multi-dimensional FFT - * @details A multi-dimensional FFT transposes the data several times during calculation. If the client - * does not care about the final transpose, to put data back in proper dimension, the final transpose can be skipped - * to improve speed - * @param[in] plHandle Handle to a previously created plan - * @param[out] transposed Specifies whether the final transpose can be skipped - */ - CLFFTAPI clfftStatus clfftGetPlanTransposeResult( const clfftPlanHandle plHandle, clfftResultTransposed * transposed ); - - /*! @brief Set the final transpose setting of a multi-dimensional FFT - * @details A multi-dimensional FFT transposes the data several times during calculation. If the client - * does not care about the final transpose, to put data back in proper dimension, the final transpose can be skipped - * to improve speed - * @param[in] plHandle Handle to a previously created plan - * @param[in] transposed Specifies whether the final transpose can be skipped - */ - CLFFTAPI clfftStatus clfftSetPlanTransposeResult( clfftPlanHandle plHandle, clfftResultTransposed transposed ); - - - /*! @brief Get buffer size (in bytes), which may be needed internally for an intermediate buffer - * @details Very large FFT transforms may need multiple passes, and the operation needs a temporary buffer to hold - * intermediate results. This function is only valid after the plan is baked, otherwise, an invalid operation error - * is returned. If the returned buffersize is 0, the runtime needs no temporary buffer. - * @param[in] plHandle Handle to a previously created plan - * @param[out] buffersize Size in bytes for intermediate buffer - */ - CLFFTAPI clfftStatus clfftGetTmpBufSize( const clfftPlanHandle plHandle, size_t* buffersize ); - - /*! @brief Register the callback parameters - * @details Client can provide a callback function to do custom processing while reading input data and/or - * writing output data. The callback function is provided as a string. - * clFFT library incorporates the callback function string into the main FFT kernel. This function is used - * by client to set the necessary parameters for callback - * @param[in] plHandle Handle to a previously created plan - * @param[in] funcName Callback function name - * @param[in] funcString Callback function in string form - * @param[in] localMemSize Optional - Size (bytes) of the local memory used by callback function; pass 0 if no local memory is used - * @param[in] callbackType Type of callback - Pre-Callback or Post-Callback - * @param[in] userdata Supplementary data if any used by callback function - * @param[in] numUserdataBuffers Number of userdata buffers - */ - CLFFTAPI clfftStatus clfftSetPlanCallback(clfftPlanHandle plHandle, const char* funcName, const char* funcString, - int localMemSize, clfftCallbackType callbackType, cl_mem *userdata, int numUserdataBuffers); - - - /*! @brief Enqueue an FFT transform operation, and return immediately (non-blocking) - * @details This transform API function computes the FFT transform. It is non-blocking as it - * only enqueues the OpenCL kernels for execution. The synchronization step must be managed by the user. - * @param[in] plHandle Handle to a previously created plan - * @param[in] dir Forward or backward transform - * @param[in] numQueuesAndEvents Number of command queues in commQueues; number of expected events to be returned in outEvents - * @param[in] commQueues An array of cl_command_queues created by the client; the command queues must be a proper subset of - * the devices included in the OpenCL context associated with the plan - * @param[in] numWaitEvents Specify the number of elements in the eventWaitList array - * @param[in] waitEvents Events for which the transform waits to complete before executing on the device - * @param[out] outEvents The runtime fills this array with events corresponding one to one with the input command queues passed - * in commQueues. This parameter can have the value NULL or nullptr. When the value is NULL, the client is not interested in receiving notifications - * when transforms are finished, otherwise, (if not NULL) the client is responsible for allocating this array with at least - * as many elements as specified in numQueuesAndEvents. - * @param[in] inputBuffers An array of cl_mem objects that contain data for processing by the FFT runtime. If the transform - * is in-place, the FFT results overwrite the input buffers - * @param[out] outputBuffers An array of cl_mem objects that store the results of out-of-place transforms. If the transform - * is in-place, this parameter may be NULL or nullptr and is completely ignored - * @param[in] tmpBuffer A cl_mem object that is reserved as a temporary buffer for FFT processing. If clTmpBuffers is NULL or nullptr, - * and the library needs temporary storage, an internal temporary buffer is created on the fly managed by the library. - * @return Enum describing error condition; superset of OpenCL error codes - */ - CLFFTAPI clfftStatus clfftEnqueueTransform( - clfftPlanHandle plHandle, - clfftDirection dir, - cl_uint numQueuesAndEvents, - cl_command_queue* commQueues, - cl_uint numWaitEvents, - const cl_event* waitEvents, - cl_event* outEvents, - cl_mem* inputBuffers, - cl_mem* outputBuffers, - cl_mem tmpBuffer - ); +/*! @brief Initialize a clfftSetupData struct for the client + * @details clfftSetupData is passed to clfftSetup to control behavior of the + * FFT runtime. + * @param[out] setupData Data structure is cleared and initialized with version + * information and default values + * @return Enum describes the error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftInitSetupData(clfftSetupData *setupData); + +/*! @brief Initialize the internal FFT resources. + * @details The internal resources include FFT implementation caches kernels, + * programs, and buffers. + * @param[in] setupData Data structure that is passed into the setup routine to + * control FFT generation behavior and debug functionality + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetup(const clfftSetupData *setupData); + +/*! @brief Release all internal resources. + * @details Called when client is done with the FFT library, allowing the + * library to destroy all resources it has cached + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftTeardown(); + +/*! @brief Query the FFT library for version information + * @details Returns the major, minor and patch version numbers associated with + * the FFT library + * @param[out] major Major functionality change + * @param[out] minor Minor functionality change + * @param[out] patch Bug fixes, documentation changes, no new features + * introduced + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetVersion(cl_uint *major, cl_uint *minor, + cl_uint *patch); + +/*! @brief Create a plan object initialized entirely with default values. + * @details A plan is a repository of state for calculating FFT's. Allows the + * runtime to pre-calculate kernels, programs and buffers and associate them + * with buffers of specified dimensions. + * @param[out] plHandle Handle to the newly created plan + * @param[in] context Client is responsible for providing an OpenCL context for + * the plan + * @param[in] dim Dimensionality of the FFT transform; describes how many + * elements are in the array + * @param[in] clLengths An array of length of size 'dim'; each array value + * describes the length of each dimension + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftCreateDefaultPlan(clfftPlanHandle *plHandle, + cl_context context, + const clfftDim dim, + const size_t *clLengths); + +/*! @brief Create a copy of an existing plan. + * @details This API allows a client to create a new plan based upon an + * existing plan. This function can be used to quickly create plans that are + * similar, but may differ slightly. + * @param[out] out_plHandle Handle to the newly created plan that is based on + * in_plHandle + * @param[in] new_context Client is responsible for providing a new context for + * the new plan + * @param[in] in_plHandle Handle to a previously created plan that is to be + * copied + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftCopyPlan(clfftPlanHandle *out_plHandle, + cl_context new_context, + clfftPlanHandle in_plHandle); + +/*! @brief Prepare the plan for execution. + * @details After all plan parameters are set, the client has the option of + * 'baking' the plan, which informs the runtime that no more change to the + * parameters of the plan is expected, and the OpenCL kernels can be compiled. + * This optional function allows the client application to perform the OpenCL + * kernel compilation when the application is initialized instead of during the + * first execution. At this point, the clfft runtime applies all implimented + * optimizations, including running kernel experiments on the devices in the + * plan context.

This function takes a long time to execute. If a plan is + * not baked before being executed, the first call to clfftEnqueueTransform + * takes a long time to execute.

If any significant parameter of a plan is + * changed after the plan is baked (by a subsequent call to any one of the + * functions that has the prefix "clfftSetPlan"), it is not considered an error. + * Instead, the plan reverts back to the unbaked state, discarding the benefits + * of the baking operation. + * @param[in] plHandle Handle to a previously created plan + * @param[in] numQueues Number of command queues in commQueueFFT; 0 is a valid + * value, in which case the client does not want the runtime to run load + * experiments and only pre-calculate state information + * @param[in] commQueueFFT An array of cl_command_queues created by the client; + * the command queues must be a proper subset of the devices included in the + * plan context + * @param[in] pfn_notify A function pointer to a notification routine. The + * notification routine is a callback function that an application can register + * and is called when the program executable is built (successfully or + * unsuccessfully). Currently, this parameter MUST be NULL or nullptr. + * @param[in] user_data Passed as an argument when pfn_notify is called. + * Currently, this parameter MUST be NULL or nullptr. + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftBakePlan( + clfftPlanHandle plHandle, cl_uint numQueues, cl_command_queue *commQueueFFT, + void(CL_CALLBACK *pfn_notify)(clfftPlanHandle plHandle, void *user_data), + void *user_data); + +/*! @brief Release the resources of a plan. + * @details A plan may include resources, such as kernels, programs, and + * buffers that consume memory. When a plan is no more needed, the client must + * release the plan. + * @param[in,out] plHandle Handle to a previously created plan + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftDestroyPlan(clfftPlanHandle *plHandle); + +/*! @brief Retrieve the OpenCL context of a previously created plan. + * @details The user must pass a reference to a cl_context variable, which is + * modified to point to a context set in the specified plan. + * @param[in] plHandle Handle to a previously created plan + * @param[out] context Reference to the user allocated cl_context, which points + * to context set in the plan + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanContext(const clfftPlanHandle plHandle, + cl_context *context); + +/*! @brief Retrieve the floating point precision of the FFT data + * @details The user must pass a reference to a clfftPrecision variable, which + * is set to the precision of the FFT complex data in the plan. + * @param[in] plHandle Handle to a previously created plan + * @param[out] precision Reference to the user clfftPrecision enum + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanPrecision(const clfftPlanHandle plHandle, + clfftPrecision *precision); + +/*! @brief Set the floating point precision of the FFT data + * @details Sets the floating point precision of the FFT complex data in the + * plan. + * @param[in] plHandle Handle to a previously created plan + * @param[in] precision Reference to the user clfftPrecision enum + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanPrecision(clfftPlanHandle plHandle, + clfftPrecision precision); + +/*! @brief Set the offset in number of elements for the input array + * @details Sets the plan property which sets offset in number elements for the + * input array + * @param[in] plHandle Handle to a previously created plan + * @param[in] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanOffsetIn(clfftPlanHandle plHandle, + size_t offsetIn); + +/*! @brief Retrieve the offset in number of elements for the input array + * @details Queries a plan object and retrieves the value of the offset in + * number of elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[out] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanOffsetIn(const clfftPlanHandle plHandle, + size_t *offsetIn); + +/*! @brief Retrieve the offset in number of elements for the output array + * @details Queries a plan object and retrieves the value of the offset in + * number of elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[out] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanOffsetOut(clfftPlanHandle plHandle, + size_t offsetOut); + +/*! @brief Retrieve the offset in number of elements for the output array + * @details Queries a plan object and retrieves the value of the offset in + * number of elements for the input array + * @param[in] plHandle Handle to a previously created plan + * @param[out] offset size + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanOffsetOut(const clfftPlanHandle plHandle, + size_t *offsetOut); + +/*! @brief Retrieve the scaling factor that is applied to the FFT data + * @details The user must pass a reference to a cl_float variable, which is set + * to the floating point scaling factor that is multiplied across the FFT data. + * @param[in] plHandle Handle to a previously created plan + * @param[in] dir Direction of the applied scaling factor + * @param[out] scale Reference to the user cl_float variable + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanScale(const clfftPlanHandle plHandle, + clfftDirection dir, cl_float *scale); + +/*! @brief Set the scaling factor that is applied to the FFT data + * @details Sets the floating point scaling factor that is + * multiplied across the FFT data. + * @param[in] plHandle Handle to a previously created plan + * @param[in] dir Direction of the applied scaling factor + * @param[in] scale Reference to the user cl_float variable + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanScale(clfftPlanHandle plHandle, + clfftDirection dir, cl_float scale); + +/*! @brief Retrieve the number of discrete arrays that the plan can concurrently + * handle + * @details The user must pass a reference to a cl_uint variable, which is set + * to the number of discrete arrays (1D or 2D) that is batched together for the + * plan + * @param[in] plHandle Handle to a previously created plan + * @param[out] batchSize Number of discrete FFTs performed + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanBatchSize(const clfftPlanHandle plHandle, + size_t *batchSize); + +/*! @brief Set the number of discrete arrays that the plan can concurrently + * handle + * @details Sets the plan property which sets the number of discrete arrays (1D + * or 2D) that is batched together for the plan + * @param[in] plHandle Handle to a previously created plan + * @param[in] batchSize Number of discrete FFTs performed + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanBatchSize(clfftPlanHandle plHandle, + size_t batchSize); + +/*! @brief Retrieve the dimensionality of the data that is transformed + * @details Queries a plan object and retrieves the value of the dimensionality + * that the plan is set for. A size is returned to help the client allocate + * sufficient storage to hold the dimensions in a further call to + * clfftGetPlanLength + * @param[in] plHandle Handle to a previously created plan + * @param[out] dim The dimensionality of the FFT to be transformed + * @param[out] size Value to allocate an array to hold the FFT dimensions. + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanDim(const clfftPlanHandle plHandle, + clfftDim *dim, cl_uint *size); + +/*! @brief Set the dimensionality of the data that is transformed + * @details Set the dimensionality of the data that is transformed by the plan + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim The dimensionality of the FFT to be transformed + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanDim(clfftPlanHandle plHandle, + const clfftDim dim); + +/*! @brief Retrieve the length of each dimension of the FFT + * @details The user must pass a reference to a size_t array, which is set to + * the length of each discrete dimension of the FFT + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim Dimension of the FFT; describes how many elements are in the + * clLengths array + * @param[out] clLengths An array of length of size 'dim'; each array value + * describes the length of each dimension + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftGetPlanLength(const clfftPlanHandle plHandle, + const clfftDim dim, size_t *clLengths); + +/*! @brief Set the length of each dimension of the FFT + * @details Sets the plan property which is the length of each discrete + * dimension of the FFT + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim The dimension of the FFT; describes how many elements are in + * the clLengths array + * @param[in] clLengths An array of length of size 'dim'; each array value + * describes the length of each dimension + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftSetPlanLength(clfftPlanHandle plHandle, + const clfftDim dim, + const size_t *clLengths); + +/*! @brief Retrieve the distance between consecutive elements of input buffers + * in each dimension. + * @details Depending on how the dimension is set in the plan (for 2D or 3D + * FFT), strideY or strideZ can be safely ignored + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim The dimension of the stride parameters; provides the number + * of elements in the array + * @param[out] clStrides An array of strides, of size 'dim'. + */ +CLFFTAPI clfftStatus clfftGetPlanInStride(const clfftPlanHandle plHandle, + const clfftDim dim, + size_t *clStrides); + +/*! @brief Set the distance between consecutive elements of input buffers in + * each dimension. + * @details Set the plan properties which is the distance between elements in + * all dimensions of the input buffer (units are in terms of clfftPrecision) + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim The dimension of the stride parameters; provides the number + * of elements in the clStrides array + * @param[in] clStrides An array of strides of size 'dim'. Usually, strideX=1 + * so that successive elements in the first dimension are stored contiguously. + * Typically, strideY=LenX and strideZ=LenX*LenY with the successive + * elements in the second and third dimensions stored in packed format. See @ref + * DistanceStridesandPitches for details. + */ +CLFFTAPI clfftStatus clfftSetPlanInStride(clfftPlanHandle plHandle, + const clfftDim dim, + size_t *clStrides); + +/*! @brief Retrieve the distance between consecutive elements of output buffers + * in each dimension. + * @details Depending on how the dimension is set in the plan (for 2D or 3D + * FFT), strideY or strideZ can be safely ignored + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim The dimension of the stride parameters; provides the number + * of elements in the clStrides array + * @param[out] clStrides An array of strides, of size 'dim'. + */ +CLFFTAPI clfftStatus clfftGetPlanOutStride(const clfftPlanHandle plHandle, + const clfftDim dim, + size_t *clStrides); + +/*! @brief Set the distance between consecutive elements of output buffers in a + * dimension. + * @details Sets the plan properties which is the distance between elements in + * all dimensions of the output buffer (units are in terms of clfftPrecision) + * @param[in] plHandle Handle to a previously created plan + * @param[in] dim The dimension of the stride parameters; provides the number + * of elements in the clStrides array + * @param[in] clStrides An array of strides of size 'dim'. Usually, strideX=1 + * so that successive elements in the first dimension are stored contiguously. + * Typically, strideY=LenX and strideZ=LenX*LenY cause the successive + * elements in the second and third dimensions be stored in packed format. + * @sa clfftSetPlanInStride + */ +CLFFTAPI clfftStatus clfftSetPlanOutStride(clfftPlanHandle plHandle, + const clfftDim dim, + size_t *clStrides); + +/*! @brief Retrieve the distance between array objects + * @details Pitch is the distance between each discrete array object in an FFT + * array. This is only used for 'array' dimensions in clfftDim; see + * clfftSetPlanDimension (units are in terms of clfftPrecision) + * @param[in] plHandle Handle to a previously created plan + * @param[out] iDist The distance between the beginning elements of the + * discrete array objects in input buffer. For contiguous arrays in memory, + * iDist=(strideX*strideY*strideZ) + * @param[out] oDist The distance between the beginning elements of the + * discrete array objects in output buffer. For contiguous arrays in memory, + * oDist=(strideX*strideY*strideZ) + */ +CLFFTAPI clfftStatus clfftGetPlanDistance(const clfftPlanHandle plHandle, + size_t *iDist, size_t *oDist); + +/*! @brief Set the distance between array objects + * @details Pitch is the distance between each discrete array object in an FFT + * array. This is only used for 'array' dimensions in clfftDim; see + * clfftSetPlanDimension (units are in terms of clfftPrecision) + * @param[in] plHandle Handle to a previously created plan + * @param[out] iDist The distance between the beginning elements of the + * discrete array objects in input buffer. For contiguous arrays in memory, + * iDist=(strideX*strideY*strideZ) + * @param[out] oDist The distance between the beginning elements of the + * discrete array objects in output buffer. For contiguous arrays in memory, + * oDist=(strideX*strideY*strideZ) + */ +CLFFTAPI clfftStatus clfftSetPlanDistance(clfftPlanHandle plHandle, + size_t iDist, size_t oDist); + +/*! @brief Retrieve the expected layout of the input and output buffers + * @details Input and output buffers can be filled with either Hermitian, + * complex, or real numbers. Complex numbers are stored in various layouts; + * this function retrieves the layouts used by input and output + * @param[in] plHandle Handle to a previously created plan + * @param[out] iLayout Indicates how the input buffers are laid out in memory + * @param[out] oLayout Indicates how the output buffers are laid out in memory + */ +CLFFTAPI clfftStatus clfftGetLayout(const clfftPlanHandle plHandle, + clfftLayout *iLayout, clfftLayout *oLayout); + +/*! @brief Set the expected layout of the input and output buffers + * @details Input and output buffers can be filled with either Hermitian, + * complex, or real numbers. Complex numbers can be stored in various layouts; + * this function informs the library what layouts to use for input and output + * @param[in] plHandle Handle to a previously created plan + * @param[in] iLayout Indicates how the input buffers are laid out in memory + * @param[in] oLayout Indicates how the output buffers are laid out in memory + */ +CLFFTAPI clfftStatus clfftSetLayout(clfftPlanHandle plHandle, + clfftLayout iLayout, clfftLayout oLayout); + +/*! @brief Retrieve whether the input buffers are to be overwritten with results + * @details If the setting performs an in-place transform, the input buffers + * are overwritten with the results of the transform. If the setting performs + * an out-of-place transforms, the library looks for separate output buffers on + * the Enqueue call. + * @param[in] plHandle Handle to a previously created plan + * @param[out] placeness Informs the library to either overwrite the input + * buffers with results or to write them in separate output buffers + */ +CLFFTAPI clfftStatus clfftGetResultLocation(const clfftPlanHandle plHandle, + clfftResultLocation *placeness); + +/*! @brief Set whether the input buffers are to be overwritten with results + * @details If the setting performs an in-place transform, the input buffers + * are overwritten with the results of the transform. If the setting performs + * an out-of-place transforms, the library looks for separate output buffers on + * the Enqueue call. + * @param[in] plHandle Handle to a previously created plan + * @param[in] placeness Informs the library to either overwrite the input + * buffers with results or to write them in separate output buffers + */ +CLFFTAPI clfftStatus clfftSetResultLocation(clfftPlanHandle plHandle, + clfftResultLocation placeness); + +/*! @brief Retrieve the final transpose setting of a multi-dimensional FFT + * @details A multi-dimensional FFT transposes the data several times during + * calculation. If the client does not care about the final transpose, to put + * data back in proper dimension, the final transpose can be skipped to improve + * speed + * @param[in] plHandle Handle to a previously created plan + * @param[out] transposed Specifies whether the final transpose can be skipped + */ +CLFFTAPI clfftStatus clfftGetPlanTransposeResult( + const clfftPlanHandle plHandle, clfftResultTransposed *transposed); + +/*! @brief Set the final transpose setting of a multi-dimensional FFT + * @details A multi-dimensional FFT transposes the data several times during + * calculation. If the client does not care about the final transpose, to put + * data back in proper dimension, the final transpose can be skipped to improve + * speed + * @param[in] plHandle Handle to a previously created plan + * @param[in] transposed Specifies whether the final transpose can be skipped + */ +CLFFTAPI clfftStatus clfftSetPlanTransposeResult( + clfftPlanHandle plHandle, clfftResultTransposed transposed); + +/*! @brief Get buffer size (in bytes), which may be needed internally for an + * intermediate buffer + * @details Very large FFT transforms may need multiple passes, and the + * operation needs a temporary buffer to hold intermediate results. This + * function is only valid after the plan is baked, otherwise, an invalid + * operation error is returned. If the returned buffersize is 0, the runtime + * needs no temporary buffer. + * @param[in] plHandle Handle to a previously created plan + * @param[out] buffersize Size in bytes for intermediate buffer + */ +CLFFTAPI clfftStatus clfftGetTmpBufSize(const clfftPlanHandle plHandle, + size_t *buffersize); + +/*! @brief Register the callback parameters + * @details Client can provide a callback function to do custom processing + * while reading input data and/or writing output data. The callback function is + * provided as a string. clFFT library incorporates the callback function string + * into the main FFT kernel. This function is used by client to set the + * necessary parameters for callback + * @param[in] plHandle Handle to a previously created plan + * @param[in] funcName Callback function name + * @param[in] funcString Callback function in string form + * @param[in] localMemSize Optional - Size (bytes) of the local memory used by + * callback function; pass 0 if no local memory is used + * @param[in] callbackType Type of callback - Pre-Callback or Post-Callback + * @param[in] userdata Supplementary data if any used by callback function + * @param[in] numUserdataBuffers Number of userdata buffers + */ +CLFFTAPI clfftStatus clfftSetPlanCallback( + clfftPlanHandle plHandle, const char *funcName, const char *funcString, + int localMemSize, clfftCallbackType callbackType, cl_mem *userdata, + int numUserdataBuffers); + +/*! @brief Enqueue an FFT transform operation, and return immediately + *(non-blocking) + * @details This transform API function computes the FFT transform. It is + *non-blocking as it only enqueues the OpenCL kernels for execution. The + *synchronization step must be managed by the user. + * @param[in] plHandle Handle to a previously created plan + * @param[in] dir Forward or backward transform + * @param[in] numQueuesAndEvents Number of command queues in commQueues; number + *of expected events to be returned in outEvents + * @param[in] commQueues An array of cl_command_queues created by the client; + *the command queues must be a proper subset of the devices included in the + *OpenCL context associated with the plan + * @param[in] numWaitEvents Specify the number of elements in the eventWaitList + *array + * @param[in] waitEvents Events for which the transform waits to complete + *before executing on the device + * @param[out] outEvents The runtime fills this array with events corresponding + *one to one with the input command queues passed in commQueues. This parameter + *can have the value NULL or nullptr. When the value is NULL, the client is not + *interested in receiving notifications when transforms are finished, otherwise, + *(if not NULL) the client is responsible for allocating this array with at + *least as many elements as specified in numQueuesAndEvents. + * @param[in] inputBuffers An array of cl_mem objects that contain data for + *processing by the FFT runtime. If the transform is in-place, the FFT results + *overwrite the input buffers + * @param[out] outputBuffers An array of cl_mem objects that store the results + *of out-of-place transforms. If the transform is in-place, this parameter may + *be NULL or nullptr and is completely ignored + * @param[in] tmpBuffer A cl_mem object that is reserved as a temporary buffer + *for FFT processing. If clTmpBuffers is NULL or nullptr, and the library needs + *temporary storage, an internal temporary buffer is created on the fly managed + *by the library. + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftEnqueueTransform( + clfftPlanHandle plHandle, clfftDirection dir, cl_uint numQueuesAndEvents, + cl_command_queue *commQueues, cl_uint numWaitEvents, + const cl_event *waitEvents, cl_event *outEvents, cl_mem *inputBuffers, + cl_mem *outputBuffers, cl_mem tmpBuffer); #ifdef __cplusplus } diff --git a/src/include/clFFT.version.h.in b/src/include/clFFT.version.h.in index 686f03ea..da4994bd 100644 --- a/src/include/clFFT.version.h.in +++ b/src/include/clFFT.version.h.in @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - /* the configured version and settings for clFFT */ #define clfftVersionMajor @CLFFT_VERSION_MAJOR@ diff --git a/src/include/convenienceFunctions.h b/src/include/convenienceFunctions.h index e32bd3fc..64cc2cb2 100644 --- a/src/include/convenienceFunctions.h +++ b/src/include/convenienceFunctions.h @@ -14,15 +14,10 @@ * limitations under the License. * ************************************************************************/ - /*****************************************************/ -template< typename T > -unsigned int float_as_hex( T a ) { - return *(unsigned int*)&a; +template unsigned int float_as_hex(T a) { + return *(unsigned int *)&a; } /*****************************************************/ -template< typename T > -T hex_as_float( unsigned int a ) { - return *(T*)&a; -} \ No newline at end of file +template T hex_as_float(unsigned int a) { return *(T *)&a; } \ No newline at end of file diff --git a/src/include/sharedLibrary.h b/src/include/sharedLibrary.h index 961dbcaf..8a8de389 100644 --- a/src/include/sharedLibrary.h +++ b/src/include/sharedLibrary.h @@ -14,95 +14,94 @@ * limitations under the License. * ************************************************************************/ - #pragma once #ifndef _SHAREDLIBRARY_H_ #define _SHAREDLIBRARY_H_ -#include + +#include // _WIN32 is defined for both 32 & 64 bit environments -#if defined( _WIN32 ) - #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - // Windows Header Files: - #include +#if defined(_WIN32) +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include #else - #include +#include #endif -inline void* LoadSharedLibrary( std::string unixPrefix, std::string libraryName, bool quiet ) -{ -#if defined( _WIN32 ) - libraryName += ".dll"; +inline void *LoadSharedLibrary(std::string unixPrefix, std::string libraryName, + bool quiet) { +#if defined(_WIN32) + libraryName += ".dll"; - // HMODULE is actually the load address; function returns NULL if it cannot find the shared library - HMODULE fileHandle = ::LoadLibraryExA( libraryName.c_str( ), NULL, NULL ); -#elif defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) - tstring linuxName = unixPrefix; - linuxName += libraryName += ".so"; - void* fileHandle = ::dlopen( linuxName.c_str( ), RTLD_NOW ); - if( !quiet && !fileHandle ) - { - std::cerr << ::dlerror( ) << std::endl; - } + // HMODULE is actually the load address; function returns NULL if it cannot + //find the shared library + HMODULE fileHandle = ::LoadLibraryExA(libraryName.c_str(), NULL, NULL); +#elif defined(__linux__) || defined(__GNU__) || \ + (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) + tstring linuxName = unixPrefix; + linuxName += libraryName += ".so"; + void *fileHandle = ::dlopen(linuxName.c_str(), RTLD_NOW); + if (!quiet && !fileHandle) { + std::cerr << ::dlerror() << std::endl; + } #elif defined(__APPLE__) tstring appleName = unixPrefix; appleName += libraryName += ".dylib"; - void* fileHandle = ::dlopen( appleName.c_str( ), RTLD_NOW ); - if( !quiet && !fileHandle ) - { - std::cerr << ::dlerror( ) << std::endl; + void *fileHandle = ::dlopen(appleName.c_str(), RTLD_NOW); + if (!quiet && !fileHandle) { + std::cerr << ::dlerror() << std::endl; } #elif defined(__FreeBSD__) - tstring freebsdName = unixPrefix; - freebsdName += libraryName += ".so"; - void* fileHandle = ::dlopen( freebsdName.c_str( ), RTLD_NOW ); - if( !quiet && !fileHandle ) - { - std::cerr << ::dlerror( ) << std::endl; - } + tstring freebsdName = unixPrefix; + freebsdName += libraryName += ".so"; + void *fileHandle = ::dlopen(freebsdName.c_str(), RTLD_NOW); + if (!quiet && !fileHandle) { + std::cerr << ::dlerror() << std::endl; + } #else - #error "unsupported platform" +#error "unsupported platform" #endif - return fileHandle; + return fileHandle; } // If the function succeeds, the return value is nonzero. // If the function fails, the return value is zero. -inline int FreeSharedLibrary( void*& libHandle ) -{ - int result = 0; +inline int FreeSharedLibrary(void *&libHandle) { + int result = 0; -#if defined( _WIN32 ) - if( libHandle != 0 ) - result = ::FreeLibrary( reinterpret_cast< HMODULE >( libHandle ) ); +#if defined(_WIN32) + if (libHandle != 0) + result = ::FreeLibrary(reinterpret_cast(libHandle)); #else - if( libHandle != 0 ) - result = ( ::dlclose( libHandle ) == 0 ); + if (libHandle != nullptr) + result = (::dlclose(libHandle) == 0); #endif - libHandle = NULL; + libHandle = nullptr; - return result; + return result; } -// This takes a shared module handle returned from LoadSharedLibrary, and a text string of a symbol -// to load from the module, and returns a pointer to that symbol. If the symbol is not found, NULL -// is returned. If the module handle is NULL, NULL is returned. -inline void* LoadFunctionAddr( void* libHandle, std::string funcName ) -{ - if( libHandle == NULL ) - return NULL; +// This takes a shared module handle returned from LoadSharedLibrary, and a +//text string of a symbol to load from the module, and returns a pointer to that +//symbol. If the symbol is not found, NULL is returned. If the module handle +//is NULL, NULL is returned. +inline void *LoadFunctionAddr(void *libHandle, std::string funcName) { + if (libHandle == nullptr) + return nullptr; -#if defined( _WIN32 ) - HMODULE fileHandle = reinterpret_cast< HMODULE >( libHandle ); +#if defined(_WIN32) + HMODULE fileHandle = reinterpret_cast(libHandle); - void* pFunc = reinterpret_cast< void* >( ::GetProcAddress( fileHandle, funcName.c_str( ) ) ); + void *pFunc = + reinterpret_cast(::GetProcAddress(fileHandle, funcName.c_str())); #else - void* pFunc = ::dlsym( libHandle, funcName.c_str( ) ); + void *pFunc = ::dlsym(libHandle, funcName.c_str()); #endif - return pFunc; + return pFunc; } #endif // _SHAREDLIBRARY_H_ diff --git a/src/include/stdafx.h b/src/include/stdafx.h index 4ab26bf2..21b0330e 100644 --- a/src/include/stdafx.h +++ b/src/include/stdafx.h @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently @@ -24,29 +23,28 @@ #define _CRT_SECURE_NO_WARNINGS -#include -#include +#include +#include +#include +#include #include #include -#include +#include #include -#include +#include #include -#include -#include -#include -#include +#include // _WIN32 is defined for both 32 & 64 bit environments -#if defined( _WIN32 ) - #include - #include "targetver.h" +#if defined(_WIN32) +#include +#include "targetver.h" -#if !defined( NOMINMAX ) - #define NOMINMAX +#if !defined(NOMINMAX) +#define NOMINMAX #endif - #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - // Windows Header Files: - #include +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include #endif diff --git a/src/include/targetver.h b/src/include/targetver.h index 7c05692e..f5031add 100644 --- a/src/include/targetver.h +++ b/src/include/targetver.h @@ -14,12 +14,12 @@ * limitations under the License. * ************************************************************************/ - #pragma once // Including SDKDDKVer.h defines the highest available Windows platform. -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. +// If you wish to build your application for a previous Windows platform, +// include WinSDKVer.h and set the _WIN32_WINNT macro to the platform you wish +// to support before including SDKDDKVer.h. #include diff --git a/src/include/unicode.compatibility.h b/src/include/unicode.compatibility.h index 56a365f9..506b979e 100644 --- a/src/include/unicode.compatibility.h +++ b/src/include/unicode.compatibility.h @@ -14,46 +14,48 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( amd_unicode_h ) +#if !defined(amd_unicode_h) #define amd_unicode_h +#include + // Typedefs to support unicode and ansii compilation -#if defined( _UNICODE ) - typedef std::wstring tstring; - typedef std::wstringstream tstringstream; - typedef std::wifstream tifstream; - typedef std::wofstream tofstream; - typedef std::wfstream tfstream; - static std::wostream& tout = std::wcout; - static std::wostream& terr = std::wcerr; +#if defined(_UNICODE) +typedef std::wstring tstring; +typedef std::wstringstream tstringstream; +typedef std::wifstream tifstream; +typedef std::wofstream tofstream; +typedef std::wfstream tfstream; +static std::wostream &tout = std::wcout; +static std::wostream &terr = std::wcerr; #else - typedef std::string tstring; - typedef std::stringstream tstringstream; - typedef std::ifstream tifstream; - typedef std::ofstream tofstream; - typedef std::fstream tfstream; - static std::ostream& tout = std::cout; - static std::ostream& terr = std::cerr; +typedef std::string tstring; +typedef std::stringstream tstringstream; +typedef std::ifstream tifstream; +typedef std::ofstream tofstream; +typedef std::fstream tfstream; +static std::ostream &tout = std::cout; +static std::ostream &terr = std::cerr; #endif -// These macros help linux cope with the conventions of windows tchar.h file -#if defined( _WIN32 ) - #include - #include +// These macros help linux cope with the conventions of windows tchar.h +//file +#if defined(_WIN32) +#include +#include #else - #if defined( __GNUC__ ) - typedef char TCHAR; - typedef char _TCHAR; - #define _tmain main +#if defined(__GNUC__) +typedef char TCHAR; +typedef char _TCHAR; +#define _tmain main - #if defined( UNICODE ) - #define _T(x) L ## x - #else - #define _T(x) x - #endif - #endif +#if defined(UNICODE) +#define _T(x) L##x +#else +#define _T(x) x +#endif +#endif #endif #endif diff --git a/src/library/accessors.cpp b/src/library/accessors.cpp index ca428788..2fb88eab 100644 --- a/src/library/accessors.cpp +++ b/src/library/accessors.cpp @@ -14,875 +14,834 @@ * limitations under the License. * ************************************************************************/ - // clfft.accessors.cpp : Defines all the getters/setters for the Plan // -#include "stdafx.h" #include "private.h" #include "repo.h" +#include "stdafx.h" using std::vector; -clfftStatus clfftGetPlanBatchSize( const clfftPlanHandle plHandle, size_t* batchsize ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanBatchSize(const clfftPlanHandle plHandle, + size_t *batchsize) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanBatchSize" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanBatchSize" )); - *batchsize = fftPlan->batchsize; - return CLFFT_SUCCESS; + *batchsize = fftPlan->batchsize; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanBatchSize( clfftPlanHandle plHandle, size_t batchsize ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetPlanBatchSize(clfftPlanHandle plHandle, size_t batchsize) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanBatchSize" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanBatchSize" )); - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->batchsize = batchsize; - return CLFFT_SUCCESS; + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->batchsize = batchsize; + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanOffsetIn( const clfftPlanHandle plHandle, size_t* offsetIn ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanOffsetIn(const clfftPlanHandle plHandle, + size_t *offsetIn) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanOffsetIn" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanOffsetIn" )); - *offsetIn = fftPlan->offsetIn; - return CLFFT_SUCCESS; + *offsetIn = fftPlan->offsetIn; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanOffsetIn( clfftPlanHandle plHandle, size_t offsetIn ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetPlanOffsetIn(clfftPlanHandle plHandle, size_t offsetIn) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanOffsetIn" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanOffsetIn" )); - fftPlan->offsetIn = offsetIn; - return CLFFT_SUCCESS; + fftPlan->offsetIn = offsetIn; + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanOffsetOut( const clfftPlanHandle plHandle, size_t* offsetOut ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanOffsetOut(const clfftPlanHandle plHandle, + size_t *offsetOut) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanOffsetIn" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanOffsetIn" )); - *offsetOut = fftPlan->offsetOut; - return CLFFT_SUCCESS; + *offsetOut = fftPlan->offsetOut; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanOffsetOut( clfftPlanHandle plHandle, size_t offsetOut ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetPlanOffsetOut(clfftPlanHandle plHandle, size_t offsetOut) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanOffsetIn" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanOffsetIn" )); - fftPlan->offsetOut = offsetOut; - return CLFFT_SUCCESS; + fftPlan->offsetOut = offsetOut; + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanContext( const clfftPlanHandle plHandle, cl_context* context ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanContext(const clfftPlanHandle plHandle, + cl_context *context) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanContext" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanContext" )); - *context = fftPlan->context; - return CLFFT_SUCCESS; + *context = fftPlan->context; + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanPrecision( const clfftPlanHandle plHandle, clfftPrecision* precision ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanPrecision(const clfftPlanHandle plHandle, + clfftPrecision *precision) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanPrecision" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanPrecision" )); - *precision = fftPlan->precision; + *precision = fftPlan->precision; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } +clfftStatus clfftSetPlanPrecision(clfftPlanHandle plHandle, + clfftPrecision precision) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; -clfftStatus clfftSetPlanPrecision( clfftPlanHandle plHandle, clfftPrecision precision ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanPrecision" ) ); - - if( precision >= ENDPRECISION ) - return CLFFT_INVALID_ARG_VALUE; - - // We do not support CLFFT_*_FAST currently - if( precision == CLFFT_SINGLE_FAST || precision == CLFFT_DOUBLE_FAST ) - return CLFFT_NOTIMPLEMENTED; + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanPrecision" )); + if (precision >= ENDPRECISION) + return CLFFT_INVALID_ARG_VALUE; + // We do not support CLFFT_*_FAST currently + if (precision == CLFFT_SINGLE_FAST || precision == CLFFT_DOUBLE_FAST) + return CLFFT_NOTIMPLEMENTED; - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->precision = precision; + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->precision = precision; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanScale( const clfftPlanHandle plHandle, clfftDirection dir, cl_float* scale ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanScale(const clfftPlanHandle plHandle, + clfftDirection dir, cl_float *scale) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanScale" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanScale" )); - if( dir >= ENDDIRECTION ) - return CLFFT_INVALID_ARG_VALUE; + if (dir >= ENDDIRECTION) + return CLFFT_INVALID_ARG_VALUE; - if( dir == CLFFT_FORWARD || dir == CLFFT_MINUS ) - *scale = (cl_float)(fftPlan->forwardScale); - else - *scale = (cl_float)(fftPlan->backwardScale); + if (dir == CLFFT_FORWARD || dir == CLFFT_MINUS) + *scale = (cl_float)(fftPlan->forwardScale); + else + *scale = (cl_float)(fftPlan->backwardScale); - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanScale( clfftPlanHandle plHandle, clfftDirection dir, cl_float scale ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetPlanScale(clfftPlanHandle plHandle, clfftDirection dir, + cl_float scale) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanScale" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanScale" )); - if( dir >= ENDDIRECTION ) - return CLFFT_INVALID_ARG_VALUE; + if (dir >= ENDDIRECTION) + return CLFFT_INVALID_ARG_VALUE; - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; - if( dir == CLFFT_FORWARD || dir == CLFFT_MINUS ) - fftPlan->forwardScale = scale; - else - fftPlan->backwardScale = scale; + if (dir == CLFFT_FORWARD || dir == CLFFT_MINUS) + fftPlan->forwardScale = scale; + else + fftPlan->backwardScale = scale; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanDim( const clfftPlanHandle plHandle, clfftDim* dim, cl_uint* size ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanDim" ) ); - - *dim = fftPlan->dim; - - switch( fftPlan->dim ) - { - case CLFFT_1D: - { - *size = 1; - } - break; - case CLFFT_2D: - { - *size = 2; - } - break; - case CLFFT_3D: - { - *size = 3; - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - return CLFFT_SUCCESS; +clfftStatus clfftGetPlanDim(const clfftPlanHandle plHandle, clfftDim *dim, + cl_uint *size) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanDim" )); + + *dim = fftPlan->dim; + + switch (fftPlan->dim) { + case CLFFT_1D: { + *size = 1; + } break; + case CLFFT_2D: { + *size = 2; + } break; + case CLFFT_3D: { + *size = 3; + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanDim( clfftPlanHandle plHandle, const clfftDim dim ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanDim" ) ); - - // We resize the vectors in the plan to keep their sizes consistent with the value of the dimension - switch( dim ) - { - case CLFFT_1D: - { - fftPlan->length.resize( 1 ); - fftPlan->inStride.resize( 1 ); - fftPlan->outStride.resize( 1 ); - } - break; - case CLFFT_2D: - { - fftPlan->length.resize( 2 ); - fftPlan->inStride.resize( 2 ); - fftPlan->outStride.resize( 2 ); - } - break; - case CLFFT_3D: - { - fftPlan->length.resize( 3 ); - fftPlan->inStride.resize( 3 ); - fftPlan->outStride.resize( 3 ); - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->dim = dim; - - return CLFFT_SUCCESS; +clfftStatus clfftSetPlanDim(clfftPlanHandle plHandle, const clfftDim dim) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanDim" )); + + // We resize the vectors in the plan to keep their sizes consistent with + //the value of the dimension + switch (dim) { + case CLFFT_1D: { + fftPlan->length.resize(1); + fftPlan->inStride.resize(1); + fftPlan->outStride.resize(1); + } break; + case CLFFT_2D: { + fftPlan->length.resize(2); + fftPlan->inStride.resize(2); + fftPlan->outStride.resize(2); + } break; + case CLFFT_3D: { + fftPlan->length.resize(3); + fftPlan->inStride.resize(3); + fftPlan->outStride.resize(3); + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->dim = dim; + + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanLength( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clLengths ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanLength" ) ); - - if( clLengths == NULL ) - return CLFFT_INVALID_HOST_PTR; - - if( fftPlan->length.empty( ) ) - return CLFFT_INVALID_ARG_INDEX; - - switch( dim ) - { - case CLFFT_1D: - { - clLengths[ DimX ] = fftPlan->length[ DimX ]; - } - break; - case CLFFT_2D: - { - if( fftPlan->length.size( ) < 2 ) - return CLFFT_INVALID_ARG_INDEX; - - clLengths[ DimX ] = fftPlan->length[ DimX ]; - clLengths[ DimY ] = fftPlan->length[ DimY ]; - } - break; - case CLFFT_3D: - { - if( fftPlan->length.size( ) < 3 ) - return CLFFT_INVALID_ARG_INDEX; - - clLengths[ DimX ] = fftPlan->length[ DimX ]; - clLengths[ DimY ] = fftPlan->length[ DimY ]; - clLengths[ DimZ ] = fftPlan->length[ DimZ ]; - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - return CLFFT_SUCCESS; +clfftStatus clfftGetPlanLength(const clfftPlanHandle plHandle, + const clfftDim dim, size_t *clLengths) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanLength" )); + + if (clLengths == nullptr) + return CLFFT_INVALID_HOST_PTR; + + if (fftPlan->length.empty()) + return CLFFT_INVALID_ARG_INDEX; + + switch (dim) { + case CLFFT_1D: { + clLengths[DimX] = fftPlan->length[DimX]; + } break; + case CLFFT_2D: { + if (fftPlan->length.size() < 2) + return CLFFT_INVALID_ARG_INDEX; + + clLengths[DimX] = fftPlan->length[DimX]; + clLengths[DimY] = fftPlan->length[DimY]; + } break; + case CLFFT_3D: { + if (fftPlan->length.size() < 3) + return CLFFT_INVALID_ARG_INDEX; + + clLengths[DimX] = fftPlan->length[DimX]; + clLengths[DimY] = fftPlan->length[DimY]; + clLengths[DimZ] = fftPlan->length[DimZ]; + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanLength( clfftPlanHandle plHandle, const clfftDim dim, const size_t* clLengths ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanLength" ) ); - - if( clLengths == NULL ) - return CLFFT_INVALID_HOST_PTR; - - // Simplest to clear any previous contents, because it's valid for user to shrink dimension - fftPlan->length.clear( ); - switch( dim ) - { - case CLFFT_1D: - { - // Minimum length size is 1 - if( clLengths[ DimX ] == 0 ) - return CLFFT_INVALID_ARG_VALUE; - - if( !IsASupportedLength( clLengths[ DimX ] ) ) - return CLFFT_NOTIMPLEMENTED; - - fftPlan->length.push_back( clLengths[ DimX ] ); - } - break; - case CLFFT_2D: - { - // Minimum length size is 1 - if( clLengths[ DimX ] == 0 || clLengths[ DimY ] == 0 ) - return CLFFT_INVALID_ARG_VALUE; - - if(!fftPlan->transflag) - { - if( !IsASupportedLength( clLengths[ DimX ] ) || !IsASupportedLength( clLengths[ DimY ] ) ) - { - return CLFFT_NOTIMPLEMENTED; - } - } - - fftPlan->length.push_back( clLengths[ DimX ] ); - fftPlan->length.push_back( clLengths[ DimY ] ); - } - break; - case CLFFT_3D: - { - // Minimum length size is 1 - if( clLengths[ DimX ] == 0 || clLengths[ DimY ] == 0 || clLengths[ DimZ ] == 0) - return CLFFT_INVALID_ARG_VALUE; - - if( !IsASupportedLength( clLengths[ DimX ] ) || !IsASupportedLength( clLengths[ DimY ] ) || - !IsASupportedLength( clLengths[ DimZ ] ) ) - { - return CLFFT_NOTIMPLEMENTED; - } - - fftPlan->length.push_back( clLengths[ DimX ] ); - fftPlan->length.push_back( clLengths[ DimY ] ); - fftPlan->length.push_back( clLengths[ DimZ ] ); - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - fftPlan->dim = dim; - - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - - return CLFFT_SUCCESS; +clfftStatus clfftSetPlanLength(clfftPlanHandle plHandle, const clfftDim dim, + const size_t *clLengths) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanLength" )); + + if (clLengths == nullptr) + return CLFFT_INVALID_HOST_PTR; + + // Simplest to clear any previous contents, because it's valid for user to + //shrink dimension + fftPlan->length.clear(); + switch (dim) { + case CLFFT_1D: { + // Minimum length size is 1 + if (clLengths[DimX] == 0) + return CLFFT_INVALID_ARG_VALUE; + + if (!IsASupportedLength(clLengths[DimX])) + return CLFFT_NOTIMPLEMENTED; + + fftPlan->length.push_back(clLengths[DimX]); + } break; + case CLFFT_2D: { + // Minimum length size is 1 + if (clLengths[DimX] == 0 || clLengths[DimY] == 0) + return CLFFT_INVALID_ARG_VALUE; + + if (!fftPlan->transflag) { + if (!IsASupportedLength(clLengths[DimX]) || + !IsASupportedLength(clLengths[DimY])) { + return CLFFT_NOTIMPLEMENTED; + } + } + + fftPlan->length.push_back(clLengths[DimX]); + fftPlan->length.push_back(clLengths[DimY]); + } break; + case CLFFT_3D: { + // Minimum length size is 1 + if (clLengths[DimX] == 0 || clLengths[DimY] == 0 || clLengths[DimZ] == 0) + return CLFFT_INVALID_ARG_VALUE; + + if (!IsASupportedLength(clLengths[DimX]) || + !IsASupportedLength(clLengths[DimY]) || + !IsASupportedLength(clLengths[DimZ])) { + return CLFFT_NOTIMPLEMENTED; + } + + fftPlan->length.push_back(clLengths[DimX]); + fftPlan->length.push_back(clLengths[DimY]); + fftPlan->length.push_back(clLengths[DimZ]); + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + fftPlan->dim = dim; + + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanInStride( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanInStride" ) ); - - if( clStrides == NULL ) - return CLFFT_INVALID_HOST_PTR; - - switch( dim ) - { - case CLFFT_1D: - { - if( fftPlan->inStride.size( ) > 0 ) - clStrides[ DimX ] = fftPlan->inStride[ DimX ]; - else - return CLFFT_INVALID_ARG_INDEX; - } - break; - case CLFFT_2D: - { - if( fftPlan->inStride.size( ) > 1 ) - { - clStrides[ DimX ] = fftPlan->inStride[ DimX ]; - clStrides[ DimY ] = fftPlan->inStride[ DimY ]; - } - else - return CLFFT_INVALID_ARG_INDEX; - } - break; - case CLFFT_3D: - { - if( fftPlan->inStride.size( ) > 2 ) - { - clStrides[ DimX ] = fftPlan->inStride[ DimX ]; - clStrides[ DimY ] = fftPlan->inStride[ DimY ]; - clStrides[ DimZ ] = fftPlan->inStride[ DimZ ]; - } - else - return CLFFT_INVALID_ARG_INDEX; - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - return CLFFT_SUCCESS; +clfftStatus clfftGetPlanInStride(const clfftPlanHandle plHandle, + const clfftDim dim, size_t *clStrides) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanInStride" )); + + if (clStrides == nullptr) + return CLFFT_INVALID_HOST_PTR; + + switch (dim) { + case CLFFT_1D: { + if (fftPlan->inStride.size() > 0) + clStrides[DimX] = fftPlan->inStride[DimX]; + else + return CLFFT_INVALID_ARG_INDEX; + } break; + case CLFFT_2D: { + if (fftPlan->inStride.size() > 1) { + clStrides[DimX] = fftPlan->inStride[DimX]; + clStrides[DimY] = fftPlan->inStride[DimY]; + } else + return CLFFT_INVALID_ARG_INDEX; + } break; + case CLFFT_3D: { + if (fftPlan->inStride.size() > 2) { + clStrides[DimX] = fftPlan->inStride[DimX]; + clStrides[DimY] = fftPlan->inStride[DimY]; + clStrides[DimZ] = fftPlan->inStride[DimZ]; + } else + return CLFFT_INVALID_ARG_INDEX; + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanInStride( clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanInStride" ) ); - - if( clStrides == NULL ) - return CLFFT_INVALID_HOST_PTR; - - // Simplest to clear any previous contents, because it's valid for user to shrink dimension - fftPlan->inStride.clear( ); - switch( dim ) - { - case CLFFT_1D: - { - fftPlan->inStride.push_back( clStrides[ DimX ] ); - } - break; - case CLFFT_2D: - { - fftPlan->inStride.push_back( clStrides[ DimX ] ); - fftPlan->inStride.push_back( clStrides[ DimY ] ); - } - break; - case CLFFT_3D: - { - fftPlan->inStride.push_back( clStrides[ DimX ] ); - fftPlan->inStride.push_back( clStrides[ DimY ] ); - fftPlan->inStride.push_back( clStrides[ DimZ ] ); - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - - return CLFFT_SUCCESS; +clfftStatus clfftSetPlanInStride(clfftPlanHandle plHandle, const clfftDim dim, + size_t *clStrides) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanInStride" )); + + if (clStrides == nullptr) + return CLFFT_INVALID_HOST_PTR; + + // Simplest to clear any previous contents, because it's valid for user to + //shrink dimension + fftPlan->inStride.clear(); + switch (dim) { + case CLFFT_1D: { + fftPlan->inStride.push_back(clStrides[DimX]); + } break; + case CLFFT_2D: { + fftPlan->inStride.push_back(clStrides[DimX]); + fftPlan->inStride.push_back(clStrides[DimY]); + } break; + case CLFFT_3D: { + fftPlan->inStride.push_back(clStrides[DimX]); + fftPlan->inStride.push_back(clStrides[DimY]); + fftPlan->inStride.push_back(clStrides[DimZ]); + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanOutStride( const clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanOutStride" ) ); - - if( clStrides == NULL ) - return CLFFT_INVALID_HOST_PTR; - - switch( dim ) - { - case CLFFT_1D: - { - if( fftPlan->outStride.size( ) > 0 ) - clStrides[ DimX ] = fftPlan->outStride[ DimX ]; - else - return CLFFT_INVALID_ARG_INDEX; - } - break; - case CLFFT_2D: - { - if( fftPlan->outStride.size( ) > 1 ) - { - clStrides[ DimX ] = fftPlan->outStride[ DimX ]; - clStrides[ DimY ] = fftPlan->outStride[ DimY ]; - } - else - return CLFFT_INVALID_ARG_INDEX; - } - break; - case CLFFT_3D: - { - if( fftPlan->outStride.size( ) > 2 ) - { - clStrides[ DimX ] = fftPlan->outStride[ DimX ]; - clStrides[ DimY ] = fftPlan->outStride[ DimY ]; - clStrides[ DimZ ] = fftPlan->outStride[ DimZ ]; - } - else - return CLFFT_INVALID_ARG_INDEX; - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - return CLFFT_SUCCESS; +clfftStatus clfftGetPlanOutStride(const clfftPlanHandle plHandle, + const clfftDim dim, size_t *clStrides) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanOutStride" )); + + if (clStrides == nullptr) + return CLFFT_INVALID_HOST_PTR; + + switch (dim) { + case CLFFT_1D: { + if (fftPlan->outStride.size() > 0) + clStrides[DimX] = fftPlan->outStride[DimX]; + else + return CLFFT_INVALID_ARG_INDEX; + } break; + case CLFFT_2D: { + if (fftPlan->outStride.size() > 1) { + clStrides[DimX] = fftPlan->outStride[DimX]; + clStrides[DimY] = fftPlan->outStride[DimY]; + } else + return CLFFT_INVALID_ARG_INDEX; + } break; + case CLFFT_3D: { + if (fftPlan->outStride.size() > 2) { + clStrides[DimX] = fftPlan->outStride[DimX]; + clStrides[DimY] = fftPlan->outStride[DimY]; + clStrides[DimZ] = fftPlan->outStride[DimZ]; + } else + return CLFFT_INVALID_ARG_INDEX; + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanOutStride( clfftPlanHandle plHandle, const clfftDim dim, size_t* clStrides ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanOutStride" ) ); - - if( clStrides == NULL ) - return CLFFT_INVALID_HOST_PTR; - - // Simplest to clear any previous contents, because it's valid for user to shrink dimension - fftPlan->outStride.clear( ); - switch( dim ) - { - case CLFFT_1D: - { - fftPlan->outStride.push_back( clStrides[ DimX ] ); - } - break; - case CLFFT_2D: - { - fftPlan->outStride.push_back( clStrides[ DimX ] ); - fftPlan->outStride.push_back( clStrides[ DimY ] ); - } - break; - case CLFFT_3D: - { - fftPlan->outStride.push_back( clStrides[ DimX ] ); - fftPlan->outStride.push_back( clStrides[ DimY ] ); - fftPlan->outStride.push_back( clStrides[ DimZ ] ); - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - - return CLFFT_SUCCESS; +clfftStatus clfftSetPlanOutStride(clfftPlanHandle plHandle, const clfftDim dim, + size_t *clStrides) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanOutStride" )); + + if (clStrides == nullptr) + return CLFFT_INVALID_HOST_PTR; + + // Simplest to clear any previous contents, because it's valid for user to + //shrink dimension + fftPlan->outStride.clear(); + switch (dim) { + case CLFFT_1D: { + fftPlan->outStride.push_back(clStrides[DimX]); + } break; + case CLFFT_2D: { + fftPlan->outStride.push_back(clStrides[DimX]); + fftPlan->outStride.push_back(clStrides[DimY]); + } break; + case CLFFT_3D: { + fftPlan->outStride.push_back(clStrides[DimX]); + fftPlan->outStride.push_back(clStrides[DimY]); + fftPlan->outStride.push_back(clStrides[DimZ]); + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + + return CLFFT_SUCCESS; } -clfftStatus clfftGetPlanDistance( const clfftPlanHandle plHandle, size_t* iDist, size_t* oDist ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetPlanDistance(const clfftPlanHandle plHandle, size_t *iDist, + size_t *oDist) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanDistance" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanDistance" )); - *iDist = fftPlan->iDist; - *oDist = fftPlan->oDist; + *iDist = fftPlan->iDist; + *oDist = fftPlan->oDist; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanDistance( clfftPlanHandle plHandle, size_t iDist, size_t oDist ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetPlanDistance(clfftPlanHandle plHandle, size_t iDist, + size_t oDist) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanDistance" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanDistance" )); - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->iDist = iDist; - fftPlan->oDist = oDist; + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->iDist = iDist; + fftPlan->oDist = oDist; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftGetLayout( const clfftPlanHandle plHandle, clfftLayout* iLayout, clfftLayout* oLayout ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetLayout(const clfftPlanHandle plHandle, clfftLayout *iLayout, + clfftLayout *oLayout) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetLayout" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetLayout" )); - *iLayout = fftPlan->inputLayout; - *oLayout = fftPlan->outputLayout; + *iLayout = fftPlan->inputLayout; + *oLayout = fftPlan->outputLayout; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftSetLayout( clfftPlanHandle plHandle, clfftLayout iLayout, clfftLayout oLayout ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetLayout" ) ); - - // Basic error checking on parameter - if( ( iLayout >= ENDLAYOUT ) || ( oLayout >= ENDLAYOUT ) ) - return CLFFT_INVALID_ARG_VALUE; - - // We currently only support a subset of formats - switch( iLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( (oLayout == CLFFT_HERMITIAN_INTERLEAVED) || (oLayout == CLFFT_HERMITIAN_PLANAR) || (oLayout == CLFFT_REAL)) - return CLFFT_NOTIMPLEMENTED; - } - break; - case CLFFT_COMPLEX_PLANAR: - { - if( (oLayout == CLFFT_HERMITIAN_INTERLEAVED) || (oLayout == CLFFT_HERMITIAN_PLANAR) || (oLayout == CLFFT_REAL)) - return CLFFT_NOTIMPLEMENTED; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - { - if(oLayout != CLFFT_REAL) return CLFFT_NOTIMPLEMENTED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - if(oLayout != CLFFT_REAL) return CLFFT_NOTIMPLEMENTED; - } - break; - case CLFFT_REAL: - { - if((oLayout == CLFFT_REAL) || (oLayout == CLFFT_COMPLEX_INTERLEAVED) || (oLayout == CLFFT_COMPLEX_PLANAR)) - return CLFFT_NOTIMPLEMENTED; - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - // We currently only support a subset of formats - switch( oLayout ) - { - case CLFFT_COMPLEX_PLANAR: - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - case CLFFT_REAL: - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->inputLayout = iLayout; - fftPlan->outputLayout = oLayout; - - return CLFFT_SUCCESS; +clfftStatus clfftSetLayout(clfftPlanHandle plHandle, clfftLayout iLayout, + clfftLayout oLayout) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetLayout" )); + + // Basic error checking on parameter + if ((iLayout >= ENDLAYOUT) || (oLayout >= ENDLAYOUT)) + return CLFFT_INVALID_ARG_VALUE; + + // We currently only support a subset of formats + switch (iLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if ((oLayout == CLFFT_HERMITIAN_INTERLEAVED) || + (oLayout == CLFFT_HERMITIAN_PLANAR) || (oLayout == CLFFT_REAL)) + return CLFFT_NOTIMPLEMENTED; + } break; + case CLFFT_COMPLEX_PLANAR: { + if ((oLayout == CLFFT_HERMITIAN_INTERLEAVED) || + (oLayout == CLFFT_HERMITIAN_PLANAR) || (oLayout == CLFFT_REAL)) + return CLFFT_NOTIMPLEMENTED; + } break; + case CLFFT_HERMITIAN_INTERLEAVED: { + if (oLayout != CLFFT_REAL) + return CLFFT_NOTIMPLEMENTED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + if (oLayout != CLFFT_REAL) + return CLFFT_NOTIMPLEMENTED; + } break; + case CLFFT_REAL: { + if ((oLayout == CLFFT_REAL) || (oLayout == CLFFT_COMPLEX_INTERLEAVED) || + (oLayout == CLFFT_COMPLEX_PLANAR)) + return CLFFT_NOTIMPLEMENTED; + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + // We currently only support a subset of formats + switch (oLayout) { + case CLFFT_COMPLEX_PLANAR: + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + case CLFFT_REAL: + break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->inputLayout = iLayout; + fftPlan->outputLayout = oLayout; + + return CLFFT_SUCCESS; } -clfftStatus clfftGetResultLocation( const clfftPlanHandle plHandle, clfftResultLocation* placeness ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetResultLocation(const clfftPlanHandle plHandle, + clfftResultLocation *placeness) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetResultLocation" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetResultLocation" )); - *placeness = fftPlan->placeness; + *placeness = fftPlan->placeness; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftSetResultLocation( clfftPlanHandle plHandle, clfftResultLocation placeness ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetResultLocation(clfftPlanHandle plHandle, + clfftResultLocation placeness) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetResultLocation" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetResultLocation" )); - // Basic error checking on parameter - if( placeness >= ENDPLACE ) - return CLFFT_INVALID_ARG_VALUE; + // Basic error checking on parameter + if (placeness >= ENDPLACE) + return CLFFT_INVALID_ARG_VALUE; - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->placeness = placeness; + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->placeness = placeness; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } +clfftStatus clfftGetPlanTransposeResult(const clfftPlanHandle plHandle, + clfftResultTransposed *transposed) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; -clfftStatus clfftGetPlanTransposeResult( const clfftPlanHandle plHandle, clfftResultTransposed * transposed ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetResultLocation" )); - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetResultLocation" ) ); + *transposed = fftPlan->transposed; - *transposed = fftPlan->transposed; - - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanTransposeResult( clfftPlanHandle plHandle, clfftResultTransposed transposed ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftSetPlanTransposeResult(clfftPlanHandle plHandle, + clfftResultTransposed transposed) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetResultLocation" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetResultLocation" )); - // Basic error checking on parameter - if( transposed >= ENDTRANSPOSED ) - return CLFFT_INVALID_ARG_VALUE; + // Basic error checking on parameter + if (transposed >= ENDTRANSPOSED) + return CLFFT_INVALID_ARG_VALUE; - // If we modify the state of the plan, we assume that we can't trust any pre-calculated contents anymore - fftPlan->baked = false; - fftPlan->transposed = transposed; + // If we modify the state of the plan, we assume that we can't trust any + //pre-calculated contents anymore + fftPlan->baked = false; + fftPlan->transposed = transposed; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftGetTmpBufSize( const clfftPlanHandle plHandle, size_t* buffersize ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; +clfftStatus clfftGetTmpBufSize(const clfftPlanHandle plHandle, + size_t *buffersize) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanBatchSize" ) ); + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanBatchSize" )); - if (fftPlan->baked == true) - { - *buffersize = fftPlan->tmpBufSize; - return CLFFT_SUCCESS; - } + if (fftPlan->baked == true) { + *buffersize = fftPlan->tmpBufSize; + return CLFFT_SUCCESS; + } - return CLFFT_INVALID_OPERATION; + return CLFFT_INVALID_OPERATION; } -clfftStatus clfftLocalMemSize( const clfftPlanHandle plHandle, cl_ulong* local_mem_size ) -{ - FFTRepo& repo = FFTRepo::getInstance( ); - FFTPlan* plan = NULL; - lockRAII* lock = NULL; +clfftStatus clfftLocalMemSize(const clfftPlanHandle plHandle, + cl_ulong *local_mem_size) { + FFTRepo &repo = FFTRepo::getInstance(); + FFTPlan *plan = nullptr; + lockRAII *lock = nullptr; - OPENCL_V( repo.getPlan( plHandle, plan, lock ), _T( "repo.getPlan failed" ) ); - scopedLock sLock( *lock, _T( "clfftLocalMemSize" ) ); + OPENCL_V(repo.getPlan(plHandle, plan, lock), _T( "repo.getPlan failed" )); + scopedLock sLock(*lock, _T( "clfftLocalMemSize" )); - *local_mem_size = plan->envelope.limit_LocalMemSize; - return CLFFT_SUCCESS; + *local_mem_size = plan->envelope.limit_LocalMemSize; + return CLFFT_SUCCESS; } -clfftStatus clfftSetPlanCallback(clfftPlanHandle plHandle, const char* funcName, - const char* funcString, int localMemSize, - clfftCallbackType callbackType, cl_mem *userdata, int numUserdataBuffers) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftSetPlanCallback" ) ); - - switch (callbackType) - { - case PRECALLBACK: - { - ARG_CHECK(funcName != NULL); - ARG_CHECK(funcString != NULL); - ARG_CHECK(numUserdataBuffers >= 0); - - // We do not currently support multiple user data buffers - if( numUserdataBuffers > 1 ) - return CLFFT_NOTIMPLEMENTED; - - fftPlan->hasPreCallback = true; - - fftPlan->preCallback.funcname = funcName; - fftPlan->preCallback.funcstring = funcString; - fftPlan->preCallback.localMemSize = (localMemSize > 0) ? localMemSize : 0; - - cl_mem userdataBuf = NULL; - - if (userdata) - userdataBuf = userdata[0]; - - fftPlan->precallUserData = userdataBuf; - } - - break; - case POSTCALLBACK: - { - ARG_CHECK(funcName != NULL); - ARG_CHECK(funcString != NULL); - ARG_CHECK(numUserdataBuffers >= 0); - - // We do not currently support multiple user data buffers - if( numUserdataBuffers > 1 ) - return CLFFT_NOTIMPLEMENTED; - - fftPlan->hasPostCallback = true; - fftPlan->postCallbackParam.funcname = funcName; - fftPlan->postCallbackParam.funcstring = funcString; - fftPlan->postCallbackParam.localMemSize = (localMemSize > 0) ? localMemSize : 0; - - cl_mem userdataBuf = NULL; - - if (userdata) - userdataBuf = userdata[0]; - - fftPlan->postcallUserData = userdataBuf; - } - break; - default: - ARG_CHECK (false); - } - - return CLFFT_SUCCESS; +clfftStatus clfftSetPlanCallback(clfftPlanHandle plHandle, const char *funcName, + const char *funcString, int localMemSize, + clfftCallbackType callbackType, + cl_mem *userdata, int numUserdataBuffers) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftSetPlanCallback" )); + + switch (callbackType) { + case PRECALLBACK: { + ARG_CHECK(funcName != nullptr); + ARG_CHECK(funcString != nullptr); + ARG_CHECK(numUserdataBuffers >= 0); + + // We do not currently support multiple user data buffers + if (numUserdataBuffers > 1) + return CLFFT_NOTIMPLEMENTED; + + fftPlan->hasPreCallback = true; + + fftPlan->preCallback.funcname = funcName; + fftPlan->preCallback.funcstring = funcString; + fftPlan->preCallback.localMemSize = (localMemSize > 0) ? localMemSize : 0; + + cl_mem userdataBuf = nullptr; + + if (userdata) + userdataBuf = userdata[0]; + + fftPlan->precallUserData = userdataBuf; + } + + break; + case POSTCALLBACK: { + ARG_CHECK(funcName != nullptr); + ARG_CHECK(funcString != nullptr); + ARG_CHECK(numUserdataBuffers >= 0); + + // We do not currently support multiple user data buffers + if (numUserdataBuffers > 1) + return CLFFT_NOTIMPLEMENTED; + + fftPlan->hasPostCallback = true; + fftPlan->postCallbackParam.funcname = funcName; + fftPlan->postCallbackParam.funcstring = funcString; + fftPlan->postCallbackParam.localMemSize = + (localMemSize > 0) ? localMemSize : 0; + + cl_mem userdataBuf = nullptr; + + if (userdata) + userdataBuf = userdata[0]; + + fftPlan->postcallUserData = userdataBuf; + } break; + default: + ARG_CHECK(false); + } + + return CLFFT_SUCCESS; } diff --git a/src/library/action.h b/src/library/action.h index aecbe587..b995b958 100644 --- a/src/library/action.h +++ b/src/library/action.h @@ -14,61 +14,55 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( AMD_CLFFT_action_H ) +#if !defined(AMD_CLFFT_action_H) #define AMD_CLFFT_action_H #include "plan.h" - // // FFTCopyAction // // Base class for every Copy action for the FFT. // Currently do nothing special. The kernel generation and compilation occurs // by the subclass FFTGeneratedCopyAction -// -class FFTCopyAction : public FFTAction -{ +// +class FFTCopyAction : public FFTAction { public: - FFTCopyAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTCopyAction(clfftPlanHandle plHandle, FFTPlan *plan, cl_command_queue queue, + clfftStatus &err); - clfftGenerators getGenerator() { return Copy; } + clfftGenerators getGenerator() override { return Copy; } }; - // // FFTStockhamAction // // Base class for every Stockham action for the FFT. // Currently do nothing special. The kernel generation and compilation occurs // by the subclasses FFTGeneratedStockhamAction or FFTStaticStockhamAction -// -class FFTStockhamAction : public FFTAction -{ +// +class FFTStockhamAction : public FFTAction { public: - FFTStockhamAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTStockhamAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - clfftGenerators getGenerator() { return Stockham; } + clfftGenerators getGenerator() override { return Stockham; } }; - - - // // FFTTransposeGCNAction // // Base class for every TransposeGCN action for the FFT. // Currently do nothing special. The kernel generation and compilation occurs // by the subclass FFTGeneratedTransposeGCNAction -// -class FFTTransposeGCNAction : public FFTAction -{ +// +class FFTTransposeGCNAction : public FFTAction { public: - FFTTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - clfftGenerators getGenerator() { return Transpose_GCN; } + clfftGenerators getGenerator() override { return Transpose_GCN; } }; // @@ -77,13 +71,13 @@ class FFTTransposeGCNAction : public FFTAction // Base class for every TransposeSquare action for the FFT. // Currently do nothing special. The kernel generation and compilation occurs // by the subclass FFTGeneratedTransposeSquareAction -// -class FFTTransposeSquareAction : public FFTAction -{ +// +class FFTTransposeSquareAction : public FFTAction { public: - FFTTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - clfftGenerators getGenerator() { return Transpose_SQUARE; } + clfftGenerators getGenerator() override { return Transpose_SQUARE; } }; // @@ -92,13 +86,13 @@ class FFTTransposeSquareAction : public FFTAction // Base class for every TransposeSquare action for the FFT. // Currently do nothing special. The kernel generation and compilation occurs // by the subclass FFTGeneratedTransposeSquareAction -// -class FFTTransposeNonSquareAction : public FFTAction -{ +// +class FFTTransposeNonSquareAction : public FFTAction { public: - FFTTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - clfftGenerators getGenerator() { return Transpose_NONSQUARE; } + clfftGenerators getGenerator() override { return Transpose_NONSQUARE; } }; // @@ -106,7 +100,7 @@ class FFTTransposeNonSquareAction : public FFTAction // // Implements a Copy action for the FFT // Its signature is represented by FFTKernelGenKeyParams structure -// +// // This class implements: // - the generation of the kernel string // - the build of the kernel @@ -118,38 +112,36 @@ class FFTTransposeNonSquareAction : public FFTAction // but in practice the copy action only use a few information of that // structure, so a proper structure should be used instead. // -class FFTGeneratedCopyAction : public FFTCopyAction -{ +class FFTGeneratedCopyAction : public FFTCopyAction { public: - FFTGeneratedCopyAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTGeneratedCopyAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - typedef FFTKernelSignature Signature; + typedef FFTKernelSignature + Signature; private: - Signature signature; + Signature signature; - clfftStatus generateKernel (FFTRepo& fftRepo, const cl_command_queue commQueueFFT ); - clfftStatus getWorkSizes (std::vector & globalws, std::vector & localws); - clfftStatus initParams (); + clfftStatus generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) override; + clfftStatus getWorkSizes(std::vector &globalws, + std::vector &localws) override; + clfftStatus initParams(); - bool buildForwardKernel(); - bool buildBackwardKernel(); + bool buildForwardKernel() override; + bool buildBackwardKernel() override; public: - - virtual const Signature * getSignatureData() - { - return &this->signature; - } + const Signature *getSignatureData() override { return &this->signature; } }; - // // FFTGeneratedStockhamAction // // Represents a Stockham action for the FFT. This class implements the former // mechanism of kernel generation and compilation for Stockham method. -// +// // This class implements: // - the generation of the kernel string // - the build of the kernel @@ -160,43 +152,39 @@ class FFTGeneratedCopyAction : public FFTCopyAction // FFTGenerated*Action class, but a "Stockham-specific" version of that // structure should be used instead. // -class FFTGeneratedStockhamAction : public FFTStockhamAction -{ +class FFTGeneratedStockhamAction : public FFTStockhamAction { public: - FFTGeneratedStockhamAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); - - typedef FFTKernelSignature Signature; + FFTGeneratedStockhamAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); + + typedef FFTKernelSignature + Signature; private: - Signature signature; + Signature signature; - clfftStatus generateKernel (FFTRepo& fftRepo, const cl_command_queue commQueueFFT ); - clfftStatus getWorkSizes (std::vector & globalws, std::vector & localws); - clfftStatus initParams (); + clfftStatus generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) override; + clfftStatus getWorkSizes(std::vector &globalws, + std::vector &localws) override; + clfftStatus initParams(); - bool buildForwardKernel(); - bool buildBackwardKernel(); + bool buildForwardKernel() override; + bool buildBackwardKernel() override; public: - - virtual const Signature * getSignatureData() - { - return &this->signature; - } + const Signature *getSignatureData() override { return &this->signature; } }; - - - // FFTGeneratedTransposeGCNAction // // Implements a TransposeGCN action for the FFT // Its signature is represented by FFTKernelGenKeyParams structure -// +// // This class implements: // - the generation of the kernel string // - the build of the kernel -// +// // The structure FFTKernelGenKeyParams is used to characterize and generate // the appropriate transpose kernel. That structure is used for the signature of // this action. It is common to Stockham, copy and transpose methods. For @@ -204,41 +192,40 @@ class FFTGeneratedStockhamAction : public FFTStockhamAction // but in practice the transpose action only use a few information of that // structure, so a proper structure should be used instead. // -class FFTGeneratedTransposeGCNAction : public FFTTransposeGCNAction -{ +class FFTGeneratedTransposeGCNAction : public FFTTransposeGCNAction { public: - FFTGeneratedTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTGeneratedTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - typedef FFTKernelSignature Signature; + typedef FFTKernelSignature + Signature; private: - Signature signature; + Signature signature; - clfftStatus generateKernel (FFTRepo& fftRepo, const cl_command_queue commQueueFFT ); - clfftStatus getWorkSizes (std::vector & globalws, std::vector & localws); - clfftStatus initParams (); + clfftStatus generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) override; + clfftStatus getWorkSizes(std::vector &globalws, + std::vector &localws) override; + clfftStatus initParams(); - bool buildForwardKernel(); - bool buildBackwardKernel(); + bool buildForwardKernel() override; + bool buildBackwardKernel() override; public: - - virtual const Signature * getSignatureData() - { - return &this->signature; - } + const Signature *getSignatureData() override { return &this->signature; } }; - // FFTGeneratedTransposeSquareAction // // Implements a TransposeSquare action for the FFT // Its signature is represented by FFTKernelGenKeyParams structure -// +// // This class implements: // - the generation of the kernel string // - the build of the kernel -// +// // The structure FFTKernelGenKeyParams is used to characterize and generate // the appropriate transpose kernel. That structure is used for the signature of // this action. It is common to Stockham, copy and transpose methods. For @@ -246,40 +233,40 @@ class FFTGeneratedTransposeGCNAction : public FFTTransposeGCNAction // but in practice the transpose action only use a few information of that // structure, so a proper structure should be used instead. // -class FFTGeneratedTransposeSquareAction : public FFTTransposeSquareAction -{ +class FFTGeneratedTransposeSquareAction : public FFTTransposeSquareAction { public: - FFTGeneratedTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTGeneratedTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err); - typedef FFTKernelSignature Signature; + typedef FFTKernelSignature + Signature; private: - Signature signature; + Signature signature; - clfftStatus generateKernel (FFTRepo& fftRepo, const cl_command_queue commQueueFFT ); - clfftStatus getWorkSizes (std::vector & globalws, std::vector & localws); - clfftStatus initParams (); + clfftStatus generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) override; + clfftStatus getWorkSizes(std::vector &globalws, + std::vector &localws) override; + clfftStatus initParams(); - bool buildForwardKernel(); - bool buildBackwardKernel(); + bool buildForwardKernel() override; + bool buildBackwardKernel() override; public: - - virtual const Signature * getSignatureData() - { - return &this->signature; - } + const Signature *getSignatureData() override { return &this->signature; } }; // FFTGeneratedTransposeNonSquareAction // // Implements a TransposeSquare action for the FFT // Its signature is represented by FFTKernelGenKeyParams structure -// +// // This class implements: // - the generation of the kernel string // - the build of the kernel -// +// // The structure FFTKernelGenKeyParams is used to characterize and generate // the appropriate transpose kernel. That structure is used for the signature of // this action. It is common to Stockham, copy and transpose methods. For @@ -287,28 +274,30 @@ class FFTGeneratedTransposeSquareAction : public FFTTransposeSquareAction // but in practice the transpose action only use a few information of that // structure, so a proper structure should be used instead. // -class FFTGeneratedTransposeNonSquareAction : public FFTTransposeNonSquareAction -{ +class FFTGeneratedTransposeNonSquareAction + : public FFTTransposeNonSquareAction { public: - FFTGeneratedTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err); + FFTGeneratedTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, + clfftStatus &err); - typedef FFTKernelSignature Signature; + typedef FFTKernelSignature + Signature; private: - Signature signature; + Signature signature; - clfftStatus generateKernel(FFTRepo& fftRepo, const cl_command_queue commQueueFFT); - clfftStatus getWorkSizes(std::vector & globalws, std::vector & localws); - clfftStatus initParams(); + clfftStatus generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) override; + clfftStatus getWorkSizes(std::vector &globalws, + std::vector &localws) override; + clfftStatus initParams(); - bool buildForwardKernel(); - bool buildBackwardKernel(); + bool buildForwardKernel() override; + bool buildBackwardKernel() override; public: - - virtual const Signature * getSignatureData() - { - return &this->signature; - } + const Signature *getSignatureData() override { return &this->signature; } }; #endif // AMD_CLFFT_action_H diff --git a/src/library/action.transpose.cpp b/src/library/action.transpose.cpp index 874cf426..fba5ce9d 100644 --- a/src/library/action.transpose.cpp +++ b/src/library/action.transpose.cpp @@ -1,19 +1,18 @@ /* ************************************************************************ -* Copyright 2013 Advanced Micro Devices, Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ************************************************************************/ - + * Copyright 2013 Advanced Micro Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ************************************************************************/ // action.transpose.nonsquare.cpp provides the entry points of "baking" // nonsquare inplace transpose kernels called in plan.cpp. @@ -21,77 +20,74 @@ #include "stdafx.h" -#include -#include -#include "generator.transpose.h" #include "action.transpose.h" #include "generator.stockham.h" +#include "generator.transpose.h" +#include +#include #include "action.h" -FFTGeneratedTransposeNonSquareAction::FFTGeneratedTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTTransposeNonSquareAction(plHandle, plan, queue, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTTransposeNonSquareAction() failed, exit - fprintf(stderr, "FFTTransposeNonSquareAction() failed!\n"); - return; - } +FFTGeneratedTransposeNonSquareAction::FFTGeneratedTransposeNonSquareAction( + clfftPlanHandle plHandle, FFTPlan *plan, cl_command_queue queue, + clfftStatus &err) + : FFTTransposeNonSquareAction(plHandle, plan, queue, err) { + if (err != CLFFT_SUCCESS) { + // FFTTransposeNonSquareAction() failed, exit + fprintf(stderr, "FFTTransposeNonSquareAction() failed!\n"); + return; + } - // Initialize the FFTAction::FFTKernelGenKeyParams member - err = this->initParams(); + // Initialize the FFTAction::FFTKernelGenKeyParams member + err = this->initParams(); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeNonSquareAction::initParams() failed!\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, + "FFTGeneratedTransposeNonSquareAction::initParams() failed!\n"); + return; + } - FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTRepo &fftRepo = FFTRepo::getInstance(); - err = this->generateKernel(fftRepo, queue); + err = this->generateKernel(fftRepo, queue); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeNonSquareAction::generateKernel failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, + "FFTGeneratedTransposeNonSquareAction::generateKernel failed\n"); + return; + } - err = compileKernels(queue, plHandle, plan); + err = compileKernels(queue, plHandle, plan); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeNonSquareAction::compileKernels failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, + "FFTGeneratedTransposeNonSquareAction::compileKernels failed\n"); + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } +bool FFTGeneratedTransposeNonSquareAction::buildForwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; -bool FFTGeneratedTransposeNonSquareAction::buildForwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || r2c_transform; + return (!real_transform) || r2c_transform; } -bool FFTGeneratedTransposeNonSquareAction::buildBackwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedTransposeNonSquareAction::buildBackwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || c2r_transform; + return (!real_transform) || c2r_transform; } // These strings represent the names that are used as strKernel parameters @@ -102,647 +98,697 @@ const std::string pmImagOut("pmImagOut"); const std::string pmComplexIn("pmComplexIn"); const std::string pmComplexOut("pmComplexOut"); -clfftStatus FFTGeneratedTransposeNonSquareAction::initParams() -{ +clfftStatus FFTGeneratedTransposeNonSquareAction::initParams() { - this->signature.fft_precision = this->plan->precision; - this->signature.fft_placeness = this->plan->placeness; - this->signature.fft_inputLayout = this->plan->inputLayout; - this->signature.fft_outputLayout = this->plan->outputLayout; - this->signature.fft_3StepTwiddle = false; - this->signature.nonSquareKernelType = this->plan->nonSquareKernelType; + this->signature.fft_precision = this->plan->precision; + this->signature.fft_placeness = this->plan->placeness; + this->signature.fft_inputLayout = this->plan->inputLayout; + this->signature.fft_outputLayout = this->plan->outputLayout; + this->signature.fft_3StepTwiddle = false; + this->signature.nonSquareKernelType = this->plan->nonSquareKernelType; - this->signature.fft_realSpecial = this->plan->realSpecial; + this->signature.fft_realSpecial = this->plan->realSpecial; - this->signature.transOutHorizontal = this->plan->transOutHorizontal; // using the twiddle front flag to specify horizontal write - // we do this so as to reuse flags in FFTKernelGenKeyParams - // and to avoid making a new one + this->signature.transOutHorizontal = + this->plan->transOutHorizontal; // using the twiddle front flag to specify + // horizontal write we do this so as to + // reuse flags in FFTKernelGenKeyParams + // and to avoid making a new one - ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()); + ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()); - if (CLFFT_INPLACE == this->signature.fft_placeness) - { - // If this is an in-place transform the - // input and output layout - // *MUST* be the same. - // - ARG_CHECK(this->signature.fft_inputLayout == this->signature.fft_outputLayout) + if (CLFFT_INPLACE == this->signature.fft_placeness) { + // If this is an in-place transform the + // input and output layout + // *MUST* be the same. + // + ARG_CHECK(this->signature.fft_inputLayout == + this->signature.fft_outputLayout) /* for (size_t u = this->plan->inStride.size(); u-- > 0; ) { ARG_CHECK(this->plan->inStride[u] == this->plan->outStride[u]); }*/ - } - - this->signature.fft_DataDim = this->plan->length.size() + 1; - - int i = 0; - for (i = 0; i < (this->signature.fft_DataDim - 1); i++) - { - this->signature.fft_N[i] = this->plan->length[i]; - this->signature.fft_inStride[i] = this->plan->inStride[i]; - this->signature.fft_outStride[i] = this->plan->outStride[i]; - - } - this->signature.fft_inStride[i] = this->plan->iDist; - this->signature.fft_outStride[i] = this->plan->oDist; - - if (this->plan->large1D != 0) { - ARG_CHECK(this->signature.fft_N[0] != 0) - //ToDo:ENABLE ASSERT - // ARG_CHECK((this->plan->large1D % this->signature.fft_N[0]) == 0) - this->signature.fft_3StepTwiddle = true; - //ToDo:ENABLE ASSERT - // ARG_CHECK(this->plan->large1D == (this->signature.fft_N[1] * this->signature.fft_N[0])); - } - - // Query the devices in this context for their local memory sizes - // How we generate a kernel depends on the *minimum* LDS size for all devices. - // - const FFTEnvelope * pEnvelope = NULL; - OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); - BUG_CHECK(NULL != pEnvelope); - - // TODO: Since I am going with a 2D workgroup size now, I need a better check than this 1D use - // Check: CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE - // CL_DEVICE_MAX_WORK_ITEM_SIZES - this->signature.fft_R = 1; // Dont think i'll use - this->signature.fft_SIMD = pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size - - //Set callback if specified - if (this->plan->hasPreCallback) - { - this->signature.fft_hasPreCallback = true; - this->signature.fft_preCallback = this->plan->preCallback; - } - if (this->plan->hasPostCallback) - { - this->signature.fft_hasPostCallback = true; - this->signature.fft_postCallback = this->plan->postCallbackParam; - } - this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; - - this->signature.transposeMiniBatchSize = this->plan->transposeMiniBatchSize; - this->signature.nonSquareKernelOrder = this->plan->nonSquareKernelOrder; - this->signature.transposeBatchSize = this->plan->batchsize; - - return CLFFT_SUCCESS; + } + + this->signature.fft_DataDim = this->plan->length.size() + 1; + + int i = 0; + for (i = 0; i < (this->signature.fft_DataDim - 1); i++) { + this->signature.fft_N[i] = this->plan->length[i]; + this->signature.fft_inStride[i] = this->plan->inStride[i]; + this->signature.fft_outStride[i] = this->plan->outStride[i]; + } + this->signature.fft_inStride[i] = this->plan->iDist; + this->signature.fft_outStride[i] = this->plan->oDist; + + if (this->plan->large1D != 0) { + ARG_CHECK(this->signature.fft_N[0] != 0) + // ToDo:ENABLE ASSERT + // ARG_CHECK((this->plan->large1D % this->signature.fft_N[0]) == 0) + this->signature.fft_3StepTwiddle = true; + // ToDo:ENABLE ASSERT + // ARG_CHECK(this->plan->large1D == (this->signature.fft_N[1] * + // this->signature.fft_N[0])); + } + + // Query the devices in this context for their local memory sizes + // How we generate a kernel depends on the *minimum* LDS size for all + //devices. + // + const FFTEnvelope *pEnvelope = nullptr; + OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); + BUG_CHECK(nullptr != pEnvelope); + + // TODO: Since I am going with a 2D workgroup size now, I need a better check + // than this 1D use Check: + // CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE + // CL_DEVICE_MAX_WORK_ITEM_SIZES + this->signature.fft_R = 1; // Dont think i'll use + this->signature.fft_SIMD = + pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size + + // Set callback if specified + if (this->plan->hasPreCallback) { + this->signature.fft_hasPreCallback = true; + this->signature.fft_preCallback = this->plan->preCallback; + } + if (this->plan->hasPostCallback) { + this->signature.fft_hasPostCallback = true; + this->signature.fft_postCallback = this->plan->postCallbackParam; + } + this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; + + this->signature.transposeMiniBatchSize = this->plan->transposeMiniBatchSize; + this->signature.nonSquareKernelOrder = this->plan->nonSquareKernelOrder; + this->signature.transposeBatchSize = this->plan->batchsize; + + return CLFFT_SUCCESS; } - static const size_t lwSize = 256; static const size_t reShapeFactor = 2; - -// OpenCL does not take unicode strings as input, so this routine returns only ASCII strings -// Feed this generator the FFTPlan, and it returns the generated program as a string -clfftStatus FFTGeneratedTransposeNonSquareAction::generateKernel(FFTRepo& fftRepo, const cl_command_queue commQueueFFT) -{ - - - std::string programCode; - std::string kernelFuncName;//applied to swap kernel for now - if (this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) - { - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by transpose kernel - if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) - { - assert(!this->signature.fft_hasPostCallback); - - bool validLDSSize = false; - size_t requestedCallbackLDS = 0; - - requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; - - validLDSSize = ((2 * this->plan->ElementSize() * 16 * reShapeFactor * 16 * reShapeFactor) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; - - if(!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - OPENCL_V(clfft_transpose_generator::genTransposeKernelLeadingDimensionBatched(this->signature, programCode, lwSize, reShapeFactor), _T("genTransposeKernel() failed!")); +// OpenCL does not take unicode strings as input, so this routine returns +//only ASCII strings Feed this generator the FFTPlan, and it returns the +//generated program as a string +clfftStatus FFTGeneratedTransposeNonSquareAction::generateKernel( + FFTRepo &fftRepo, const cl_command_queue commQueueFFT) { + + std::string programCode; + std::string kernelFuncName; // applied to swap kernel for now + if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) { + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by transpose kernel + if (this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) { + assert(!this->signature.fft_hasPostCallback); + + bool validLDSSize = false; + size_t requestedCallbackLDS = 0; + + requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; + + validLDSSize = + ((2 * this->plan->ElementSize() * 16 * reShapeFactor * 16 * + reShapeFactor) + + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } } - else if (this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED) - { - //pre call back check - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by transpose kernel - if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) - { - assert(!this->signature.fft_hasPostCallback); - - bool validLDSSize = false; - size_t requestedCallbackLDS = 0; - - requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; - - validLDSSize = ((2 * this->plan->ElementSize() * 16 * reShapeFactor * 16 * reShapeFactor) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; - - if (!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - OPENCL_V(clfft_transpose_generator::genTransposeKernelBatched(this->signature, programCode, lwSize, reShapeFactor), _T("genTransposeKernel() failed!")); - } - else - { - //pre-callback is possible in swap kernel now - if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) - { - assert(!this->signature.fft_hasPostCallback); - - bool validLDSSize = false; - size_t requestedCallbackLDS = 0; - - requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; - //LDS usage of swap lines is exactly 2 lines - size_t lineSize = (this->signature.fft_N[0]) < (this->signature.fft_N[1]) ? this->signature.fft_N[0] : this->signature.fft_N[1]; - validLDSSize = ((2 * this->plan->ElementSize() * lineSize) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; - - if (!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - //here we should decide generate what kind of swap kernel. 1:2 and 1:3 probably need different swap kernels - /* - if (this->signature.fft_N[0] == 2 * this->signature.fft_N[1] || 2 * this->signature.fft_N[0] == this->signature.fft_N[1]) - { - OPENCL_V(clfft_transpose_generator::genSwapKernel(this->signature, programCode, kernelFuncName, lwSize, reShapeFactor), _T("genSwapKernel() failed!")); - } - else - { - OPENCL_V(clfft_transpose_generator::genSwapKernelGeneral(this->signature, programCode, kernelFuncName, lwSize, reShapeFactor), _T("genSwapKernel() failed!")); - } - */ - //general swap kernel takes care of all ratio - OPENCL_V(clfft_transpose_generator::genSwapKernelGeneral(this->signature, programCode, kernelFuncName, lwSize, reShapeFactor), _T("genSwapKernel() failed!")); + OPENCL_V( + clfft_transpose_generator::genTransposeKernelLeadingDimensionBatched( + this->signature, programCode, lwSize, reShapeFactor), + _T("genTransposeKernel() failed!")); + } else if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED) { + // pre call back check + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by transpose kernel + if (this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) { + assert(!this->signature.fft_hasPostCallback); + + bool validLDSSize = false; + size_t requestedCallbackLDS = 0; + + requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; + + validLDSSize = + ((2 * this->plan->ElementSize() * 16 * reShapeFactor * 16 * + reShapeFactor) + + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } } - //std::cout << programCode << std::endl; - cl_int status = CL_SUCCESS; - cl_device_id Device = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL); - OPENCL_V(status, _T("clGetCommandQueueInfo failed")); - - cl_context QueueContext = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL); - OPENCL_V(status, _T("clGetCommandQueueInfo failed")); - - - OPENCL_V(fftRepo.setProgramCode(Transpose_NONSQUARE, this->getSignatureData(), programCode, Device, QueueContext), _T("fftRepo.setclString() failed!")); - if (this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) + OPENCL_V(clfft_transpose_generator::genTransposeKernelBatched( + this->signature, programCode, lwSize, reShapeFactor), + _T("genTransposeKernel() failed!")); + } else { + // pre-callback is possible in swap kernel now + if (this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) { + assert(!this->signature.fft_hasPostCallback); + + bool validLDSSize = false; + size_t requestedCallbackLDS = 0; + + requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; + // LDS usage of swap lines is exactly 2 lines + size_t lineSize = (this->signature.fft_N[0]) < (this->signature.fft_N[1]) + ? this->signature.fft_N[0] + : this->signature.fft_N[1]; + validLDSSize = + ((2 * this->plan->ElementSize() * lineSize) + requestedCallbackLDS) < + this->plan->envelope.limit_LocalMemSize; + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } + // here we should decide generate what kind of swap kernel. 1:2 and 1:3 + // probably need different swap kernels + /* + if (this->signature.fft_N[0] == 2 * this->signature.fft_N[1] || 2 * + this->signature.fft_N[0] == this->signature.fft_N[1]) { - // Note: See genFunctionPrototype( ) - if (this->signature.fft_3StepTwiddle) - { - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), "transpose_nonsquare_tw_fwd", "transpose_nonsquare_tw_back", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } - else - { - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), "transpose_nonsquare", "transpose_nonsquare", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } + OPENCL_V(clfft_transpose_generator::genSwapKernel(this->signature, + programCode, kernelFuncName, lwSize, reShapeFactor), _T("genSwapKernel() + failed!")); } - else if(this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED) - { - //for non square we do twiddling in swap kernel - /* - if (this->signature.fft_3StepTwiddle && (this->signature.transposeMiniBatchSize == 1)) - { - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), "transpose_square_tw_fwd", "transpose_square_tw_back", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } - else - { - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), "transpose_square", "transpose_square", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } - */ - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), "transpose_square", "transpose_square", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } else { - if (this->signature.fft_3StepTwiddle)//if miniBatchSize > 1 twiddling is done in swap kernel - { - std::string kernelFwdFuncName = kernelFuncName + "_tw_fwd"; - std::string kernelBwdFuncName = kernelFuncName + "_tw_back"; - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), kernelFwdFuncName.c_str(), kernelBwdFuncName.c_str(), Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } - else - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, this->getSignatureData(), kernelFuncName.c_str(), kernelFuncName.c_str(), Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); + OPENCL_V(clfft_transpose_generator::genSwapKernelGeneral(this->signature, + programCode, kernelFuncName, lwSize, reShapeFactor), _T("genSwapKernel() + failed!")); } - return CLFFT_SUCCESS; -} - - -clfftStatus FFTGeneratedTransposeNonSquareAction::getWorkSizes(std::vector< size_t >& globalWS, std::vector< size_t >& localWS) -{ - - size_t wg_slice; - size_t smaller_dim = (this->signature.fft_N[0] < this->signature.fft_N[1]) ? this->signature.fft_N[0] : this->signature.fft_N[1]; - size_t bigger_dim = (this->signature.fft_N[0] >= this->signature.fft_N[1]) ? this->signature.fft_N[0] : this->signature.fft_N[1]; - size_t dim_ratio = bigger_dim / smaller_dim; - size_t global_item_size; - - if (this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) + */ + // general swap kernel takes care of all ratio + OPENCL_V(clfft_transpose_generator::genSwapKernelGeneral( + this->signature, programCode, kernelFuncName, lwSize, + reShapeFactor), + _T("genSwapKernel() failed!")); + } + // std::cout << programCode << std::endl; + cl_int status = CL_SUCCESS; + cl_device_id Device = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, + sizeof(cl_device_id), &Device, nullptr); + OPENCL_V(status, _T("clGetCommandQueueInfo failed")); + + cl_context QueueContext = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, + sizeof(cl_context), &QueueContext, nullptr); + OPENCL_V(status, _T("clGetCommandQueueInfo failed")); + + OPENCL_V(fftRepo.setProgramCode(Transpose_NONSQUARE, this->getSignatureData(), + programCode, Device, QueueContext), + _T("fftRepo.setclString() failed!")); + if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) { + // Note: See genFunctionPrototype( ) + if (this->signature.fft_3StepTwiddle) { + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_NONSQUARE, this->getSignatureData(), + "transpose_nonsquare_tw_fwd", "transpose_nonsquare_tw_back", + Device, QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } else { + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_NONSQUARE, this->getSignatureData(), + "transpose_nonsquare", "transpose_nonsquare", Device, + QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } + } else if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED) { + // for non square we do twiddling in swap kernel + /* + if (this->signature.fft_3StepTwiddle && + (this->signature.transposeMiniBatchSize == 1)) + { + OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, + this->getSignatureData(), "transpose_square_tw_fwd", + "transpose_square_tw_back", Device, QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } + else + { + OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_NONSQUARE, + this->getSignatureData(), "transpose_square", "transpose_square", Device, + QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); + } + */ + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_NONSQUARE, this->getSignatureData(), + "transpose_square", "transpose_square", Device, QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } else { + if (this->signature.fft_3StepTwiddle) // if miniBatchSize > 1 twiddling is + // done in swap kernel { - if (smaller_dim % (16 * reShapeFactor) == 0) - wg_slice = smaller_dim / 16 / reShapeFactor; - else - wg_slice = (smaller_dim / (16 * reShapeFactor)) + 1; - - global_item_size = wg_slice*(wg_slice + 1) / 2 * 16 * 16 * this->plan->batchsize; - - for (int i = 2; i < this->signature.fft_DataDim - 1; i++) - { - global_item_size *= this->signature.fft_N[i]; - } + std::string kernelFwdFuncName = kernelFuncName + "_tw_fwd"; + std::string kernelBwdFuncName = kernelFuncName + "_tw_back"; + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_NONSQUARE, this->getSignatureData(), + kernelFwdFuncName.c_str(), kernelBwdFuncName.c_str(), Device, + QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } else + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_NONSQUARE, this->getSignatureData(), + kernelFuncName.c_str(), kernelFuncName.c_str(), Device, + QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } + return CLFFT_SUCCESS; +} - /*Push the data required for the transpose kernels*/ - globalWS.clear(); - if(this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) - globalWS.push_back(global_item_size * dim_ratio); - else if (this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED) - globalWS.push_back(global_item_size); +clfftStatus FFTGeneratedTransposeNonSquareAction::getWorkSizes( + std::vector &globalWS, std::vector &localWS) { + + size_t wg_slice; + size_t smaller_dim = (this->signature.fft_N[0] < this->signature.fft_N[1]) + ? this->signature.fft_N[0] + : this->signature.fft_N[1]; + size_t bigger_dim = (this->signature.fft_N[0] >= this->signature.fft_N[1]) + ? this->signature.fft_N[0] + : this->signature.fft_N[1]; + size_t dim_ratio = bigger_dim / smaller_dim; + size_t global_item_size; + + if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) { + if (smaller_dim % (16 * reShapeFactor) == 0) + wg_slice = smaller_dim / 16 / reShapeFactor; + else + wg_slice = (smaller_dim / (16 * reShapeFactor)) + 1; + global_item_size = + wg_slice * (wg_slice + 1) / 2 * 16 * 16 * this->plan->batchsize; - localWS.clear(); - localWS.push_back(lwSize); + for (int i = 2; i < this->signature.fft_DataDim - 1; i++) { + global_item_size *= this->signature.fft_N[i]; } - else if (this->signature.nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED) - { - if (smaller_dim % (16 * reShapeFactor) == 0) - wg_slice = smaller_dim / 16 / reShapeFactor; - else - wg_slice = (smaller_dim / (16 * reShapeFactor)) + 1; - global_item_size = wg_slice*(wg_slice + 1) / 2 * 16 * 16 * this->plan->batchsize; + /*Push the data required for the transpose kernels*/ + globalWS.clear(); + if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING) + globalWS.push_back(global_item_size * dim_ratio); + else if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED) + globalWS.push_back(global_item_size); + + localWS.clear(); + localWS.push_back(lwSize); + } else if (this->signature.nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED) { + if (smaller_dim % (16 * reShapeFactor) == 0) + wg_slice = smaller_dim / 16 / reShapeFactor; + else + wg_slice = (smaller_dim / (16 * reShapeFactor)) + 1; - for (int i = 2; i < this->plan->length.size(); i++) - { - global_item_size *= this->plan->length[i]; - } + global_item_size = + wg_slice * (wg_slice + 1) / 2 * 16 * 16 * this->plan->batchsize; - /*Push the data required for the transpose kernels*/ - globalWS.clear(); - globalWS.push_back(global_item_size); + for (int i = 2; i < this->plan->length.size(); i++) { + global_item_size *= this->plan->length[i]; + } + /*Push the data required for the transpose kernels*/ + globalWS.clear(); + globalWS.push_back(global_item_size); + + localWS.clear(); + localWS.push_back(lwSize); + } else { + /*Now calculate the data for the swap kernels */ + // general swap kernel takes care of all ratio. need clean up here + if (dim_ratio == 2 && false) { + // 1:2 ratio + size_t input_elm_size_in_bytes; + switch (this->signature.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + input_elm_size_in_bytes = 4; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + input_elm_size_in_bytes = 8; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + switch (this->signature.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + input_elm_size_in_bytes *= 2; + break; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + size_t max_elements_loaded = AVAIL_MEM_SIZE / input_elm_size_in_bytes; + size_t num_elements_loaded; + size_t local_work_size_swap, num_grps_pro_row; + + if ((max_elements_loaded >> 1) > smaller_dim) { + local_work_size_swap = (smaller_dim < 256) ? smaller_dim : 256; + num_elements_loaded = smaller_dim; + num_grps_pro_row = 1; + } else { + num_grps_pro_row = (smaller_dim << 1) / max_elements_loaded; + num_elements_loaded = max_elements_loaded >> 1; + local_work_size_swap = + (num_elements_loaded < 256) ? num_elements_loaded : 256; + } + size_t num_reduced_row; + size_t num_reduced_col; + + if (this->signature.fft_N[1] == smaller_dim) { + num_reduced_row = smaller_dim; + num_reduced_col = 2; + } else { + num_reduced_row = 2; + num_reduced_col = smaller_dim; + } + + auto *cycle_map = new size_t[num_reduced_row * num_reduced_col * 2]; + /* The memory required by cycle_map cannot exceed 2 times row*col by + * design*/ + clfft_transpose_generator::get_cycles(cycle_map, num_reduced_row, + num_reduced_col); + + global_item_size = local_work_size_swap * num_grps_pro_row * + cycle_map[0] * this->plan->batchsize; + + for (int i = 2; i < this->signature.fft_DataDim - 1; i++) { + global_item_size *= this->signature.fft_N[i]; + } + delete[] cycle_map; + + globalWS.push_back(global_item_size); + localWS.push_back(local_work_size_swap); + } else { + // if (dim_ratio == 2 || dim_ratio == 3 || dim_ratio == 5 || dim_ratio == + // 10) + if (dim_ratio % 2 == 0 || dim_ratio % 3 == 0 || dim_ratio % 5 == 0 || + dim_ratio % 10 == 0) { + size_t local_work_size_swap = 256; + std::vector> permutationTable; + clfft_transpose_generator::permutation_calculation( + dim_ratio, smaller_dim, permutationTable); + size_t global_item_size; + if (this->plan->large1D && (dim_ratio > 1)) + global_item_size = (permutationTable.size() + 2) * + local_work_size_swap * this->plan->batchsize; + else + global_item_size = (permutationTable.size() + 2) * + local_work_size_swap * this->plan->batchsize; + // for (int i = 2; i < this->plan->length.size(); i++) + // global_item_size *= this->plan->length[i]; + size_t LDS_per_WG = smaller_dim; + while ( + LDS_per_WG > + 1024) // avoiding using too much lds memory. the biggest LDS memory + // we will allocate would be 1024*sizeof(float2/double2)*2 + { + if (LDS_per_WG % 2 == 0) { + LDS_per_WG /= 2; + continue; + } + if (LDS_per_WG % 3 == 0) { + LDS_per_WG /= 3; + continue; + } + if (LDS_per_WG % 5 == 0) { + LDS_per_WG /= 5; + continue; + } + return CLFFT_NOTIMPLEMENTED; + } - localWS.clear(); - localWS.push_back(lwSize); - } - else - { - /*Now calculate the data for the swap kernels */ - // general swap kernel takes care of all ratio. need clean up here - if(dim_ratio == 2 && 0){ - //1:2 ratio - size_t input_elm_size_in_bytes; - switch (this->signature.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - input_elm_size_in_bytes = 4; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - input_elm_size_in_bytes = 8; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - switch (this->signature.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - input_elm_size_in_bytes *= 2; - break; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - size_t max_elements_loaded = AVAIL_MEM_SIZE / input_elm_size_in_bytes; - size_t num_elements_loaded; - size_t local_work_size_swap, num_grps_pro_row; - - if ((max_elements_loaded >> 1) > smaller_dim) - { - local_work_size_swap = (smaller_dim < 256) ? smaller_dim : 256; - num_elements_loaded = smaller_dim; - num_grps_pro_row = 1; - } - else - { - num_grps_pro_row = (smaller_dim << 1) / max_elements_loaded; - num_elements_loaded = max_elements_loaded >> 1; - local_work_size_swap = (num_elements_loaded < 256) ? num_elements_loaded : 256; - } - size_t num_reduced_row; - size_t num_reduced_col; - - if (this->signature.fft_N[1] == smaller_dim) - { - num_reduced_row = smaller_dim; - num_reduced_col = 2; - } - else - { - num_reduced_row = 2; - num_reduced_col = smaller_dim; - } - - size_t *cycle_map = new size_t[num_reduced_row * num_reduced_col * 2]; - /* The memory required by cycle_map cannot exceed 2 times row*col by design*/ - clfft_transpose_generator::get_cycles(cycle_map, num_reduced_row, num_reduced_col); - - global_item_size = local_work_size_swap * num_grps_pro_row * cycle_map[0] * this->plan->batchsize; - - for (int i = 2; i < this->signature.fft_DataDim - 1; i++) - { - global_item_size *= this->signature.fft_N[i]; - } - delete[] cycle_map; - - globalWS.push_back(global_item_size); - localWS.push_back(local_work_size_swap); - } - else - { - //if (dim_ratio == 2 || dim_ratio == 3 || dim_ratio == 5 || dim_ratio == 10) - if (dim_ratio % 2 == 0 || dim_ratio % 3 == 0 || dim_ratio % 5 == 0 || dim_ratio % 10 == 0) - { - size_t local_work_size_swap = 256; - std::vector > permutationTable; - clfft_transpose_generator::permutation_calculation(dim_ratio, smaller_dim, permutationTable); - size_t global_item_size; - if(this->plan->large1D && (dim_ratio > 1)) - global_item_size = (permutationTable.size() + 2) * local_work_size_swap * this->plan->batchsize; - else - global_item_size = (permutationTable.size() + 2) * local_work_size_swap * this->plan->batchsize; - //for (int i = 2; i < this->plan->length.size(); i++) - // global_item_size *= this->plan->length[i]; - size_t LDS_per_WG = smaller_dim; - while (LDS_per_WG > 1024)//avoiding using too much lds memory. the biggest LDS memory we will allocate would be 1024*sizeof(float2/double2)*2 - { - if (LDS_per_WG % 2 == 0) - { - LDS_per_WG /= 2; - continue; - } - if (LDS_per_WG % 3 == 0) - { - LDS_per_WG /= 3; - continue; - } - if (LDS_per_WG % 5 == 0) - { - LDS_per_WG /= 5; - continue; - } - return CLFFT_NOTIMPLEMENTED; - } - - size_t WG_per_line = smaller_dim / LDS_per_WG; - global_item_size *= WG_per_line; - globalWS.push_back(global_item_size); - localWS.push_back(local_work_size_swap); - } - else - return CLFFT_NOTIMPLEMENTED; - } + size_t WG_per_line = smaller_dim / LDS_per_WG; + global_item_size *= WG_per_line; + globalWS.push_back(global_item_size); + localWS.push_back(local_work_size_swap); + } else + return CLFFT_NOTIMPLEMENTED; } - return CLFFT_SUCCESS; + } + return CLFFT_SUCCESS; } -FFTGeneratedTransposeSquareAction::FFTGeneratedTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTTransposeSquareAction(plHandle, plan, queue, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTTransposeSquareAction() failed, exit - fprintf(stderr, "FFTTransposeSquareAction() failed!\n"); - return; - } +FFTGeneratedTransposeSquareAction::FFTGeneratedTransposeSquareAction( + clfftPlanHandle plHandle, FFTPlan *plan, cl_command_queue queue, + clfftStatus &err) + : FFTTransposeSquareAction(plHandle, plan, queue, err) { + if (err != CLFFT_SUCCESS) { + // FFTTransposeSquareAction() failed, exit + fprintf(stderr, "FFTTransposeSquareAction() failed!\n"); + return; + } - // Initialize the FFTAction::FFTKernelGenKeyParams member - err = this->initParams(); + // Initialize the FFTAction::FFTKernelGenKeyParams member + err = this->initParams(); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeSquareAction::initParams() failed!\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, + "FFTGeneratedTransposeSquareAction::initParams() failed!\n"); + return; + } - FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTRepo &fftRepo = FFTRepo::getInstance(); - err = this->generateKernel(fftRepo, queue); + err = this->generateKernel(fftRepo, queue); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeSquareAction::generateKernel failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, + "FFTGeneratedTransposeSquareAction::generateKernel failed\n"); + return; + } - err = compileKernels(queue, plHandle, plan); + err = compileKernels(queue, plHandle, plan); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeSquareAction::compileKernels failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, + "FFTGeneratedTransposeSquareAction::compileKernels failed\n"); + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } +bool FFTGeneratedTransposeSquareAction::buildForwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; -bool FFTGeneratedTransposeSquareAction::buildForwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || r2c_transform; + return (!real_transform) || r2c_transform; } -bool FFTGeneratedTransposeSquareAction::buildBackwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedTransposeSquareAction::buildBackwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || c2r_transform; + return (!real_transform) || c2r_transform; } /*sqaure action*/ -clfftStatus FFTGeneratedTransposeSquareAction::initParams() -{ - - this->signature.fft_precision = this->plan->precision; - this->signature.fft_placeness = this->plan->placeness; - this->signature.fft_inputLayout = this->plan->inputLayout; - this->signature.fft_outputLayout = this->plan->outputLayout; - this->signature.fft_3StepTwiddle = false; - - this->signature.fft_realSpecial = this->plan->realSpecial; - - this->signature.transOutHorizontal = this->plan->transOutHorizontal; // using the twiddle front flag to specify horizontal write - // we do this so as to reuse flags in FFTKernelGenKeyParams - // and to avoid making a new one - - ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()); - - if (CLFFT_INPLACE == this->signature.fft_placeness) - { - // If this is an in-place transform the - // input and output layout, dimensions and strides - // *MUST* be the same. - // - ARG_CHECK(this->signature.fft_inputLayout == this->signature.fft_outputLayout) - - for (size_t u = this->plan->inStride.size(); u-- > 0; ) - { - ARG_CHECK(this->plan->inStride[u] == this->plan->outStride[u]); - } - } - - this->signature.fft_DataDim = this->plan->length.size() + 1; - int i = 0; - for (i = 0; i < (this->signature.fft_DataDim - 1); i++) - { - this->signature.fft_N[i] = this->plan->length[i]; - this->signature.fft_inStride[i] = this->plan->inStride[i]; - this->signature.fft_outStride[i] = this->plan->outStride[i]; - - } - this->signature.fft_inStride[i] = this->plan->iDist; - this->signature.fft_outStride[i] = this->plan->oDist; - - if (this->plan->large1D != 0) { - ARG_CHECK(this->signature.fft_N[0] != 0) - ARG_CHECK((this->plan->large1D % this->signature.fft_N[0]) == 0) - this->signature.fft_3StepTwiddle = true; - ARG_CHECK(this->plan->large1D == (this->signature.fft_N[1] * this->signature.fft_N[0])); - } - - // Query the devices in this context for their local memory sizes - // How we generate a kernel depends on the *minimum* LDS size for all devices. - // - const FFTEnvelope * pEnvelope = NULL; - OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); - BUG_CHECK(NULL != pEnvelope); - - // TODO: Since I am going with a 2D workgroup size now, I need a better check than this 1D use - // Check: CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE - // CL_DEVICE_MAX_WORK_ITEM_SIZES - this->signature.fft_R = 1; // Dont think i'll use - this->signature.fft_SIMD = pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size - - //Set callback if specified - if (this->plan->hasPreCallback) - { - this->signature.fft_hasPreCallback = true; - this->signature.fft_preCallback = this->plan->preCallback; - } - if (this->plan->hasPostCallback) - { - this->signature.fft_hasPostCallback = true; - this->signature.fft_postCallback = this->plan->postCallbackParam; - } - this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; - - this->signature.transposeMiniBatchSize = this->plan->transposeMiniBatchSize; - this->signature.transposeBatchSize = this->plan->batchsize; - - return CLFFT_SUCCESS; -} - +clfftStatus FFTGeneratedTransposeSquareAction::initParams() { -// OpenCL does not take unicode strings as input, so this routine returns only ASCII strings -// Feed this generator the FFTPlan, and it returns the generated program as a string -clfftStatus FFTGeneratedTransposeSquareAction::generateKernel(FFTRepo& fftRepo, const cl_command_queue commQueueFFT) -{ - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by main FFT kernel - if ((this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) || - (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0)) - { - assert(!(this->signature.fft_hasPreCallback && this->signature.fft_hasPostCallback)); + this->signature.fft_precision = this->plan->precision; + this->signature.fft_placeness = this->plan->placeness; + this->signature.fft_inputLayout = this->plan->inputLayout; + this->signature.fft_outputLayout = this->plan->outputLayout; + this->signature.fft_3StepTwiddle = false; - bool validLDSSize = false; - size_t requestedCallbackLDS = 0; + this->signature.fft_realSpecial = this->plan->realSpecial; - if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) - requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; - else if (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0) - requestedCallbackLDS = this->signature.fft_postCallback.localMemSize; + this->signature.transOutHorizontal = + this->plan->transOutHorizontal; // using the twiddle front flag to specify + // horizontal write we do this so as to + // reuse flags in FFTKernelGenKeyParams + // and to avoid making a new one - validLDSSize = ((2 * this->plan->ElementSize() * 16 * reShapeFactor * 16 * reShapeFactor) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; + ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()); - if (!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - - std::string programCode; - OPENCL_V(clfft_transpose_generator::genTransposeKernelBatched(this->signature, programCode, lwSize, reShapeFactor), _T("GenerateTransposeKernel() failed!")); - - cl_int status = CL_SUCCESS; - cl_device_id Device = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL); - OPENCL_V(status, _T("clGetCommandQueueInfo failed")); - - cl_context QueueContext = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL); - OPENCL_V(status, _T("clGetCommandQueueInfo failed")); - - - OPENCL_V(fftRepo.setProgramCode(Transpose_SQUARE, this->getSignatureData(), programCode, Device, QueueContext), _T("fftRepo.setclString() failed!")); - - // Note: See genFunctionPrototype( ) - if (this->signature.fft_3StepTwiddle) - { - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_SQUARE, this->getSignatureData(), "transpose_square_tw_fwd", "transpose_square_tw_back", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } - else - { - OPENCL_V(fftRepo.setProgramEntryPoints(Transpose_SQUARE, this->getSignatureData(), "transpose_square", "transpose_square", Device, QueueContext), _T("fftRepo.setProgramEntryPoint() failed!")); - } + if (CLFFT_INPLACE == this->signature.fft_placeness) { + // If this is an in-place transform the + // input and output layout, dimensions and strides + // *MUST* be the same. + // + ARG_CHECK(this->signature.fft_inputLayout == + this->signature.fft_outputLayout) - return CLFFT_SUCCESS; + for (size_t u = this->plan->inStride.size(); u-- > 0;) { + ARG_CHECK(this->plan->inStride[u] == this->plan->outStride[u]); + } + } + + this->signature.fft_DataDim = this->plan->length.size() + 1; + int i = 0; + for (i = 0; i < (this->signature.fft_DataDim - 1); i++) { + this->signature.fft_N[i] = this->plan->length[i]; + this->signature.fft_inStride[i] = this->plan->inStride[i]; + this->signature.fft_outStride[i] = this->plan->outStride[i]; + } + this->signature.fft_inStride[i] = this->plan->iDist; + this->signature.fft_outStride[i] = this->plan->oDist; + + if (this->plan->large1D != 0) { + ARG_CHECK(this->signature.fft_N[0] != 0) + ARG_CHECK((this->plan->large1D % this->signature.fft_N[0]) == 0) + this->signature.fft_3StepTwiddle = true; + ARG_CHECK(this->plan->large1D == + (this->signature.fft_N[1] * this->signature.fft_N[0])); + } + + // Query the devices in this context for their local memory sizes + // How we generate a kernel depends on the *minimum* LDS size for all + //devices. + // + const FFTEnvelope *pEnvelope = nullptr; + OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); + BUG_CHECK(nullptr != pEnvelope); + + // TODO: Since I am going with a 2D workgroup size now, I need a better check + // than this 1D use Check: + // CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE + // CL_DEVICE_MAX_WORK_ITEM_SIZES + this->signature.fft_R = 1; // Dont think i'll use + this->signature.fft_SIMD = + pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size + + // Set callback if specified + if (this->plan->hasPreCallback) { + this->signature.fft_hasPreCallback = true; + this->signature.fft_preCallback = this->plan->preCallback; + } + if (this->plan->hasPostCallback) { + this->signature.fft_hasPostCallback = true; + this->signature.fft_postCallback = this->plan->postCallbackParam; + } + this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; + + this->signature.transposeMiniBatchSize = this->plan->transposeMiniBatchSize; + this->signature.transposeBatchSize = this->plan->batchsize; + + return CLFFT_SUCCESS; } +// OpenCL does not take unicode strings as input, so this routine returns +//only ASCII strings Feed this generator the FFTPlan, and it returns the +//generated program as a string +clfftStatus FFTGeneratedTransposeSquareAction::generateKernel( + FFTRepo &fftRepo, const cl_command_queue commQueueFFT) { + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by main FFT kernel + if ((this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) || + (this->signature.fft_hasPostCallback && + this->signature.fft_postCallback.localMemSize > 0)) { + assert(!(this->signature.fft_hasPreCallback && + this->signature.fft_hasPostCallback)); + + bool validLDSSize = false; + size_t requestedCallbackLDS = 0; + + if (this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) + requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; + else if (this->signature.fft_hasPostCallback && + this->signature.fft_postCallback.localMemSize > 0) + requestedCallbackLDS = this->signature.fft_postCallback.localMemSize; + + validLDSSize = + ((2 * this->plan->ElementSize() * 16 * reShapeFactor * 16 * + reShapeFactor) + + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } + + std::string programCode; + OPENCL_V(clfft_transpose_generator::genTransposeKernelBatched( + this->signature, programCode, lwSize, reShapeFactor), + _T("GenerateTransposeKernel() failed!")); + + cl_int status = CL_SUCCESS; + cl_device_id Device = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, + sizeof(cl_device_id), &Device, nullptr); + OPENCL_V(status, _T("clGetCommandQueueInfo failed")); + + cl_context QueueContext = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, + sizeof(cl_context), &QueueContext, nullptr); + OPENCL_V(status, _T("clGetCommandQueueInfo failed")); + + OPENCL_V(fftRepo.setProgramCode(Transpose_SQUARE, this->getSignatureData(), + programCode, Device, QueueContext), + _T("fftRepo.setclString() failed!")); + + // Note: See genFunctionPrototype( ) + if (this->signature.fft_3StepTwiddle) { + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_SQUARE, this->getSignatureData(), + "transpose_square_tw_fwd", "transpose_square_tw_back", Device, + QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } else { + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_SQUARE, this->getSignatureData(), "transpose_square", + "transpose_square", Device, QueueContext), + _T("fftRepo.setProgramEntryPoint() failed!")); + } + + return CLFFT_SUCCESS; +} -clfftStatus FFTGeneratedTransposeSquareAction::getWorkSizes(std::vector< size_t >& globalWS, std::vector< size_t >& localWS) -{ +clfftStatus +FFTGeneratedTransposeSquareAction::getWorkSizes(std::vector &globalWS, + std::vector &localWS) { - size_t wg_slice; - if (this->signature.fft_N[0] % (16 * reShapeFactor) == 0) - wg_slice = this->signature.fft_N[0] / 16 / reShapeFactor; - else - wg_slice = (this->signature.fft_N[0] / (16 * reShapeFactor)) + 1; + size_t wg_slice; + if (this->signature.fft_N[0] % (16 * reShapeFactor) == 0) + wg_slice = this->signature.fft_N[0] / 16 / reShapeFactor; + else + wg_slice = (this->signature.fft_N[0] / (16 * reShapeFactor)) + 1; - size_t global_item_size = wg_slice*(wg_slice + 1) / 2 * 16 * 16 * this->plan->batchsize; + size_t global_item_size = + wg_slice * (wg_slice + 1) / 2 * 16 * 16 * this->plan->batchsize; - for (int i = 2; i < this->signature.fft_DataDim - 1; i++) - { - global_item_size *= this->signature.fft_N[i]; - } + for (int i = 2; i < this->signature.fft_DataDim - 1; i++) { + global_item_size *= this->signature.fft_N[i]; + } - globalWS.clear(); - globalWS.push_back(global_item_size); + globalWS.clear(); + globalWS.push_back(global_item_size); - localWS.clear(); - localWS.push_back(lwSize); + localWS.clear(); + localWS.push_back(lwSize); - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } diff --git a/src/library/action.transpose.h b/src/library/action.transpose.h index 532707a0..64db3762 100644 --- a/src/library/action.transpose.h +++ b/src/library/action.transpose.h @@ -15,11 +15,10 @@ * ************************************************************************/ #pragma once -#if !defined( AMD_CLFFT_action_transpose_H ) +#if !defined(AMD_CLFFT_action_transpose_H) #define AMD_CLFFT_action_transpose_H +#include "plan.h" #include "private.h" #include "repo.h" -#include "plan.h" #endif - diff --git a/src/library/dllmain.cpp b/src/library/dllmain.cpp index 5d651328..6db0a3e1 100644 --- a/src/library/dllmain.cpp +++ b/src/library/dllmain.cpp @@ -14,23 +14,17 @@ * limitations under the License. * ************************************************************************/ - // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, + LPVOID lpReserved) { + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; } - diff --git a/src/library/enqueue.cpp b/src/library/enqueue.cpp index 031d8ae6..88922596 100644 --- a/src/library/enqueue.cpp +++ b/src/library/enqueue.cpp @@ -14,819 +14,743 @@ * limitations under the License. * ************************************************************************/ -#include "stdafx.h" -#include +#include "../include/convenienceFunctions.h" +#include "generator.stockham.h" +#include "plan.h" #include "private.h" #include "repo.h" -#include "plan.h" -#include "generator.stockham.h" -#include "../include/convenienceFunctions.h" +#include "stdafx.h" +#include #include "action.h" #include "fft_binary_lookup.h" #define FFT_CACHE_DEBUG 0 +FFTCopyAction::FFTCopyAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err) + : FFTAction(plan, err) { + if (err != CLFFT_SUCCESS) { + // FFTAction() failed, exit constructor + return; + } - -FFTCopyAction::FFTCopyAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) -: FFTAction(plan, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } - - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } -FFTTransposeGCNAction::FFTTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) -: FFTAction(plan, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } - - err = CLFFT_SUCCESS; +FFTTransposeGCNAction::FFTTransposeGCNAction(clfftPlanHandle plHandle, + FFTPlan *plan, + cl_command_queue queue, + clfftStatus &err) + : FFTAction(plan, err) { + if (err != CLFFT_SUCCESS) { + // FFTAction() failed, exit constructor + return; + } + + err = CLFFT_SUCCESS; } -FFTTransposeSquareAction::FFTTransposeSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) -: FFTAction(plan, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } - - err = CLFFT_SUCCESS; +FFTTransposeSquareAction::FFTTransposeSquareAction(clfftPlanHandle plHandle, + FFTPlan *plan, + cl_command_queue queue, + clfftStatus &err) + : FFTAction(plan, err) { + if (err != CLFFT_SUCCESS) { + // FFTAction() failed, exit constructor + return; + } + + err = CLFFT_SUCCESS; } -FFTTransposeNonSquareAction::FFTTransposeNonSquareAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) -: FFTAction(plan, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } +FFTTransposeNonSquareAction::FFTTransposeNonSquareAction( + clfftPlanHandle plHandle, FFTPlan *plan, cl_command_queue queue, + clfftStatus &err) + : FFTAction(plan, err) { + if (err != CLFFT_SUCCESS) { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } -FFTStockhamAction::FFTStockhamAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) -: FFTAction(plan, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit constructor - return; - } +FFTStockhamAction::FFTStockhamAction(clfftPlanHandle plHandle, FFTPlan *plan, + cl_command_queue queue, clfftStatus &err) + : FFTAction(plan, err) { + if (err != CLFFT_SUCCESS) { + // FFTAction() failed, exit constructor + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } - - -FFTAction::FFTAction(FFTPlan * fftPlan, clfftStatus & err) -: plan(fftPlan) -{ - err = CLFFT_SUCCESS; +FFTAction::FFTAction(FFTPlan *fftPlan, clfftStatus &err) : plan(fftPlan) { + err = CLFFT_SUCCESS; } -clfftStatus FFTAction::selectBufferArguments(FFTPlan * fftPlan, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers, - std::vector< cl_mem > &inputBuff, - std::vector< cl_mem > &outputBuff) -{ - - // 1d with normal length will fall into the below category - // add: 2d transpose kernel will fall into here too. - inputBuff.reserve( 2 ); - outputBuff.reserve( 2 ); - - // Decode the relevant properties from the plan paramter to figure out how many input/output buffers we have - switch( fftPlan->inputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - // Invalid to be an inplace transform, and go from 1 to 2 buffers - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_HERMITIAN_PLANAR: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_HERMITIAN_PLANAR: - { - return CLFFT_INVALID_ARG_VALUE; - } - case CLFFT_REAL: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - inputBuff.push_back( clInputBuffers[ 1 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - break; - } - case CLFFT_REAL: - { - switch( fftPlan->outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_COMPLEX_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - case CLFFT_HERMITIAN_INTERLEAVED: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - - break; - } - case CLFFT_HERMITIAN_PLANAR: - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - - outputBuff.push_back( clOutputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 1 ] ); - } - - break; - } - default: - { - if(fftPlan->transflag) - { - if( fftPlan->placeness == CLFFT_INPLACE ) - { - return CLFFT_INVALID_ARG_VALUE; - } - else - { - inputBuff.push_back( clInputBuffers[ 0 ] ); - outputBuff.push_back( clOutputBuffers[ 0 ] ); - } - } - else - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - } - - break; - } - default: - { - // Don't recognize output layout - return CLFFT_INVALID_ARG_VALUE; - } - } - - return CLFFT_SUCCESS; +clfftStatus FFTAction::selectBufferArguments(FFTPlan *fftPlan, + cl_mem *clInputBuffers, + cl_mem *clOutputBuffers, + std::vector &inputBuff, + std::vector &outputBuff) { + + // 1d with normal length will fall into the below category + // add: 2d transpose kernel will fall into here too. + inputBuff.reserve(2); + outputBuff.reserve(2); + + // Decode the relevant properties from the plan paramter to figure out how + //many input/output buffers we have + switch (fftPlan->inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + switch (fftPlan->outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + inputBuff.push_back(clInputBuffers[0]); + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + // Invalid to be an inplace transform, and go from 1 to 2 buffers + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_REAL: { + if (fftPlan->placeness == CLFFT_INPLACE) { + inputBuff.push_back(clInputBuffers[0]); + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + default: { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_COMPLEX_PLANAR: { + switch (fftPlan->outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_REAL: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + default: { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + switch (fftPlan->outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_HERMITIAN_PLANAR: { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_REAL: { + if (fftPlan->placeness == CLFFT_INPLACE) { + inputBuff.push_back(clInputBuffers[0]); + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + default: { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: { + switch (fftPlan->outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_HERMITIAN_PLANAR: { + return CLFFT_INVALID_ARG_VALUE; + } + case CLFFT_REAL: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + inputBuff.push_back(clInputBuffers[1]); + + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + default: { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + break; + } + case CLFFT_REAL: { + switch (fftPlan->outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + inputBuff.push_back(clInputBuffers[0]); + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_COMPLEX_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: { + if (fftPlan->placeness == CLFFT_INPLACE) { + inputBuff.push_back(clInputBuffers[0]); + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + + break; + } + case CLFFT_HERMITIAN_PLANAR: { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + + outputBuff.push_back(clOutputBuffers[0]); + outputBuff.push_back(clOutputBuffers[1]); + } + + break; + } + default: { + if (fftPlan->transflag) { + if (fftPlan->placeness == CLFFT_INPLACE) { + return CLFFT_INVALID_ARG_VALUE; + } else { + inputBuff.push_back(clInputBuffers[0]); + outputBuff.push_back(clOutputBuffers[0]); + } + } else { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + } + + break; + } + default: { + // Don't recognize output layout + return CLFFT_INVALID_ARG_VALUE; + } + } + + return CLFFT_SUCCESS; } - -clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, - clfftDirection dir, - cl_uint numQueuesAndEvents, - cl_command_queue* commQueues, - cl_uint numWaitEvents, - const cl_event* waitEvents, - cl_event* outEvents, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers) -{ - FFTRepo & fftRepo = FFTRepo::getInstance(); - - std::vector< cl_mem > inputBuff; - std::vector< cl_mem > outputBuff; - - - clfftStatus status = selectBufferArguments(this->plan, - clInputBuffers, clOutputBuffers, - inputBuff, outputBuff); - - if (status != CLFFT_SUCCESS) - { - return status; - } - - // TODO: In the case of length == 1, FFT is a trivial NOP, but we still need to apply the forward and backwards tranforms - // TODO: Are map lookups expensive to call here? We can cache a pointer to the cl_program/cl_kernel in the plan - - // Translate the user plan into the structure that we use to map plans to clPrograms - - cl_program prog; - cl_kernel kern; - lockRAII* kernelLock; - OPENCL_V( fftRepo.getclProgram( this->getGenerator(), this->getSignatureData(), prog, this->plan->bakeDevice, this->plan->context ), _T( "fftRepo.getclProgram failed" ) ); - OPENCL_V( fftRepo.getclKernel( prog, dir, kern, kernelLock), _T( "fftRepo.getclKernels failed" ) ); - - scopedLock sLock(*kernelLock, _T("FFTAction::enqueue")); - - cl_uint uarg = 0; - if (!this->plan->transflag && !(this->plan->gen == Copy)) - { - // ::clSetKernelArg() is not thread safe, according to the openCL spec for the same cl_kernel object - // TODO: Need to verify that two different plans (which would get through our lock above) with exactly the same - // parameters would NOT share the same cl_kernel objects - - /* constant buffer */ - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->const_buffer ), _T( "clSetKernelArg failed" ) ); - } - - // Input buffer(s) - // Input may be 1 buffer (CLFFT_COMPLEX_INTERLEAVED) - // or 2 buffers (CLFFT_COMPLEX_PLANAR) - - for (size_t i = 0; i < inputBuff.size(); ++i) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&inputBuff[i] ), _T( "clSetKernelArg failed" ) ); - } - // Output buffer(s) - // Output may be 0 buffers (CLFFT_INPLACE) - // or 1 buffer (CLFFT_COMPLEX_INTERLEAVED) - // or 2 buffers (CLFFT_COMPLEX_PLANAR) - for (size_t o = 0; o < outputBuff.size(); ++o) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&outputBuff[o] ), _T( "clSetKernelArg failed" ) ); - } - - //If callback function is set for the plan, pass the appropriate aruments - if (this->plan->hasPreCallback || this->plan->hasPostCallback) - { - if (this->plan->hasPreCallback) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->precallUserData ), _T( "clSetKernelArg failed" ) ); - } - - //If post-callback function is set for the plan, pass the appropriate aruments - if (this->plan->hasPostCallback) - { - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof( cl_mem ), (void*)&this->plan->postcallUserData ), _T( "clSetKernelArg failed" ) ); - } - - //Pass LDS size arument if set - if ((this->plan->hasPreCallback && this->plan->preCallback.localMemSize > 0) || - (this->plan->hasPostCallback && this->plan->postCallbackParam.localMemSize > 0)) - { - int localmemSize = 0; - if (this->plan->hasPreCallback && this->plan->preCallback.localMemSize > 0) - localmemSize = this->plan->preCallback.localMemSize; - if (this->plan->hasPostCallback && this->plan->postCallbackParam.localMemSize > 0) - localmemSize += this->plan->postCallbackParam.localMemSize; - - OPENCL_V( clSetKernelArg( kern, uarg++, localmemSize, NULL ), _T( "clSetKernelArg failed" ) ); - } - } - - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof(int), (void*)&this->plan->offsetIn ), _T( "clSetKernelArg failed" ) ); - OPENCL_V( clSetKernelArg( kern, uarg++, sizeof(int), (void*)&this->plan->offsetOut ), _T( "clSetKernelArg failed" ) ); - - std::vector< size_t > gWorkSize; - std::vector< size_t > lWorkSize; - clfftStatus result = this->getWorkSizes (gWorkSize, lWorkSize); - //std::cout << "work sizes are " << gWorkSize[0] << ", " << lWorkSize[0] << std::endl; - /* - std::cout << "work sizes are "; - for (auto itor = gWorkSize.begin(); itor != gWorkSize.end(); itor++) - std::cout << *itor << " "; - std::cout << ", "; - for (auto itor = lWorkSize.begin(); itor != lWorkSize.end(); itor++) - std::cout << *itor << " "; - std::cout << std::endl; - */ - // TODO: if getWorkSizes returns CLFFT_INVALID_GLOBAL_WORK_SIZE, that means - // that this multidimensional input data array is too large to be transformed - // with a single call to clEnqueueNDRangeKernel. For now, we will just return - // the error code back up the call stack. - // The *correct* course of action would be to split the work into mutliple - // calls to clEnqueueNDRangeKernel. - if (CLFFT_INVALID_GLOBAL_WORK_SIZE == result) - { - OPENCL_V( result, _T("Work size too large for clEnqueNDRangeKernel()")); - } - else - { - OPENCL_V( result, _T("FFTAction::getWorkSizes failed")); - } - BUG_CHECK (gWorkSize.size() == lWorkSize.size()); - - cl_int call_status = clEnqueueNDRangeKernel( *commQueues, kern, static_cast< cl_uint >( gWorkSize.size( ) ), - NULL, &gWorkSize[ 0 ], &lWorkSize[ 0 ], numWaitEvents, waitEvents, outEvents ); - OPENCL_V( call_status, _T( "clEnqueueNDRangeKernel failed" ) ); - - if( fftRepo.pStatTimer ) - { - fftRepo.pStatTimer->AddSample( plHandle, this->plan, kern, numQueuesAndEvents, outEvents, gWorkSize, lWorkSize ); - } - - return CLFFT_SUCCESS; +clfftStatus FFTAction::enqueue(clfftPlanHandle plHandle, clfftDirection dir, + cl_uint numQueuesAndEvents, + cl_command_queue *commQueues, + cl_uint numWaitEvents, + const cl_event *waitEvents, cl_event *outEvents, + cl_mem *clInputBuffers, + cl_mem *clOutputBuffers) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + + std::vector inputBuff; + std::vector outputBuff; + + clfftStatus status = selectBufferArguments( + this->plan, clInputBuffers, clOutputBuffers, inputBuff, outputBuff); + + if (status != CLFFT_SUCCESS) { + return status; + } + + // TODO: In the case of length == 1, FFT is a trivial NOP, but we still + //need to apply the forward and backwards tranforms + // TODO: Are map lookups expensive to call here? We can cache a pointer + //to the cl_program/cl_kernel in the plan + + // Translate the user plan into the structure that we use to map plans to + //clPrograms + + cl_program prog; + cl_kernel kern; + lockRAII *kernelLock; + OPENCL_V(fftRepo.getclProgram(this->getGenerator(), this->getSignatureData(), + prog, this->plan->bakeDevice, + this->plan->context), + _T( "fftRepo.getclProgram failed" )); + OPENCL_V(fftRepo.getclKernel(prog, dir, kern, kernelLock), + _T( "fftRepo.getclKernels failed" )); + + scopedLock sLock(*kernelLock, _T("FFTAction::enqueue")); + + cl_uint uarg = 0; + if (!this->plan->transflag && !(this->plan->gen == Copy)) { + // ::clSetKernelArg() is not thread safe, according to the openCL spec for + //the same cl_kernel object + // TODO: Need to verify that two different plans (which would get through + //our lock above) with exactly the same parameters would NOT share the same + //cl_kernel objects + + /* constant buffer */ + OPENCL_V(clSetKernelArg(kern, uarg++, sizeof(cl_mem), + (void *)&this->plan->const_buffer), + _T( "clSetKernelArg failed" )); + } + + // Input buffer(s) + // Input may be 1 buffer (CLFFT_COMPLEX_INTERLEAVED) + // or 2 buffers (CLFFT_COMPLEX_PLANAR) + + for (auto & i : inputBuff) { + OPENCL_V( + clSetKernelArg(kern, uarg++, sizeof(cl_mem), (void *)&i), + _T( "clSetKernelArg failed" )); + } + // Output buffer(s) + // Output may be 0 buffers (CLFFT_INPLACE) + // or 1 buffer (CLFFT_COMPLEX_INTERLEAVED) + // or 2 buffers (CLFFT_COMPLEX_PLANAR) + for (auto & o : outputBuff) { + OPENCL_V( + clSetKernelArg(kern, uarg++, sizeof(cl_mem), (void *)&o), + _T( "clSetKernelArg failed" )); + } + + // If callback function is set for the plan, pass the appropriate aruments + if (this->plan->hasPreCallback || this->plan->hasPostCallback) { + if (this->plan->hasPreCallback) { + OPENCL_V(clSetKernelArg(kern, uarg++, sizeof(cl_mem), + (void *)&this->plan->precallUserData), + _T( "clSetKernelArg failed" )); + } + + // If post-callback function is set for the plan, pass the appropriate + // aruments + if (this->plan->hasPostCallback) { + OPENCL_V(clSetKernelArg(kern, uarg++, sizeof(cl_mem), + (void *)&this->plan->postcallUserData), + _T( "clSetKernelArg failed" )); + } + + // Pass LDS size arument if set + if ((this->plan->hasPreCallback && + this->plan->preCallback.localMemSize > 0) || + (this->plan->hasPostCallback && + this->plan->postCallbackParam.localMemSize > 0)) { + int localmemSize = 0; + if (this->plan->hasPreCallback && + this->plan->preCallback.localMemSize > 0) + localmemSize = this->plan->preCallback.localMemSize; + if (this->plan->hasPostCallback && + this->plan->postCallbackParam.localMemSize > 0) + localmemSize += this->plan->postCallbackParam.localMemSize; + + OPENCL_V(clSetKernelArg(kern, uarg++, localmemSize, nullptr), + _T( "clSetKernelArg failed" )); + } + } + + OPENCL_V( + clSetKernelArg(kern, uarg++, sizeof(int), (void *)&this->plan->offsetIn), + _T( "clSetKernelArg failed" )); + OPENCL_V( + clSetKernelArg(kern, uarg++, sizeof(int), (void *)&this->plan->offsetOut), + _T( "clSetKernelArg failed" )); + + std::vector gWorkSize; + std::vector lWorkSize; + clfftStatus result = this->getWorkSizes(gWorkSize, lWorkSize); + // std::cout << "work sizes are " << gWorkSize[0] << ", " << lWorkSize[0] << + // std::endl; + /* + std::cout << "work sizes are "; + for (auto itor = gWorkSize.begin(); itor != gWorkSize.end(); itor++) + std::cout << *itor << " "; + std::cout << ", "; + for (auto itor = lWorkSize.begin(); itor != lWorkSize.end(); itor++) + std::cout << *itor << " "; + std::cout << std::endl; + */ + // TODO: if getWorkSizes returns CLFFT_INVALID_GLOBAL_WORK_SIZE, that means + // that this multidimensional input data array is too large to be transformed + // with a single call to clEnqueueNDRangeKernel. For now, we will just return + // the error code back up the call stack. + // The *correct* course of action would be to split the work into mutliple + // calls to clEnqueueNDRangeKernel. + if (CLFFT_INVALID_GLOBAL_WORK_SIZE == result) { + OPENCL_V(result, _T("Work size too large for clEnqueNDRangeKernel()")); + } else { + OPENCL_V(result, _T("FFTAction::getWorkSizes failed")); + } + BUG_CHECK(gWorkSize.size() == lWorkSize.size()); + + cl_int call_status = clEnqueueNDRangeKernel( + *commQueues, kern, static_cast(gWorkSize.size()), nullptr, + &gWorkSize[0], &lWorkSize[0], numWaitEvents, waitEvents, outEvents); + OPENCL_V(call_status, _T( "clEnqueueNDRangeKernel failed" )); + + if (fftRepo.pStatTimer) { + fftRepo.pStatTimer->AddSample(plHandle, this->plan, kern, + numQueuesAndEvents, outEvents, gWorkSize, + lWorkSize); + } + + return CLFFT_SUCCESS; } - - // Read the kernels that this plan uses from file, and store into the plan -clfftStatus FFTAction::writeKernel( const clfftPlanHandle plHandle, const clfftGenerators gen, const FFTKernelSignatureHeader* data, const cl_context& context, const cl_device_id &device ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - - std::string kernelPath = getKernelName(gen, plHandle, true); - - // Logic to write string contents out to file - tofstreamRAII< std::ofstream, std::string > kernelFile( kernelPath.c_str( ) ); - if( !kernelFile.get( ) ) - { - std::cerr << "Failed to open kernel file for writing: " << kernelPath.c_str( ) << std::endl; - return CLFFT_FILE_CREATE_FAILURE; - } - - std::string kernel; - OPENCL_V( fftRepo.getProgramCode( gen, data, kernel, device, context ), _T( "fftRepo.getProgramCode failed." ) ); - - kernelFile.get( ) << kernel << std::endl; - - return CLFFT_SUCCESS; +clfftStatus FFTAction::writeKernel(const clfftPlanHandle plHandle, + const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const cl_context &context, + const cl_device_id &device) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + + std::string kernelPath = getKernelName(gen, plHandle, true); + + // Logic to write string contents out to file + tofstreamRAII kernelFile(kernelPath.c_str()); + if (!kernelFile.get()) { + std::cerr << "Failed to open kernel file for writing: " + << kernelPath.c_str() << std::endl; + return CLFFT_FILE_CREATE_FAILURE; + } + + std::string kernel; + OPENCL_V(fftRepo.getProgramCode(gen, data, kernel, device, context), + _T( "fftRepo.getProgramCode failed." )); + + kernelFile.get() << kernel << std::endl; + + return CLFFT_SUCCESS; } - // **************** TODO TODO TODO *********************** -// Making compileKernels function take in command queue parameter so we can build for 1 particular device only; -// this may not be desirable for persistent plans, where we may have to compile for all devices in the context; -// make changes appropriately before enabling persistent plans and then remove this comment +// Making compileKernels function take in command queue parameter so we can +// build for 1 particular device only; this may not be desirable for persistent +// plans, where we may have to compile for all devices in the context; make +// changes appropriately before enabling persistent plans and then remove this +// comment // Compile the kernels that this plan uses, and store into the plan -clfftStatus FFTAction::compileKernels( const cl_command_queue commQueueFFT, const clfftPlanHandle plHandle, FFTPlan* fftPlan ) -{ - cl_int status = 0; - size_t deviceListSize = 0; +clfftStatus FFTAction::compileKernels(const cl_command_queue commQueueFFT, + const clfftPlanHandle plHandle, + FFTPlan *fftPlan) { + cl_int status = 0; + size_t deviceListSize = 0; - FFTRepo& fftRepo = FFTRepo::getInstance( ); + FFTRepo &fftRepo = FFTRepo::getInstance(); - // create a cl program executable for the device associated with command queue - // Get the device - cl_device_id &q_device = fftPlan->bakeDevice; + // create a cl program executable for the device associated with command queue + // Get the device + cl_device_id &q_device = fftPlan->bakeDevice; - cl_program program; - if( fftRepo.getclProgram( this->getGenerator(), this->getSignatureData(), program, q_device, fftPlan->context ) == CLFFT_INVALID_PROGRAM ) - { - FFTBinaryLookup lookup (this->getGenerator(), plHandle, fftPlan->context, q_device); + cl_program program; + if (fftRepo.getclProgram(this->getGenerator(), this->getSignatureData(), + program, q_device, + fftPlan->context) == CLFFT_INVALID_PROGRAM) { + FFTBinaryLookup lookup(this->getGenerator(), plHandle, fftPlan->context, + q_device); - lookup.variantRaw(this->getSignatureData(), this->getSignatureData()->datasize); + lookup.variantRaw(this->getSignatureData(), + this->getSignatureData()->datasize); - if (lookup.found()) - { + if (lookup.found()) { #if FFT_CACHE_DEBUG - // debug message in debug mode to ensure that the cache is used - fprintf(stderr, "Kernel loaded from cache\n"); + // debug message in debug mode to ensure that the cache is used + fprintf(stderr, "Kernel loaded from cache\n"); #endif - program = lookup.getProgram(); - } - else - { + program = lookup.getProgram(); + } else { #if FFT_CACHE_DEBUG - fprintf(stderr, "Kernel built from source\n"); + fprintf(stderr, "Kernel built from source\n"); #endif - // If the user wishes us to write the kernels out to disk, we do so - //if( fftRepo.setupData.debugFlags & CLFFT_DUMP_PROGRAMS ) - //{ - OPENCL_V( writeKernel( plHandle, this->getGenerator(), this->getSignatureData(), fftPlan->context, fftPlan->bakeDevice ), _T( "writeKernel failed." ) ); - //} - - std::string programCode; - OPENCL_V( fftRepo.getProgramCode( this->getGenerator(), this->getSignatureData(), programCode, q_device, fftPlan->context ), _T( "fftRepo.getProgramCode failed." ) ); - - const char* source = programCode.c_str(); - program = clCreateProgramWithSource( fftPlan->context, 1, &source, NULL, &status ); - OPENCL_V( status, _T( "clCreateProgramWithSource failed." ) ); - - // create a cl program executable for the device associated with command queue + // If the user wishes us to write the kernels out to disk, we do so + // if( fftRepo.setupData.debugFlags & CLFFT_DUMP_PROGRAMS ) + //{ + #warning "Always writing generated kernel to file" + OPENCL_V(writeKernel(plHandle, this->getGenerator(), + this->getSignatureData(), fftPlan->context, + fftPlan->bakeDevice), + _T( "writeKernel failed." )); + //} + + std::string programCode; + OPENCL_V(fftRepo.getProgramCode(this->getGenerator(), + this->getSignatureData(), programCode, + q_device, fftPlan->context), + _T( "fftRepo.getProgramCode failed." )); + + const char *source = programCode.c_str(); + program = clCreateProgramWithSource(fftPlan->context, 1, &source, nullptr, + &status); + OPENCL_V(status, _T( "clCreateProgramWithSource failed." )); + + // create a cl program executable for the device associated with command + // queue #if defined(DEBUGGING) - status = clBuildProgram( program, 1, &q_device, "-g -cl-opt-disable", NULL, NULL); // good for debugging kernels + status = clBuildProgram(program, 1, &q_device, "-g -cl-opt-disable", NULL, + NULL); // good for debugging kernels - // if you have trouble creating smbols that GDB can pick up to set a breakpoint after kernels are loaded into memory - // this can be used to stop execution to allow you to set a breakpoint in a kernel after kernel symbols are in memory. + // if you have trouble creating smbols that GDB can pick up to set a + // breakpoint after kernels are loaded into memory this can be used to + // stop execution to allow you to set a breakpoint in a kernel after + // kernel symbols are in memory. #ifdef DEBUG_BREAK_GDB - __debugbreak(); + __debugbreak(); #endif #else - status = clBuildProgram( program, 1, &q_device, "", NULL, NULL); + +#warning "clBuildPrograms options are -cl-unsafe-math-optimizations" + status = clBuildProgram(program, 1, &q_device, "-cl-unsafe-math-optimizations", nullptr, nullptr); #endif - if( status != CL_SUCCESS ) - { - if( status == CL_BUILD_PROGRAM_FAILURE ) - { - size_t buildLogSize = 0; - OPENCL_V( clGetProgramBuildInfo( program, q_device, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildLogSize ), - _T( "clGetProgramBuildInfo failed" ) ); - - std::vector< char > buildLog( buildLogSize ); - ::memset( &buildLog[ 0 ], 0x0, buildLogSize ); - - OPENCL_V( clGetProgramBuildInfo( program, q_device, CL_PROGRAM_BUILD_LOG, buildLogSize, &buildLog[ 0 ], NULL ), - _T( "clGetProgramBuildInfo failed" ) ); - - std::cerr << "\n\t\t\tBUILD LOG\n"; - std::cerr << "************************************************\n"; - std::cerr << &buildLog[ 0 ] << std::endl; - std::cerr << "************************************************\n"; - } - - OPENCL_V( status, _T( "clBuildProgram failed" ) ); - } - - lookup.setProgram(program, source); - lookup.populateCache(); - } - - fftRepo.setclProgram( this->getGenerator(), this->getSignatureData(), program, q_device, fftPlan->context ); - - - // For real transforms we compile either forward or backward kernel - bool buildFwdKernel = buildForwardKernel(); - bool buildBwdKernel = buildBackwardKernel(); - - // get a kernel object handle for a kernel with the given name - cl_kernel kernel; - if( buildFwdKernel ) - { - lockRAII *kernelLock; - if( fftRepo.getclKernel( program, CLFFT_FORWARD, kernel, kernelLock) == CLFFT_INVALID_KERNEL ) - { - std::string entryPoint; - OPENCL_V( fftRepo.getProgramEntryPoint( this->getGenerator(), this->getSignatureData(), CLFFT_FORWARD, entryPoint, q_device, fftPlan->context ), _T( "fftRepo.getProgramEntryPoint failed." ) ); - - kernel = clCreateKernel( program, entryPoint.c_str( ), &status ); - OPENCL_V( status, _T( "clCreateKernel failed" ) ); - - fftRepo.setclKernel( program, CLFFT_FORWARD, kernel ); - } - } - - if( buildBwdKernel ) - { - lockRAII *kernelLock; - if( fftRepo.getclKernel( program, CLFFT_BACKWARD, kernel, kernelLock ) == CLFFT_INVALID_KERNEL ) - { - std::string entryPoint; - OPENCL_V( fftRepo.getProgramEntryPoint( this->getGenerator(), this->getSignatureData(), CLFFT_BACKWARD, entryPoint, q_device, fftPlan->context ), _T( "fftRepo.getProgramEntryPoint failed." ) ); - - kernel = clCreateKernel( program, entryPoint.c_str( ), &status ); - OPENCL_V( status, _T( "clCreateKernel failed" ) ); - - fftRepo.setclKernel( program, CLFFT_BACKWARD, kernel ); - } - } - } - - return CLFFT_SUCCESS; + if (status != CL_SUCCESS) { + if (status == CL_BUILD_PROGRAM_FAILURE) { + size_t buildLogSize = 0; + OPENCL_V(clGetProgramBuildInfo(program, q_device, + CL_PROGRAM_BUILD_LOG, 0, nullptr, + &buildLogSize), + _T( "clGetProgramBuildInfo failed" )); + + std::vector buildLog(buildLogSize); + ::memset(&buildLog[0], 0x0, buildLogSize); + + OPENCL_V(clGetProgramBuildInfo(program, q_device, + CL_PROGRAM_BUILD_LOG, buildLogSize, + &buildLog[0], nullptr), + _T( "clGetProgramBuildInfo failed" )); + + std::cerr << "\n\t\t\tBUILD LOG\n"; + std::cerr << "************************************************\n"; + std::cerr << &buildLog[0] << std::endl; + std::cerr << "************************************************\n"; + } + + OPENCL_V(status, _T( "clBuildProgram failed" )); + } + + lookup.setProgram(program, source); + lookup.populateCache(); + } + + fftRepo.setclProgram(this->getGenerator(), this->getSignatureData(), + program, q_device, fftPlan->context); + + // For real transforms we compile either forward or backward kernel + bool buildFwdKernel = buildForwardKernel(); + bool buildBwdKernel = buildBackwardKernel(); + + // get a kernel object handle for a kernel with the given name + cl_kernel kernel; + if (buildFwdKernel) { + lockRAII *kernelLock; + if (fftRepo.getclKernel(program, CLFFT_FORWARD, kernel, kernelLock) == + CLFFT_INVALID_KERNEL) { + std::string entryPoint; + OPENCL_V(fftRepo.getProgramEntryPoint( + this->getGenerator(), this->getSignatureData(), + CLFFT_FORWARD, entryPoint, q_device, fftPlan->context), + _T( "fftRepo.getProgramEntryPoint failed." )); + + kernel = clCreateKernel(program, entryPoint.c_str(), &status); + OPENCL_V(status, _T( "clCreateKernel failed" )); + + fftRepo.setclKernel(program, CLFFT_FORWARD, kernel); + } + } + + if (buildBwdKernel) { + lockRAII *kernelLock; + if (fftRepo.getclKernel(program, CLFFT_BACKWARD, kernel, kernelLock) == + CLFFT_INVALID_KERNEL) { + std::string entryPoint; + OPENCL_V(fftRepo.getProgramEntryPoint( + this->getGenerator(), this->getSignatureData(), + CLFFT_BACKWARD, entryPoint, q_device, fftPlan->context), + _T( "fftRepo.getProgramEntryPoint failed." )); + + kernel = clCreateKernel(program, entryPoint.c_str(), &status); + OPENCL_V(status, _T( "clCreateKernel failed" )); + + fftRepo.setclKernel(program, CLFFT_BACKWARD, kernel); + } + } + } + + return CLFFT_SUCCESS; } - - diff --git a/src/library/fft_binary_lookup.cpp b/src/library/fft_binary_lookup.cpp index ff386e28..ef14908f 100644 --- a/src/library/fft_binary_lookup.cpp +++ b/src/library/fft_binary_lookup.cpp @@ -20,26 +20,25 @@ #include "fft_binary_lookup.h" -#include -#include #include +#include +#include -#include -#include +#include +#include +#include #include -#include #include -#include +#include #ifdef _WIN32 -#include #include // for _mkdir +#include #else #include #endif -extern "C" -{ +extern "C" { #include "md5sum.h" } @@ -48,17 +47,15 @@ extern "C" #define ENABLE_SOURCE_DUMP 0 - #define CAPS_DEBUG 0 -#include +#include -static char * sep() -{ +static char *sep() { #ifdef _WIN32 - return (char*)"\\"; + return (char *)"\\"; #else - return (char*)"/"; + return (char *)"/"; #endif } @@ -66,692 +63,582 @@ static std::string cache_path; static bool cache_enabled(false); static bool request_nomemalloc(false); -void clfftInitRequestLibNoMemAlloc() -{ - const char * val = getenv("CLFFT_REQUEST_LIB_NOMEMALLOC"); +void clfftInitRequestLibNoMemAlloc() { + const char *val = getenv("CLFFT_REQUEST_LIB_NOMEMALLOC"); - if (val) - request_nomemalloc = true; + if (val) + request_nomemalloc = true; } -bool clfftGetRequestLibNoMemAlloc() -{ - return request_nomemalloc; -} +bool clfftGetRequestLibNoMemAlloc() { return request_nomemalloc; } -void clfftInitBinaryCache() -{ - const char * path = getenv("CLFFT_CACHE_PATH"); - if (path) - { - cache_path = std::string(path) + sep(); - cache_enabled = true; - } - else - { - cache_path = ""; - } +void clfftInitBinaryCache() { + const char *path = getenv("CLFFT_CACHE_PATH"); + if (path) { + cache_path = std::string(path) + sep(); + cache_enabled = true; + } else { + cache_path = ""; + } } -FFTBinaryLookup::CacheEntry::CacheEntry(const std::string & filename) - : m_filename(filename), m_successful_creation(false) -{ +FFTBinaryLookup::CacheEntry::CacheEntry(const std::string &filename) + : m_filename(filename), m_successful_creation(false) {} -} - -void FFTBinaryLookup::CacheEntry::close() -{ +void FFTBinaryLookup::CacheEntry::close() { #ifdef _WIN32 - CloseHandle(this->m_handle); + CloseHandle(this->m_handle); #else - ::close(*(int*)this->m_handle); - //delete (int*)this->m_handle; + ::close(*(int *)this->m_handle); + // delete (int*)this->m_handle; #endif } -bool FFTBinaryLookup::CacheEntry::successful_creation() -{ - return this->m_successful_creation; +bool FFTBinaryLookup::CacheEntry::successful_creation() { + return this->m_successful_creation; } -bool FFTBinaryLookup::CacheEntry::exclusive_create() -{ +bool FFTBinaryLookup::CacheEntry::exclusive_create() { #ifdef _WIN32 - std::wstring tmp; - tmp.assign(this->m_filename.begin(), this->m_filename.end()); - - HANDLE handle = CreateFile(tmp.c_str(), - GENERIC_WRITE, - 0, // no share with other process - NULL, - CREATE_NEW, - FILE_ATTRIBUTE_NORMAL, - NULL); - - this->m_handle = handle; - this->m_successful_creation = (handle != INVALID_HANDLE_VALUE); - return this->m_successful_creation; + std::wstring tmp; + tmp.assign(this->m_filename.begin(), this->m_filename.end()); + + HANDLE handle = CreateFile(tmp.c_str(), GENERIC_WRITE, + 0, // no share with other process + NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + + this->m_handle = handle; + this->m_successful_creation = (handle != INVALID_HANDLE_VALUE); + return this->m_successful_creation; #else - int * fd = new int; - *fd = open (this->m_filename.c_str(), - O_CREAT | O_EXCL, - S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); - this->m_handle = fd; - this->m_successful_creation = (*fd != -1); - return *fd >= 0; + int *fd = new int; + *fd = open(this->m_filename.c_str(), O_CREAT | O_EXCL, + S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + this->m_handle = fd; + this->m_successful_creation = (*fd != -1); + return *fd >= 0; #endif } -FFTBinaryLookup::FFTBinaryLookup(const clfftGenerators gen, const clfftPlanHandle plHandle, cl_context ctxt, cl_device_id device) - : m_context(ctxt), m_device(device), m_program(NULL), m_binary(0), m_signature(0), m_cache_enabled(cache_enabled) -{ - // initialize the entry name - this->m_cache_entry_name = getKernelName(gen, plHandle, false); +FFTBinaryLookup::FFTBinaryLookup(const clfftGenerators gen, + const clfftPlanHandle plHandle, + cl_context ctxt, cl_device_id device) + : m_context(ctxt), m_device(device), m_program(nullptr), m_binary(nullptr), + m_signature(nullptr), m_cache_enabled(cache_enabled) { + // initialize the entry name + this->m_cache_entry_name = getKernelName(gen, plHandle, false); - if (this->m_cache_enabled) - { - // retrieve device informations to compute the path of the cache - cl_int err = this->retrieveDeviceAndDriverInfo(); + if (this->m_cache_enabled) { + // retrieve device informations to compute the path of the cache + cl_int err = this->retrieveDeviceAndDriverInfo(); - if (err != CL_SUCCESS) - { - cache_enabled = false; - this->m_cache_enabled = false; - } + if (err != CL_SUCCESS) { + cache_enabled = false; + this->m_cache_enabled = false; } + } } -FFTBinaryLookup::~FFTBinaryLookup() -{ - if (this->m_binary != NULL) - { - delete[] this->m_binary; - this->m_binary = 0; - } +FFTBinaryLookup::~FFTBinaryLookup() { + if (this->m_binary != nullptr) { + delete[] this->m_binary; + this->m_binary = nullptr; + } - if (this->m_signature != NULL) - { - delete[] this->m_signature; - this->m_signature = 0; - } + if (this->m_signature != nullptr) { + delete[] this->m_signature; + this->m_signature = nullptr; + } } FFTBinaryLookup::Variant::Variant() - : m_kind((VariantKind)0), m_size(0), m_data(0) -{ -} + : m_kind((VariantKind)0), m_size(0), m_data(nullptr) {} -FFTBinaryLookup::Variant::Variant(VariantKind kind, char * data, size_t size) - : m_kind(kind), m_size(size) -{ - this->m_data = new char[this->m_size]; - memcpy(this->m_data, data, size); +FFTBinaryLookup::Variant::Variant(VariantKind kind, char *data, size_t size) + : m_kind(kind), m_size(size) { + this->m_data = new char[this->m_size]; + memcpy(this->m_data, data, size); } FFTBinaryLookup::Variant::Variant(const Variant &obj) - : m_kind(obj.m_kind), m_size(obj.m_size) -{ - this->m_data = new char[this->m_size]; - memcpy(this->m_data, obj.m_data, m_size); + : m_kind(obj.m_kind), m_size(obj.m_size) { + this->m_data = new char[this->m_size]; + memcpy(this->m_data, obj.m_data, m_size); } -FFTBinaryLookup::Variant &FFTBinaryLookup::Variant::operator=(const Variant &obj) -{ - if (this->m_data != NULL) - { - delete[] this->m_data; - this->m_data = 0; - } +FFTBinaryLookup::Variant & +FFTBinaryLookup::Variant::operator=(const Variant &obj) { + if (this->m_data != nullptr) { + delete[] this->m_data; + this->m_data = nullptr; + } - m_kind = obj.m_kind; - m_size = obj.m_size; + m_kind = obj.m_kind; + m_size = obj.m_size; - this->m_data = new char[this->m_size]; - memcpy(this->m_data, obj.m_data, m_size); + this->m_data = new char[this->m_size]; + memcpy(this->m_data, obj.m_data, m_size); - return *this; + return *this; } -FFTBinaryLookup::Variant::~Variant() -{ - if (this->m_data != NULL) - { - delete[] this->m_data; - this->m_data = 0; - } +FFTBinaryLookup::Variant::~Variant() { + if (this->m_data != nullptr) { + delete[] this->m_data; + this->m_data = nullptr; + } } -void FFTBinaryLookup::variantInt(int num) -{ - m_variants.push_back(Variant(INT, (char*)&num, sizeof(num))); +void FFTBinaryLookup::variantInt(int num) { + m_variants.push_back(Variant(INT, (char *)&num, sizeof(num))); } - -void FFTBinaryLookup::variantDouble(double num) -{ - m_variants.push_back(Variant(DOUBLE, (char*)&num, sizeof(num))); + +void FFTBinaryLookup::variantDouble(double num) { + m_variants.push_back(Variant(DOUBLE, (char *)&num, sizeof(num))); } -void FFTBinaryLookup::variantCompileOptions(const std::string & opts) -{ - m_variants.push_back(Variant(STRING, (char*)opts.c_str(), opts.size())); +void FFTBinaryLookup::variantCompileOptions(const std::string &opts) { + m_variants.push_back(Variant(STRING, (char *)opts.c_str(), opts.size())); } -void FFTBinaryLookup::variantRaw(const void * data, size_t bytes) -{ - m_variants.push_back(Variant(DATA, (char*)data, bytes)); +void FFTBinaryLookup::variantRaw(const void *data, size_t bytes) { + m_variants.push_back(Variant(DATA, (char *)data, bytes)); } -enum BinaryRepresentation -{ - LSB, - MSB, - UNKNOWN -}; +enum BinaryRepresentation { LSB, MSB, UNKNOWN }; -static enum BinaryRepresentation getStorageMode(char * data) -{ - if (data[0] == 'C' && - data[1] == 'L' && - data[2] == 'B' && - data[3] == '\0') - return LSB; +static enum BinaryRepresentation getStorageMode(char *data) { + if (data[0] == 'C' && data[1] == 'L' && data[2] == 'B' && data[3] == '\0') + return LSB; - if (data[0] == 'B' && - data[1] == 'L' && - data[2] == 'C' && - data[3] == '\0') - return MSB; + if (data[0] == 'B' && data[1] == 'L' && data[2] == 'C' && data[3] == '\0') + return MSB; - return UNKNOWN; + return UNKNOWN; } -void FFTBinaryLookup::finalizeVariant() -{ - // serialize variants - size_t whole_variant_size_in_bytes = 0; +void FFTBinaryLookup::finalizeVariant() { + // serialize variants + size_t whole_variant_size_in_bytes = 0; - // store 1 byte for the variant kind - whole_variant_size_in_bytes += this->m_variants.size() * sizeof(int); // for the variant kind - whole_variant_size_in_bytes += this->m_variants.size() * sizeof(size_t); // for the variant size + // store 1 byte for the variant kind + whole_variant_size_in_bytes += + this->m_variants.size() * sizeof(int); // for the variant kind + whole_variant_size_in_bytes += + this->m_variants.size() * sizeof(size_t); // for the variant size - // add every variant sizes - for(size_t i=0 ; im_variants.size() ; ++i) - { - const Variant & v = this->m_variants[i]; + // add every variant sizes + for (auto & v : this->m_variants) { + // compute the whole size of the signature + whole_variant_size_in_bytes += v.m_size; + } - // compute the whole size of the signature - whole_variant_size_in_bytes += v.m_size; - } + this->m_header.signature_size = whole_variant_size_in_bytes; - this->m_header.signature_size = whole_variant_size_in_bytes; + if (this->m_signature != nullptr) { + delete[] this->m_signature; + this->m_signature = nullptr; + } - if (this->m_signature != NULL) - { - delete[] this->m_signature; - this->m_signature = 0; - } + this->m_signature = new char[whole_variant_size_in_bytes]; + char *current_address = this->m_signature; + for (auto v : this->m_variants) { + // write the variant kind + memcpy(current_address, &v.m_kind, sizeof(int)); + current_address += sizeof(v.m_kind); - this->m_signature = new char[whole_variant_size_in_bytes]; - char * current_address = this->m_signature; - for(size_t i=0 ; im_variants.size() ; ++i) - { - Variant v = this->m_variants[i]; + // write the variant size + memcpy(current_address, &v.m_size, sizeof(v.m_size)); + current_address += sizeof(v.m_size); - // write the variant kind - memcpy(current_address, &v.m_kind, sizeof(int)); - current_address += sizeof(v.m_kind); + // write the variant itself + memcpy(current_address, v.m_data, v.m_size); + current_address += v.m_size; + } - // write the variant size - memcpy(current_address, &v.m_size, sizeof(v.m_size)); - current_address += sizeof(v.m_size); - - // write the variant itself - memcpy(current_address, v.m_data, v.m_size); - current_address += v.m_size; - } - - // Update the cache entry name if there are variants... - if (whole_variant_size_in_bytes != 0) - { - char md5_sum[33]; - md5sum(this->m_signature, (unsigned long)this->m_header.signature_size, md5_sum); - this->m_cache_entry_name = md5_sum; - } - else - { - this->m_cache_entry_name += ".db"; - } + // Update the cache entry name if there are variants... + if (whole_variant_size_in_bytes != 0) { + char md5_sum[33]; + md5sum(this->m_signature, (unsigned long)this->m_header.signature_size, + md5_sum); + this->m_cache_entry_name = md5_sum; + } else { + this->m_cache_entry_name += ".db"; + } } -bool FFTBinaryLookup::loadHeader(std::ifstream &file, size_t length) -{ - file.read ((char*)&this->m_header, sizeof(Header)); +bool FFTBinaryLookup::loadHeader(std::ifstream &file, size_t length) { + file.read((char *)&this->m_header, sizeof(Header)); - // FIXME: Consider LSB Vs MSB number representation - assert(getStorageMode(this->m_header.magic_key) == LSB); + // FIXME: Consider LSB Vs MSB number representation + assert(getStorageMode(this->m_header.magic_key) == LSB); - if (this->m_header.whole_file_size != (int)length) - { - // the file has not been correctly initialized (yet) - return false; - } + if (this->m_header.whole_file_size != (int)length) { + // the file has not been correctly initialized (yet) + return false; + } - return true; + return true; } -bool FFTBinaryLookup::loadBinaryAndSignature(std::ifstream &file) -{ - { - this->m_binary = new unsigned char [this->m_header.binary_size]; - const std::istream& res = file.read((char*)this->m_binary, this->m_header.binary_size); - if (!res.good()) - return false; - } +bool FFTBinaryLookup::loadBinaryAndSignature(std::ifstream &file) { + { + this->m_binary = new unsigned char[this->m_header.binary_size]; + const std::istream &res = + file.read((char *)this->m_binary, this->m_header.binary_size); + if (!res.good()) + return false; + } - { - if (this->m_signature != NULL) - { - delete[] this->m_signature; - this->m_signature = 0; - } + { + if (this->m_signature != nullptr) { + delete[] this->m_signature; + this->m_signature = nullptr; + } - this->m_signature = new char [this->m_header.signature_size]; - const std::istream& res = file.read((char*)this->m_signature, this->m_header.signature_size); + this->m_signature = new char[this->m_header.signature_size]; + const std::istream &res = + file.read((char *)this->m_signature, this->m_header.signature_size); - if (!res.good()) - return false; + if (!res.good()) + return false; - this->m_variants.clear(); + this->m_variants.clear(); - char * current = this->m_signature; - for (size_t i=0 ; im_header.signature_size ; ++i) - { - Variant v; - v.m_kind = *(VariantKind*) current; - i += sizeof(int); - current += sizeof(int); + char *current = this->m_signature; + for (size_t i = 0; i < this->m_header.signature_size; ++i) { + Variant v; + v.m_kind = *(VariantKind *)current; + i += sizeof(int); + current += sizeof(int); - v.m_size = *(size_t*) current; - i += sizeof(size_t); - current += sizeof(size_t); + v.m_size = *(size_t *)current; + i += sizeof(size_t); + current += sizeof(size_t); - v.m_data = new char[v.m_size]; - memcpy(v.m_data, current, v.m_size); - i += v.m_size; - current += v.m_size; + v.m_data = new char[v.m_size]; + memcpy(v.m_data, current, v.m_size); + i += v.m_size; + current += v.m_size; - this->m_variants.push_back(v); - } + this->m_variants.push_back(v); } + } - return true; + return true; } -bool FFTBinaryLookup::tryLoadCacheFile() -{ - // may create empty file or may wait until file is ready - const std::string & filename = this->m_path + this->m_cache_entry_name; - std::ifstream file (filename.c_str(), std::ios_base::binary); +bool FFTBinaryLookup::tryLoadCacheFile() { + // may create empty file or may wait until file is ready + const std::string &filename = this->m_path + this->m_cache_entry_name; + std::ifstream file(filename.c_str(), std::ios_base::binary); - if (file.is_open()) - { - file.seekg (0, file.end); - size_t length = file.tellg(); - file.seekg (0, file.beg); + if (file.is_open()) { + file.seekg(0, file.end); + size_t length = file.tellg(); + file.seekg(0, file.beg); - if (length == 0) - { - // the file is corrupted, so return false - return false; - } + if (length == 0) { + // the file is corrupted, so return false + return false; + } - bool st; - st = loadHeader(file, length); + bool st; + st = loadHeader(file, length); - if (! st) - return false; + if (!st) + return false; - st = loadBinaryAndSignature(file); + st = loadBinaryAndSignature(file); - if (! st) - return false; + if (!st) + return false; - file.close(); - return true; - } - else - { - return false; - } + file.close(); + return true; + } else { + return false; + } } -bool FFTBinaryLookup::found() -{ - // if we could not create the directory, it is useless to - if (! this->m_cache_enabled) - { - return false; // not found - } +bool FFTBinaryLookup::found() { + // if we could not create the directory, it is useless to + if (!this->m_cache_enabled) { + return false; // not found + } - this->finalizeVariant(); // serialize variant and cumpute checksum on it - // also compute the tree to search from the cache entry (this->m_cache_entry_name, cache path ??) + this->finalizeVariant(); // serialize variant and cumpute checksum on it + // also compute the tree to search from the cache entry + // (this->m_cache_entry_name, cache path ??) - if (tryLoadCacheFile()) - { - cl_int err = buildFromBinary(this->m_binary, - this->m_header.binary_size); + if (tryLoadCacheFile()) { + cl_int err = buildFromBinary(this->m_binary, this->m_header.binary_size); - // return false if the buildFromBinary failed, true else - return err==CL_SUCCESS; - } + // return false if the buildFromBinary failed, true else + return err == CL_SUCCESS; + } - return false; + return false; } static cl_int getSingleBinaryFromProgram(cl_program program, - std::vector & binary) -{ - // 3 - Determine the size of each program binary - size_t size; - cl_int err = clGetProgramInfo(program, CL_PROGRAM_BINARY_SIZES, - sizeof(size_t), - &size, NULL); - if (err != CL_SUCCESS) - { - std::cerr << "Error querying for program binary sizes" << std::endl; - return err; - } - - binary.resize(size); - binary[0] = new unsigned char[size]; + std::vector &binary) { + // 3 - Determine the size of each program binary + size_t size; + cl_int err = clGetProgramInfo(program, CL_PROGRAM_BINARY_SIZES, + sizeof(size_t), &size, nullptr); + if (err != CL_SUCCESS) { + std::cerr << "Error querying for program binary sizes" << std::endl; + return err; + } - unsigned char * binary_address[1] = { binary[0] }; + binary.resize(size); + binary[0] = new unsigned char[size]; - // 4 - Get all of the program binaries - err = clGetProgramInfo(program, CL_PROGRAM_BINARIES, 1 * sizeof(unsigned char*), - binary_address, NULL); + unsigned char *binary_address[1] = {binary[0]}; + // 4 - Get all of the program binaries + err = clGetProgramInfo(program, CL_PROGRAM_BINARIES, + 1 * sizeof(unsigned char *), binary_address, nullptr); - if (err != CL_SUCCESS) - { - delete[] binary[0]; + if (err != CL_SUCCESS) { + delete[] binary[0]; #if CAPS_DEBUG - std::cerr << "Error querying for program binaries" << std::endl; + std::cerr << "Error querying for program binaries" << std::endl; #endif - return err; - } + return err; + } - return CL_SUCCESS; + return CL_SUCCESS; } -cl_int FFTBinaryLookup::writeCacheFile(std::vector &data) -{ - if (! this->m_cache_enabled) - { - return 0; - } +cl_int FFTBinaryLookup::writeCacheFile(std::vector &data) { + if (!this->m_cache_enabled) { + return 0; + } - // exclusive open to ensure that only one thread will write the file - const std::string & filename = this->m_path + this->m_cache_entry_name; + // exclusive open to ensure that only one thread will write the file + const std::string &filename = this->m_path + this->m_cache_entry_name; - CacheEntry cache_file(filename); - bool created = cache_file.exclusive_create(); + CacheEntry cache_file(filename); + bool created = cache_file.exclusive_create(); - // try to exclusively create the cache file on the disk - if (created) - { - // if it was created by the current thread, this one will write into cache file - cache_file.close(); + // try to exclusively create the cache file on the disk + if (created) { + // if it was created by the current thread, this one will write into cache + // file + cache_file.close(); - const std::string & filename = this->m_path + this->m_cache_entry_name; - std::ofstream file (filename.c_str(), std::ios_base::binary); + const std::string &filename = this->m_path + this->m_cache_entry_name; + std::ofstream file(filename.c_str(), std::ios_base::binary); - file.write((char*)&this->m_header, sizeof(m_header)); - file.write((char*)data[0], this->m_header.binary_size); - file.write((char*)this->m_signature, this->m_header.signature_size); - file.close(); + file.write((char *)&this->m_header, sizeof(m_header)); + file.write((char *)data[0], this->m_header.binary_size); + file.write((char *)this->m_signature, this->m_header.signature_size); + file.close(); #if ENABLE_SOURCE_DUMP - const std::string & srcFilename = this->m_path + this->m_cache_entry_name + ".cl"; - std::ofstream srcFile (srcFilename.c_str()); - srcFile << this->m_source; + const std::string &srcFilename = + this->m_path + this->m_cache_entry_name + ".cl"; + std::ofstream srcFile(srcFilename.c_str()); + srcFile << this->m_source; - srcFile.close(); + srcFile.close(); #endif - return CL_SUCCESS; - } + return CL_SUCCESS; + } - // other thread do not write the cache file - return 1; + // other thread do not write the cache file + return 1; } -cl_int FFTBinaryLookup::populateCache() -{ - // FIXME: support MSB - this->m_header.magic_key[0] = 'C'; - this->m_header.magic_key[1] = 'L'; - this->m_header.magic_key[2] = 'B'; - this->m_header.magic_key[3] = '\0'; +cl_int FFTBinaryLookup::populateCache() { + // FIXME: support MSB + this->m_header.magic_key[0] = 'C'; + this->m_header.magic_key[1] = 'L'; + this->m_header.magic_key[2] = 'B'; + this->m_header.magic_key[3] = '\0'; - std::vector data; - cl_int err = getSingleBinaryFromProgram(this->m_program, data); + std::vector data; + cl_int err = getSingleBinaryFromProgram(this->m_program, data); - if (err != CL_SUCCESS) - { - return err; - } + if (err != CL_SUCCESS) { + return err; + } - this->m_header.header_size = sizeof(Header); - this->m_header.binary_size = data.size(); - this->m_header.whole_file_size = this->m_header.header_size + this->m_header.binary_size + this->m_header.signature_size; + this->m_header.header_size = sizeof(Header); + this->m_header.binary_size = data.size(); + this->m_header.whole_file_size = this->m_header.header_size + + this->m_header.binary_size + + this->m_header.signature_size; - writeCacheFile(data); // ignore return code, because it does nothing if - // the file could not be written (i.e the current - // thread did not create the file - delete [] data[0]; + writeCacheFile(data); // ignore return code, because it does nothing if + // the file could not be written (i.e the current + // thread did not create the file + delete[] data[0]; - return CL_SUCCESS; + return CL_SUCCESS; } -cl_int FFTBinaryLookup::buildFromSource(const char * source) -{ - cl_int err; - this->m_program = FFTBinaryLookup::buildProgramFromSource(source, - this->m_context, - this->m_device, - err); +cl_int FFTBinaryLookup::buildFromSource(const char *source) { + cl_int err; + printf("Binary lookup!\n"); + this->m_program = FFTBinaryLookup::buildProgramFromSource( + source, this->m_context, this->m_device, err); - if (err != CL_SUCCESS) - { - return err; - } + if (err != CL_SUCCESS) { + return err; + } - // write to the cache - this->populateCache(); + // write to the cache + this->populateCache(); - return CL_SUCCESS; + return CL_SUCCESS; } -cl_int FFTBinaryLookup::buildFromLoadedBinary(const void * data, - size_t len) -{ - cl_int err; - this->m_program = FFTBinaryLookup::buildProgramFromBinary((char*) data, - len, - this->m_context, - this->m_device, - err); +cl_int FFTBinaryLookup::buildFromLoadedBinary(const void *data, size_t len) { + cl_int err; + this->m_program = FFTBinaryLookup::buildProgramFromBinary( + (char *)data, len, this->m_context, this->m_device, err); - return err; + return err; } -cl_int FFTBinaryLookup::buildFromBinary(const void * data, - size_t len) -{ - cl_int err = buildFromLoadedBinary(data, len); - if (err != CL_SUCCESS) - return err; +cl_int FFTBinaryLookup::buildFromBinary(const void *data, size_t len) { + cl_int err = buildFromLoadedBinary(data, len); + if (err != CL_SUCCESS) + return err; - // write to the cache - this->populateCache(); + // write to the cache + this->populateCache(); - return CL_SUCCESS; + return CL_SUCCESS; } -cl_program FFTBinaryLookup::buildProgramFromSource(const char * source, - cl_context context, - cl_device_id device, - cl_int & err, - const char * options) -{ - cl_program program = clCreateProgramWithSource(context, 1, (const char **)&source, NULL, &err); - - if (err != CL_SUCCESS) - return NULL; - - err = clBuildProgram(program, - 1, /* FIXME: 1 device */ - &device, - options, - NULL, - NULL); - - if (err != CL_SUCCESS) - return NULL; - - return program; -} - - - -cl_program FFTBinaryLookup::buildProgramFromBinary(const char * data, - size_t data_size, - cl_context context, - cl_device_id device, - cl_int & err, - const char * options) -{ - cl_program program = clCreateProgramWithBinary(context, - 1, // num_device - &device, // device_list - &data_size, // lengths - (const unsigned char **)&data, - NULL, - &err); - if (err != CL_SUCCESS) - { - // FIXME: emit an internal message for OPENCL errors - return NULL; - } +cl_program FFTBinaryLookup::buildProgramFromSource(const char *source, + cl_context context, + cl_device_id device, + cl_int &err, + const char *options) { + cl_program program = + clCreateProgramWithSource(context, 1, (const char **)&source, nullptr, &err); - err = clBuildProgram(program, - 1, /* FIXME: 1 device */ - &device, - options, - NULL, - NULL); + if (err != CL_SUCCESS) + return nullptr; - if (err != CL_SUCCESS) - { - return NULL; - } + err = clBuildProgram(program, 1, /* FIXME: 1 device */ + &device, options, nullptr, nullptr); - return program; -} + if (err != CL_SUCCESS) + return nullptr; -cl_program FFTBinaryLookup::getProgram() -{ - return this->m_program; + return program; } -void FFTBinaryLookup::setProgram(cl_program program, const char * source) -{ - this->m_program = program; - this->m_source = source; +cl_program +FFTBinaryLookup::buildProgramFromBinary(const char *data, size_t data_size, + cl_context context, cl_device_id device, + cl_int &err, const char *options) { + cl_program program = + clCreateProgramWithBinary(context, + 1, // num_device + &device, // device_list + &data_size, // lengths + (const unsigned char **)&data, nullptr, &err); + if (err != CL_SUCCESS) { + // FIXME: emit an internal message for OPENCL errors + return nullptr; + } + + err = clBuildProgram(program, 1, /* FIXME: 1 device */ + &device, options, nullptr, nullptr); + + if (err != CL_SUCCESS) { + return nullptr; + } + + return program; } +cl_program FFTBinaryLookup::getProgram() { return this->m_program; } + +void FFTBinaryLookup::setProgram(cl_program program, const char *source) { + this->m_program = program; + this->m_source = source; +} -static int make_directory(const std::string &path) -{ +static int make_directory(const std::string &path) { #ifdef _WIN32 - return _mkdir (path.c_str()); + return _mkdir(path.c_str()); #else - return mkdir (path.c_str(), S_IRWXU); + return mkdir(path.c_str(), S_IRWXU); #endif } -static void do_mkdir(const std::string &path) -{ - int st = make_directory (path.c_str()); +static void do_mkdir(const std::string &path) { + int st = make_directory(path.c_str()); - if (st != 0) - { - if ( errno != EEXIST ) - { - std::string tmp = "Cannot not create directory '" + std::string(path) + "': "; - throw tmp; - } + if (st != 0) { + if (errno != EEXIST) { + std::string tmp = + "Cannot not create directory '" + std::string(path) + "': "; + throw tmp; } + } } -cl_int FFTBinaryLookup::retrieveDeviceAndDriverInfo() -{ - char m_device_vendor[SIZE]; - char m_device_name[SIZE]; - char m_driver_version[SIZE]; +cl_int FFTBinaryLookup::retrieveDeviceAndDriverInfo() { + char m_device_vendor[SIZE]; + char m_device_name[SIZE]; + char m_driver_version[SIZE]; - cl_int err = clGetDeviceInfo(this->m_device, CL_DEVICE_VENDOR, sizeof(m_device_vendor), - &m_device_vendor, NULL); - if (err != CL_SUCCESS) - { - return err; - } + cl_int err = clGetDeviceInfo(this->m_device, CL_DEVICE_VENDOR, + sizeof(m_device_vendor), &m_device_vendor, nullptr); + if (err != CL_SUCCESS) { + return err; + } - err = clGetDeviceInfo(this->m_device, CL_DEVICE_NAME, sizeof(m_device_name), - &m_device_name, NULL); - if (err != CL_SUCCESS) - { - return err; - } + err = clGetDeviceInfo(this->m_device, CL_DEVICE_NAME, sizeof(m_device_name), + &m_device_name, nullptr); + if (err != CL_SUCCESS) { + return err; + } - err = clGetDeviceInfo(this->m_device, CL_DRIVER_VERSION, sizeof(m_driver_version), - &m_driver_version, NULL); - if (err != CL_SUCCESS) - { - return err; - } + err = clGetDeviceInfo(this->m_device, CL_DRIVER_VERSION, + sizeof(m_driver_version), &m_driver_version, nullptr); + if (err != CL_SUCCESS) { + return err; + } #if CAPS_DEBUG - fprintf(stderr, "device vendor = %s\n", this->m_device_vendor); - fprintf(stderr, "device name = %s\n", this->m_device_name); - fprintf(stderr, "driver version = %s\n", this->m_driver_version); + fprintf(stderr, "device vendor = %s\n", this->m_device_vendor); + fprintf(stderr, "device name = %s\n", this->m_device_name); + fprintf(stderr, "driver version = %s\n", this->m_driver_version); #endif - try - { - const std::string & root = (std::string(cache_path) + m_device_vendor + sep()); - do_mkdir(root.c_str()); + try { + const std::string &root = + (std::string(cache_path) + m_device_vendor + sep()); + do_mkdir(root.c_str()); - const std::string & root2 = (root + m_device_name + sep()); - do_mkdir(root2.c_str()); + const std::string &root2 = (root + m_device_name + sep()); + do_mkdir(root2.c_str()); - const std::string & root3 = (root2 + m_driver_version + sep()); - do_mkdir(root3.c_str()); + const std::string &root3 = (root2 + m_driver_version + sep()); + do_mkdir(root3.c_str()); - const std::string & root4 = (root3 + this->m_cache_entry_name + sep()); - do_mkdir(root4.c_str()); + const std::string &root4 = (root3 + this->m_cache_entry_name + sep()); + do_mkdir(root4.c_str()); - this->m_path = root4; - - return CL_SUCCESS; - } - catch (std::string & e) - { - fprintf(stderr, "%s\n", e.c_str()); - cache_enabled = false; - this->m_cache_enabled = false; + this->m_path = root4; - return CL_INVALID_VALUE; - } + return CL_SUCCESS; + } catch (std::string &e) { + fprintf(stderr, "%s\n", e.c_str()); + cache_enabled = false; + this->m_cache_enabled = false; + + return CL_INVALID_VALUE; + } } diff --git a/src/library/fft_binary_lookup.h b/src/library/fft_binary_lookup.h index 19081f34..c539502c 100644 --- a/src/library/fft_binary_lookup.h +++ b/src/library/fft_binary_lookup.h @@ -36,7 +36,7 @@ // * check if a cache file exists on the disk or not // * fill-up the signature to characterize the program beeing built on the disk // * build a cl_program from a string kernel or from a binary -// +// // A cache entry is a file stored on the disk which contains 3 sections: // * A header section (providing information about file structure) // * The binary contained in the cl_program @@ -54,222 +54,209 @@ // // A typical cache query shall be composed of the following steps: // -// (1) Create a local instance of FFTBinaryLookup +// (1) Create a local instance of FFTBinaryLookup // // (2) Specify the additional characteristics (i.e. variants) of the // requested program. Those information combined with the program // name and the OpenCL context and device shall form a unique // signature for the binary program. -// +// // (3) Perform the effective search by calling the 'found' method -// -// (4) if the search was successfull then cl_program can be retreived +// +// (4) if the search was successfull then cl_program can be retreived // by a call to the 'getProgram' method -// -// (5) if the search was not successfull then a cl_program -// must be created and populated in the cache by a call +// +// (5) if the search was not successfull then a cl_program +// must be created and populated in the cache by a call // to the 'setProgram' method. -// +// // (6) Destroy the FFTBinaryLookup local instance. -// -// For instance, that could be +// +// For instance, that could be // // cl_program program ; -// -// The program name is part of the signature and shall be unique +// +// The program name is part of the signature and shall be unique // const char * program_name = "... my unique program name ... " ; -// +// // FFTBinaryLookup bl(context, device, program_name); -// +// // // Specify additionnal information used to build a -// // signature signature for that cache entry -// +// // signature signature for that cache entry +// // bl.variantInt( vectorSize ); // bl.variantInt( hasBorder ); -// ... -// -// // Perform the query -// if ( bl.found() ) +// ... +// +// // Perform the query +// if ( bl.found() ) // { // // Success! use the cl_program retreived from the cache // program = bl.getProgram(); // } -// else +// else // { // // Failure! we need to build the program ourself -// program = build_the_program(context,device,vectorSize,...) ; +// program = build_the_program(context,device,vectorSize,...) ; // // Inform the lookup object of the program -// bl.setProgram(program); +// bl.setProgram(program); // // And populate the cache -// bl.populateCache() +// bl.populateCache() // } -// -// Remark: The members buildFromSource, buildFromBinary etc are utility -// functions that can be used to build the cl_program from either -// sources or binary (e.g. SPIR). Their use is optionnal. +// +// Remark: The members buildFromSource, buildFromBinary etc are utility +// functions that can be used to build the cl_program from either +// sources or binary (e.g. SPIR). Their use is optionnal. // // -class FFTBinaryLookup - { +class FFTBinaryLookup { public: - // Constructor - // \param ctxt the context for which the cl_program should be built - // \param device the device for which the cl_program should be built - // \param kernel_name the kernel identifier - FFTBinaryLookup(const clfftGenerators gen, const clfftPlanHandle plHandle, cl_context ctxt, cl_device_id device); - ~FFTBinaryLookup(); - - // Methods to fill up the signature of the cache entry - void variantInt(int num); - void variantDouble(double num); - void variantCompileOptions(const std::string & opts); - void variantRaw(const void * data, size_t bytes); - - // Indicates whether or not the cache entry was found on the disk - // If the cache entry was found and is complete on the disk, its content - // is loaded - // \return true if a cache entry was found, false else - bool found(); - - // Build a cl_program from the source code and init attributes - // of the current structure - // so that the program can be accessed with the getProgram method - // Write the file to the cache - cl_int buildFromSource(const char * source); - - // Build a cl_program from the source code and init attributes - // so that the program can be accessed with the getProgram method - // Write the file to the cache - cl_int buildFromBinary(const void * data, - size_t len); - - // Returns the cl_program built from binary or loaded from disk - cl_program getProgram(); - - // Set the current m_program to the given program - void setProgram(cl_program program, const char * source); - - // Build a cl_program from a text - static cl_program buildProgramFromSource(const char * filename, - cl_context context, - cl_device_id device, - cl_int & err, - const char * options = 0); - - // Build a cl_program from binary - static cl_program buildProgramFromBinary(const char * data, - size_t data_size, - cl_context context, - cl_device_id device, - cl_int & err, - const char * options = 0); - - // Initialize the whole cache file information (magic_key, header and program) - // and dump on the disk - cl_int populateCache(); + // Constructor + // \param ctxt the context for which the cl_program should be built + // \param device the device for which the cl_program should be built + // \param kernel_name the kernel identifier + FFTBinaryLookup(const clfftGenerators gen, const clfftPlanHandle plHandle, + cl_context ctxt, cl_device_id device); + ~FFTBinaryLookup(); + + // Methods to fill up the signature of the cache entry + void variantInt(int num); + void variantDouble(double num); + void variantCompileOptions(const std::string &opts); + void variantRaw(const void *data, size_t bytes); + + // Indicates whether or not the cache entry was found on the disk + // If the cache entry was found and is complete on the disk, its content + // is loaded + // \return true if a cache entry was found, false else + bool found(); + + // Build a cl_program from the source code and init attributes + // of the current structure + // so that the program can be accessed with the getProgram method + // Write the file to the cache + cl_int buildFromSource(const char *source); + + // Build a cl_program from the source code and init attributes + // so that the program can be accessed with the getProgram method + // Write the file to the cache + cl_int buildFromBinary(const void *data, size_t len); + + // Returns the cl_program built from binary or loaded from disk + cl_program getProgram(); + + // Set the current m_program to the given program + void setProgram(cl_program program, const char *source); + + // Build a cl_program from a text + static cl_program buildProgramFromSource(const char *filename, + cl_context context, + cl_device_id device, cl_int &err, + const char *options = nullptr); + + // Build a cl_program from binary + static cl_program buildProgramFromBinary(const char *data, size_t data_size, + cl_context context, + cl_device_id device, cl_int &err, + const char *options = nullptr); + + // Initialize the whole cache file information (magic_key, header and program) + // and dump on the disk + cl_int populateCache(); private: - - // Serialize variants and compute the checksum to load the file from cache - void finalizeVariant(); - - // Build a cl_program from the source code and init attributes - // so that the program can be accessed with the getProgram method - // Do not write the file to the cache - cl_int buildFromLoadedBinary(const void * data, - size_t len); - - // Try to retrieve the header of the cache file - // Returns: ok if the header sections was successfully loaded, false else - bool loadHeader(std::ifstream &file, size_t length); - - // Try to retrieve the cl_program and its signature in file - // Returns: ok if the binary and signature sections were successfully loaded, false else - bool loadBinaryAndSignature(std::ifstream &file); - - // Try to create a file associated to the current program/variant in the cache folder - // Returns true if the file was successfully opened and loaded, false else - bool tryLoadCacheFile(); - - // Dump the file on the disk with the name stored in this->m_cache_entry_name - cl_int writeCacheFile(std::vector &data); - - // Retrieve device name, device vendor and driver number by calling - // clGetDeviceInfo - cl_int retrieveDeviceAndDriverInfo(); - - // Cache entry name - std::string m_cache_entry_name; - - // Path for the cache entry name - std::string m_path; - - // Header structure of a cache entry - typedef struct Header_ - { - char magic_key[4]; // = |C|L|F|\0, useful to know that we are loading a clfft cache entry - size_t whole_file_size; // the whole file of the size to know if the current file is complete or not - size_t header_size; // = sizeof(Header) - size_t binary_size; // kernel binary size - size_t signature_size; // variant information - } Header; - - Header m_header; - - cl_context m_context; - cl_device_id m_device; - - cl_program m_program; - - std::string m_source; - - unsigned char * m_binary; - char * m_signature; - - enum VariantKind - { - INT, - DOUBLE, - STRING, - DATA - }; - - struct Variant - { - Variant(); - Variant(VariantKind kind, char * data, size_t size); - Variant(const Variant &obj); - Variant &operator=(const Variant &obj); - - - ~Variant(); - - VariantKind m_kind; - size_t m_size; - char * m_data; - - }; - - // Cache entry, useful to abstract Windows and linux - // cache entry file descriptor - struct CacheEntry - { - CacheEntry(const std::string & filename); - bool exclusive_create(); - void close(); - bool successful_creation(); - - private: - std::string m_filename; - bool m_successful_creation; - void * m_handle; - }; - - // Variants - std::vector m_variants; - - // Indicates whether the cache should be used or not - bool m_cache_enabled; + // Serialize variants and compute the checksum to load the file from cache + void finalizeVariant(); + + // Build a cl_program from the source code and init attributes + // so that the program can be accessed with the getProgram method + // Do not write the file to the cache + cl_int buildFromLoadedBinary(const void *data, size_t len); + + // Try to retrieve the header of the cache file + // Returns: ok if the header sections was successfully loaded, false else + bool loadHeader(std::ifstream &file, size_t length); + + // Try to retrieve the cl_program and its signature in file + // Returns: ok if the binary and signature sections were successfully loaded, + // false else + bool loadBinaryAndSignature(std::ifstream &file); + + // Try to create a file associated to the current program/variant in the cache + // folder Returns true if the file was successfully opened and loaded, false + // else + bool tryLoadCacheFile(); + + // Dump the file on the disk with the name stored in this->m_cache_entry_name + cl_int writeCacheFile(std::vector &data); + + // Retrieve device name, device vendor and driver number by calling + // clGetDeviceInfo + cl_int retrieveDeviceAndDriverInfo(); + + // Cache entry name + std::string m_cache_entry_name; + + // Path for the cache entry name + std::string m_path; + + // Header structure of a cache entry + typedef struct Header_ { + char magic_key[4]; // = |C|L|F|\0, useful to know that we are loading a + // clfft cache entry + size_t whole_file_size; // the whole file of the size to know if the current + // file is complete or not + size_t header_size; // = sizeof(Header) + size_t binary_size; // kernel binary size + size_t signature_size; // variant information + } Header; + + Header m_header; + + cl_context m_context; + cl_device_id m_device; + + cl_program m_program; + + std::string m_source; + + unsigned char *m_binary; + char *m_signature; + + enum VariantKind { INT, DOUBLE, STRING, DATA }; + + struct Variant { + Variant(); + Variant(VariantKind kind, char *data, size_t size); + Variant(const Variant &obj); + Variant &operator=(const Variant &obj); + + ~Variant(); + + VariantKind m_kind; + size_t m_size; + char *m_data; + }; + + // Cache entry, useful to abstract Windows and linux + // cache entry file descriptor + struct CacheEntry { + CacheEntry(const std::string &filename); + bool exclusive_create(); + void close(); + bool successful_creation(); + + private: + std::string m_filename; + bool m_successful_creation; + void *m_handle; + }; + + // Variants + std::vector m_variants; + + // Indicates whether the cache should be used or not + bool m_cache_enabled; }; #undef SIZE diff --git a/src/library/generator.copy.cpp b/src/library/generator.copy.cpp index b55f5992..85370bc5 100644 --- a/src/library/generator.copy.cpp +++ b/src/library/generator.copy.cpp @@ -14,653 +14,674 @@ * limitations under the License. * ************************************************************************/ - +#include "action.h" +#include "generator.stockham.h" #include "stdafx.h" -#include +#include #include -#include "generator.stockham.h" -#include "action.h" -FFTGeneratedCopyAction::FFTGeneratedCopyAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTCopyAction(plHandle, plan, queue, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTCopyAction() failed, exit - fprintf(stderr, "FFTCopyAction() failed!\n"); - return; - } +FFTGeneratedCopyAction::FFTGeneratedCopyAction(clfftPlanHandle plHandle, + FFTPlan *plan, + cl_command_queue queue, + clfftStatus &err) + : FFTCopyAction(plHandle, plan, queue, err) { + if (err != CLFFT_SUCCESS) { + // FFTCopyAction() failed, exit + fprintf(stderr, "FFTCopyAction() failed!\n"); + return; + } - // Initialize the FFTAction::FFTKernelGenKeyParams member - err = this->initParams(); + // Initialize the FFTAction::FFTKernelGenKeyParams member + err = this->initParams(); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedCopyAction::initParams() failed!\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedCopyAction::initParams() failed!\n"); + return; + } - FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTRepo &fftRepo = FFTRepo::getInstance(); - err = this->generateKernel(fftRepo, queue); + err = this->generateKernel(fftRepo, queue); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedCopyAction::generateKernel failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedCopyAction::generateKernel failed\n"); + return; + } - err = compileKernels( queue, plHandle, plan); + err = compileKernels(queue, plHandle, plan); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedCopyAction::compileKernels failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedCopyAction::compileKernels failed\n"); + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } -bool FFTGeneratedCopyAction::buildForwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedCopyAction::buildForwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool h2c = (inputLayout == CLFFT_HERMITIAN_PLANAR) || (inputLayout == CLFFT_HERMITIAN_INTERLEAVED); - bool c2h = (outputLayout == CLFFT_HERMITIAN_PLANAR) || (outputLayout == CLFFT_HERMITIAN_INTERLEAVED); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool h2c = (inputLayout == CLFFT_HERMITIAN_PLANAR) || + (inputLayout == CLFFT_HERMITIAN_INTERLEAVED); + bool c2h = (outputLayout == CLFFT_HERMITIAN_PLANAR) || + (outputLayout == CLFFT_HERMITIAN_INTERLEAVED); - return (r2c_transform || c2h) || (!(h2c || c2h)); + return (r2c_transform || c2h) || (!(h2c || c2h)); } -bool FFTGeneratedCopyAction::buildBackwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedCopyAction::buildBackwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool h2c = (inputLayout == CLFFT_HERMITIAN_PLANAR) || (inputLayout == CLFFT_HERMITIAN_INTERLEAVED); - bool c2h = (outputLayout == CLFFT_HERMITIAN_PLANAR) || (outputLayout == CLFFT_HERMITIAN_INTERLEAVED); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool h2c = (inputLayout == CLFFT_HERMITIAN_PLANAR) || + (inputLayout == CLFFT_HERMITIAN_INTERLEAVED); + bool c2h = (outputLayout == CLFFT_HERMITIAN_PLANAR) || + (outputLayout == CLFFT_HERMITIAN_INTERLEAVED); - return (c2r_transform || h2c) || (!(h2c || c2h)); + return (c2r_transform || h2c) || (!(h2c || c2h)); } using namespace StockhamGenerator; -namespace CopyGenerator -{ - // Copy kernel - template - class CopyKernel - { - size_t N; - size_t Nt; - const FFTGeneratedCopyAction::Signature & params; - bool h2c, c2h; - bool general; - - inline std::string OffsetCalc(const std::string &off, bool input = true) - { - std::string str; - - const size_t *pStride = input ? params.fft_inStride : params.fft_outStride; - - str += "\t"; str += off; str += " = "; - std::string nextBatch = "batch"; - for(size_t i=(params.fft_DataDim - 1); i>1; i--) - { - size_t currentLength = 1; - for(int j=1; j(1); - std::string r2Type = RegBaseType(2); - - bool inIlvd; // Input is interleaved format - bool outIlvd; // Output is interleaved format - inIlvd = ( (params.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) || - (params.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED) ) ? true : false; - outIlvd = ( (params.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) || - (params.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED) ) ? true : false; - - - - // Pragma - str += ClPragma(); - - std::string sfx = FloatSuffix(); - - //If pre-callback is set for the plan - if (params.fft_hasPreCallback && h2c) - { - //Insert callback function code at the beginning - str += params.fft_preCallback.funcstring; - str += "\n\n"; - } - - //if postcallback is set - if (params.fft_hasPostCallback) - { - //Insert callback function code at the beginning - str += params.fft_postCallback.funcstring; - str += "\n\n"; - } - - // Copy kernel begin - str += "__kernel void "; - - // Function name - if(general) - str += "copy_general"; - else - { - if(h2c) str += "copy_h2c"; - else str += "copy_c2h"; - } - - str += "("; - - if(inIlvd) - { - str += "__global const "; str += r2Type; str += " * restrict gbIn, "; - } - else - { - str += "__global const "; str += rType; str += " * restrict gbInRe, "; - str += "__global const "; str += rType; str += " * restrict gbInIm, "; - } - - if(outIlvd) - { - str += "__global "; str += r2Type; str += " * restrict gbOut"; - } - else - { - str += "__global "; str += rType; str += " * restrict gbOutRe, "; - str += "__global "; str += rType; str += " * restrict gbOutIm"; - } - - if (params.fft_hasPreCallback && h2c) - { - assert(!params.fft_hasPostCallback); - - str += ", __global void* pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - str += ", __local void* localmem"; - } - } - - if (params.fft_hasPostCallback) - { - assert(!params.fft_hasPreCallback); - - str += ", __global void* post_userdata"; - if (params.fft_postCallback.localMemSize > 0) - { - str += ", __local void* localmem"; - } - } - - str += ")\n"; - - str += "{\n"; - - // Initialize - if(general) - { - str += "\tuint me = get_local_id(0);\n\t"; - str += "uint batch = get_group_id(0);\n\t"; - } - else - { - str += "\tuint me = get_global_id(0);\n\t"; - } - - // Declare memory pointers - str += "\n\t"; - str += "uint iOffset;\n\t"; - str += "uint oOffset;\n\t"; - - if (!(params.fft_hasPreCallback && h2c)) - { - // input - if(inIlvd) - { - str += "__global "; str += r2Type; str += " *lwbIn;\n\t"; - } - else - { - str += "__global "; str += rType; str += " *lwbInRe;\n\t"; - str += "__global "; str += rType; str += " *lwbInIm;\n\t"; - } - } - - // output - if(outIlvd) - { - if (!params.fft_hasPostCallback) - { - str += "__global "; str += r2Type; str += " *lwbOut;\n"; - } - if(h2c) - { - str += "\t"; - str += "__global "; str += r2Type; str += " *lwbOut2;\n\n"; - } - } - else - { - if (!params.fft_hasPostCallback) - { - str += "__global "; str += rType; str += " *lwbOutRe;\n\t"; - str += "__global "; str += rType; str += " *lwbOutIm;\n"; - } - if(h2c) - { - str += "\t"; - str += "__global "; str += rType; str += " *lwbOutRe2;\n\t"; - str += "__global "; str += rType; str += " *lwbOutIm2;\n\n"; - } - } - - // Setup registers - str += "\t"; str += RegBaseType(2); str += " R;\n\n"; - - size_t NtRounded64 = DivRoundingUp(Nt,64) * 64; - - if(!general) - { - // Setup variables - str += "\tuint batch, meg, mel, mel2;\n\t"; - str += "batch = me/"; str += SztToStr(NtRounded64); str += ";\n\t"; - str += "meg = me%"; str += SztToStr(NtRounded64); str += ";\n\t"; - str += "mel = me%"; str += SztToStr(Nt); str += ";\n\t"; - str += "mel2 = ("; str += SztToStr(N); str += " - mel)%"; str += SztToStr(N); str += ";\n\n"; - } - - - // Setup memory pointers - str += OffsetCalc("iOffset", true); - str += OffsetCalc("oOffset", false); - - // offset strings - std::string inF, inF2, outF, outF2; - if(general) - { - inF = inF2 = outF = outF2 = ""; - } - else - { - inF = " + (mel*"; inF += SztToStr(params.fft_inStride[0]); inF += ")"; - inF2 = " + (mel2*"; inF2 += SztToStr(params.fft_inStride[0]); inF2 += ")"; - outF = " + (mel*"; outF += SztToStr(params.fft_outStride[0]); outF += ")"; - outF2 = " + (mel2*"; outF2 += SztToStr(params.fft_outStride[0]); outF2 += ")"; - } - - str += "\n\t"; - - if (!(params.fft_hasPreCallback && h2c)) - { - // inputs - if(inIlvd) - { - str += "lwbIn = gbIn + iOffset"; str += inF; str += ";\n\t"; - } - else - { - str += "lwbInRe = gbInRe + iOffset"; str += inF; str += ";\n\t"; - str += "lwbInIm = gbInIm + iOffset"; str += inF; str += ";\n\t"; - } - } - - // outputs - if(outIlvd) - { - if (!params.fft_hasPostCallback) - { - str += "lwbOut = gbOut + oOffset"; str += outF; str += ";\n"; - } - if(h2c) - { - str += "\t"; - str += "lwbOut2 = gbOut + oOffset"; str += outF2; str += ";\n"; - } - } - else - { - if (!params.fft_hasPostCallback) - { - str += "lwbOutRe = gbOutRe + oOffset"; str += outF; str += ";\n\t"; - str += "lwbOutIm = gbOutIm + oOffset"; str += outF; str += ";\n"; - } - if(h2c) - { - str += "\t"; - str += "lwbOutRe2 = gbOutRe + oOffset"; str += outF2; str += ";\n\t"; - str += "lwbOutIm2 = gbOutIm + oOffset"; str += outF2; str += ";\n"; - } - } - - str += "\n\t"; - - // Do the copy - if(general) - { - str += "for(uint t=0; t<"; str += SztToStr(N/64); str += "; t++)\n\t{\n\t\t"; - - if(inIlvd) - { - str += "R = lwbIn[me + t*64];\n\t\t"; - } - else - { - str += "R.x = lwbInRe[me + t*64];\n\t\t"; - str += "R.y = lwbInIm[me + t*64];\n\t\t"; - } - - if(outIlvd) - { - str += "lwbOut[me + t*64] = R;\n"; - } - else - { - str += "lwbOutRe[me + t*64] = R.x;\n\t\t"; - str += "lwbOutIm[me + t*64] = R.y;\n"; - } - - str += "\t}\n\n"; - } - else - { - str += "if(meg < "; str += SztToStr(Nt); str += ")\n\t{\n\t"; - if(c2h) - { - if(inIlvd) - { - str += "R = lwbIn[0];\n\t"; - } - else - { - str += "R.x = lwbInRe[0];\n\t"; - str += "R.y = lwbInIm[0];\n\t"; - } - - if(outIlvd) - { - if (params.fft_hasPostCallback) - { - str += params.fft_postCallback.funcname; str += "(gbOut, oOffset"; str += outF; - str += ", post_userdata, R"; - if (params.fft_postCallback.localMemSize > 0) - { - str += ", localmem"; - } - str += ");\n\n"; - } - else - { - str += "lwbOut[0] = R;\n\n"; - } - } - else - { - if (params.fft_hasPostCallback) - { - str += params.fft_postCallback.funcname; str += "(gbOutRe, gbOutIm, oOffset"; str += outF; - str += ", post_userdata, R.x, R.y"; - - if (params.fft_postCallback.localMemSize > 0) - { - str += ", localmem"; - } - str += ");\n\t"; - } - else - { - str += "lwbOutRe[0] = R.x;\n\t"; - str += "lwbOutIm[0] = R.y;\n\t"; - } - } - } - else - { - if (params.fft_hasPreCallback) - { - if(inIlvd) - { - str += "R = "; str += params.fft_preCallback.funcname; str += "( gbIn, (iOffset"; str += inF; str += "), pre_userdata"; - } - else - { - str += "R = "; str += params.fft_preCallback.funcname; str += "( gbInRe, gbInIm, (iOffset"; str += inF; str += "), pre_userdata"; - } - if (params.fft_preCallback.localMemSize > 0) - { - str += ", localmem"; - } - str += ");\n\t\t"; - } - else - { - if(inIlvd) - { - str += "R = lwbIn[0];\n\t"; - } - else - { - str += "R.x = lwbInRe[0];\n\t"; - str += "R.y = lwbInIm[0];\n\t"; - } - } - - if(outIlvd) - { - str += "lwbOut[0] = R;\n\t"; - str += "R.y = -R.y;\n\t"; - str += "lwbOut2[0] = R;\n\t"; - } - else - { - str += "lwbOutRe[0] = R.x;\n\t"; - str += "lwbOutIm[0] = R.y;\n\t"; - str += "R.y = -R.y;\n\t"; - str += "lwbOutRe2[0] = R.x;\n\t"; - str += "lwbOutIm2[0] = R.y;\n\t"; - } - } - str += "}\n\n"; - } - - str += "}\n"; - } - }; +namespace CopyGenerator { +// Copy kernel +template class CopyKernel { + size_t N; + size_t Nt; + const FFTGeneratedCopyAction::Signature ¶ms; + bool h2c, c2h; + bool general; + + inline std::string OffsetCalc(const std::string &off, bool input = true) { + std::string str; + + const size_t *pStride = input ? params.fft_inStride : params.fft_outStride; + + str += "\t"; + str += off; + str += " = "; + std::string nextBatch = "batch"; + for (size_t i = (params.fft_DataDim - 1); i > 1; i--) { + size_t currentLength = 1; + for (int j = 1; j < i; j++) + currentLength *= params.fft_N[j]; + + str += "("; + str += nextBatch; + str += "/"; + str += SztToStr(currentLength); + str += ")*"; + str += SztToStr(pStride[i]); + str += " + "; + + nextBatch = "(" + nextBatch + "%" + SztToStr(currentLength) + ")"; + } + + str += nextBatch; + str += "*"; + str += SztToStr(pStride[1]); + str += ";\n"; + + return str; + } + +public: + CopyKernel(const FFTGeneratedCopyAction::Signature ¶msVal) + : params(paramsVal) + + { + N = params.fft_N[0]; + Nt = 1 + N / 2; + + h2c = ((params.fft_inputLayout == CLFFT_HERMITIAN_PLANAR) || + (params.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED)) + ? true + : false; + c2h = ((params.fft_outputLayout == CLFFT_HERMITIAN_PLANAR) || + (params.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED)) + ? true + : false; + + general = !(h2c || c2h); + + // We only do out-of-place copies at this point + assert(params.fft_placeness == CLFFT_OUTOFPLACE); + } + + void GenerateKernel(std::string &str) { + std::string rType = RegBaseType(1); + std::string r2Type = RegBaseType(2); + + bool inIlvd; // Input is interleaved format + bool outIlvd; // Output is interleaved format + inIlvd = ((params.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) || + (params.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED)) + ? true + : false; + outIlvd = ((params.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) || + (params.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED)) + ? true + : false; + + // Pragma + str += ClPragma(); + + std::string sfx = FloatSuffix(); + + // If pre-callback is set for the plan + if (params.fft_hasPreCallback && h2c) { + // Insert callback function code at the beginning + str += params.fft_preCallback.funcstring; + str += "\n\n"; + } + + // if postcallback is set + if (params.fft_hasPostCallback) { + // Insert callback function code at the beginning + str += params.fft_postCallback.funcstring; + str += "\n\n"; + } + + // Copy kernel begin + str += "__kernel void "; + + // Function name + if (general) + str += "copy_general"; + else { + if (h2c) + str += "copy_h2c"; + else + str += "copy_c2h"; + } + + str += "("; + + if (inIlvd) { + str += "__global const "; + str += r2Type; + str += " * restrict gbIn, "; + } else { + str += "__global const "; + str += rType; + str += " * restrict gbInRe, "; + str += "__global const "; + str += rType; + str += " * restrict gbInIm, "; + } + + if (outIlvd) { + str += "__global "; + str += r2Type; + str += " * restrict gbOut"; + } else { + str += "__global "; + str += rType; + str += " * restrict gbOutRe, "; + str += "__global "; + str += rType; + str += " * restrict gbOutIm"; + } + + if (params.fft_hasPreCallback && h2c) { + assert(!params.fft_hasPostCallback); + + str += ", __global void* pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + str += ", __local void* localmem"; + } + } + + if (params.fft_hasPostCallback) { + assert(!params.fft_hasPreCallback); + + str += ", __global void* post_userdata"; + if (params.fft_postCallback.localMemSize > 0) { + str += ", __local void* localmem"; + } + } + + str += ")\n"; + + str += "{\n"; + + // Initialize + if (general) { + str += "\tuint me = get_local_id(0);\n\t"; + str += "uint batch = get_group_id(0);\n\t"; + } else { + str += "\tuint me = get_global_id(0);\n\t"; + } + + // Declare memory pointers + str += "\n\t"; + str += "uint iOffset;\n\t"; + str += "uint oOffset;\n\t"; + + if (!(params.fft_hasPreCallback && h2c)) { + // input + if (inIlvd) { + str += "__global "; + str += r2Type; + str += " *lwbIn;\n\t"; + } else { + str += "__global "; + str += rType; + str += " *lwbInRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbInIm;\n\t"; + } + } + + // output + if (outIlvd) { + if (!params.fft_hasPostCallback) { + str += "__global "; + str += r2Type; + str += " *lwbOut;\n"; + } + if (h2c) { + str += "\t"; + str += "__global "; + str += r2Type; + str += " *lwbOut2;\n\n"; + } + } else { + if (!params.fft_hasPostCallback) { + str += "__global "; + str += rType; + str += " *lwbOutRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbOutIm;\n"; + } + if (h2c) { + str += "\t"; + str += "__global "; + str += rType; + str += " *lwbOutRe2;\n\t"; + str += "__global "; + str += rType; + str += " *lwbOutIm2;\n\n"; + } + } + + // Setup registers + str += "\t"; + str += RegBaseType(2); + str += " R;\n\n"; + + size_t NtRounded64 = DivRoundingUp(Nt, 64) * 64; + + if (!general) { + // Setup variables + str += "\tuint batch, meg, mel, mel2;\n\t"; + str += "batch = me/"; + str += SztToStr(NtRounded64); + str += ";\n\t"; + str += "meg = me%"; + str += SztToStr(NtRounded64); + str += ";\n\t"; + str += "mel = me%"; + str += SztToStr(Nt); + str += ";\n\t"; + str += "mel2 = ("; + str += SztToStr(N); + str += " - mel)%"; + str += SztToStr(N); + str += ";\n\n"; + } + + // Setup memory pointers + str += OffsetCalc("iOffset", true); + str += OffsetCalc("oOffset", false); + + // offset strings + std::string inF, inF2, outF, outF2; + if (general) { + inF = inF2 = outF = outF2 = ""; + } else { + inF = " + (mel*"; + inF += SztToStr(params.fft_inStride[0]); + inF += ")"; + inF2 = " + (mel2*"; + inF2 += SztToStr(params.fft_inStride[0]); + inF2 += ")"; + outF = " + (mel*"; + outF += SztToStr(params.fft_outStride[0]); + outF += ")"; + outF2 = " + (mel2*"; + outF2 += SztToStr(params.fft_outStride[0]); + outF2 += ")"; + } + + str += "\n\t"; + + if (!(params.fft_hasPreCallback && h2c)) { + // inputs + if (inIlvd) { + str += "lwbIn = gbIn + iOffset"; + str += inF; + str += ";\n\t"; + } else { + str += "lwbInRe = gbInRe + iOffset"; + str += inF; + str += ";\n\t"; + str += "lwbInIm = gbInIm + iOffset"; + str += inF; + str += ";\n\t"; + } + } + + // outputs + if (outIlvd) { + if (!params.fft_hasPostCallback) { + str += "lwbOut = gbOut + oOffset"; + str += outF; + str += ";\n"; + } + if (h2c) { + str += "\t"; + str += "lwbOut2 = gbOut + oOffset"; + str += outF2; + str += ";\n"; + } + } else { + if (!params.fft_hasPostCallback) { + str += "lwbOutRe = gbOutRe + oOffset"; + str += outF; + str += ";\n\t"; + str += "lwbOutIm = gbOutIm + oOffset"; + str += outF; + str += ";\n"; + } + if (h2c) { + str += "\t"; + str += "lwbOutRe2 = gbOutRe + oOffset"; + str += outF2; + str += ";\n\t"; + str += "lwbOutIm2 = gbOutIm + oOffset"; + str += outF2; + str += ";\n"; + } + } + + str += "\n\t"; + + // Do the copy + if (general) { + str += "for(uint t=0; t<"; + str += SztToStr(N / 64); + str += "; t++)\n\t{\n\t\t"; + + if (inIlvd) { + str += "R = lwbIn[me + t*64];\n\t\t"; + } else { + str += "R.x = lwbInRe[me + t*64];\n\t\t"; + str += "R.y = lwbInIm[me + t*64];\n\t\t"; + } + + if (outIlvd) { + str += "lwbOut[me + t*64] = R;\n"; + } else { + str += "lwbOutRe[me + t*64] = R.x;\n\t\t"; + str += "lwbOutIm[me + t*64] = R.y;\n"; + } + + str += "\t}\n\n"; + } else { + str += "if(meg < "; + str += SztToStr(Nt); + str += ")\n\t{\n\t"; + if (c2h) { + if (inIlvd) { + str += "R = lwbIn[0];\n\t"; + } else { + str += "R.x = lwbInRe[0];\n\t"; + str += "R.y = lwbInIm[0];\n\t"; + } + + if (outIlvd) { + if (params.fft_hasPostCallback) { + str += params.fft_postCallback.funcname; + str += "(gbOut, oOffset"; + str += outF; + str += ", post_userdata, R"; + if (params.fft_postCallback.localMemSize > 0) { + str += ", localmem"; + } + str += ");\n\n"; + } else { + str += "lwbOut[0] = R;\n\n"; + } + } else { + if (params.fft_hasPostCallback) { + str += params.fft_postCallback.funcname; + str += "(gbOutRe, gbOutIm, oOffset"; + str += outF; + str += ", post_userdata, R.x, R.y"; + + if (params.fft_postCallback.localMemSize > 0) { + str += ", localmem"; + } + str += ");\n\t"; + } else { + str += "lwbOutRe[0] = R.x;\n\t"; + str += "lwbOutIm[0] = R.y;\n\t"; + } + } + } else { + if (params.fft_hasPreCallback) { + if (inIlvd) { + str += "R = "; + str += params.fft_preCallback.funcname; + str += "( gbIn, (iOffset"; + str += inF; + str += "), pre_userdata"; + } else { + str += "R = "; + str += params.fft_preCallback.funcname; + str += "( gbInRe, gbInIm, (iOffset"; + str += inF; + str += "), pre_userdata"; + } + if (params.fft_preCallback.localMemSize > 0) { + str += ", localmem"; + } + str += ");\n\t\t"; + } else { + if (inIlvd) { + str += "R = lwbIn[0];\n\t"; + } else { + str += "R.x = lwbInRe[0];\n\t"; + str += "R.y = lwbInIm[0];\n\t"; + } + } + + if (outIlvd) { + str += "lwbOut[0] = R;\n\t"; + str += "R.y = -R.y;\n\t"; + str += "lwbOut2[0] = R;\n\t"; + } else { + str += "lwbOutRe[0] = R.x;\n\t"; + str += "lwbOutIm[0] = R.y;\n\t"; + str += "R.y = -R.y;\n\t"; + str += "lwbOutRe2[0] = R.x;\n\t"; + str += "lwbOutIm2[0] = R.y;\n\t"; + } + } + str += "}\n\n"; + } + + str += "}\n"; + } }; +}; // namespace CopyGenerator + +clfftStatus FFTGeneratedCopyAction::initParams() { + + // Query the devices in this context for their local memory sizes + // How we generate a kernel depends on the *minimum* LDS size for all + // devices. + // + const FFTEnvelope *pEnvelope = nullptr; + OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); + BUG_CHECK(nullptr != pEnvelope); + + this->signature.fft_precision = this->plan->precision; + this->signature.fft_placeness = this->plan->placeness; + this->signature.fft_inputLayout = this->plan->inputLayout; + this->signature.fft_MaxWorkGroupSize = + this->plan->envelope.limit_WorkGroupSize; + + ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()) + + this->signature.fft_outputLayout = this->plan->outputLayout; + + this->signature.fft_DataDim = this->plan->length.size() + 1; + int i = 0; + for (i = 0; i < (this->signature.fft_DataDim - 1); i++) { + this->signature.fft_N[i] = this->plan->length[i]; + this->signature.fft_inStride[i] = this->plan->inStride[i]; + this->signature.fft_outStride[i] = this->plan->outStride[i]; + } + this->signature.fft_inStride[i] = this->plan->iDist; + this->signature.fft_outStride[i] = this->plan->oDist; + this->signature.fft_fwdScale = this->plan->forwardScale; + this->signature.fft_backScale = this->plan->backwardScale; -clfftStatus FFTGeneratedCopyAction::initParams () -{ - - // Query the devices in this context for their local memory sizes - // How we generate a kernel depends on the *minimum* LDS size for all devices. - // - const FFTEnvelope * pEnvelope = NULL; - OPENCL_V(this->plan->GetEnvelope (& pEnvelope), _T("GetEnvelope failed")); - BUG_CHECK (NULL != pEnvelope); - - this->signature.fft_precision = this->plan->precision; - this->signature.fft_placeness = this->plan->placeness; - this->signature.fft_inputLayout = this->plan->inputLayout; - this->signature.fft_MaxWorkGroupSize = this->plan->envelope.limit_WorkGroupSize; - - ARG_CHECK (this->plan->inStride.size() == this->plan->outStride.size()) - - this->signature.fft_outputLayout = this->plan->outputLayout; - - this->signature.fft_DataDim = this->plan->length.size() + 1; - int i = 0; - for(i = 0; i < (this->signature.fft_DataDim - 1); i++) - { - this->signature.fft_N[i] = this->plan->length[i]; - this->signature.fft_inStride[i] = this->plan->inStride[i]; - this->signature.fft_outStride[i] = this->plan->outStride[i]; - - } - this->signature.fft_inStride[i] = this->plan->iDist; - this->signature.fft_outStride[i] = this->plan->oDist; - - this->signature.fft_fwdScale = this->plan->forwardScale; - this->signature.fft_backScale = this->plan->backwardScale; - - //Set callback if specified - if (this->plan->hasPreCallback) - { - assert(!this->plan->hasPostCallback); - - this->signature.fft_hasPreCallback = true; - this->signature.fft_preCallback = this->plan->preCallback; - - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by main FFT kernel - if (this->plan->preCallback.localMemSize > this->plan->envelope.limit_LocalMemSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - - if (this->plan->hasPostCallback) - { - assert(!this->plan->hasPreCallback); - - this->signature.fft_hasPostCallback = true; - this->signature.fft_postCallback = this->plan->postCallbackParam; - - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by main FFT kernel - //Assumes copy kernel does not have both pre and post callback - if (this->plan->postCallbackParam.localMemSize > this->plan->envelope.limit_LocalMemSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; - - return CLFFT_SUCCESS; -} + // Set callback if specified + if (this->plan->hasPreCallback) { + assert(!this->plan->hasPostCallback); -clfftStatus FFTGeneratedCopyAction::getWorkSizes (std::vector & globalWS, std::vector & localWS) -{ - bool h2c, c2h; - h2c = ( (this->signature.fft_inputLayout == CLFFT_HERMITIAN_PLANAR) || (this->signature.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED) ); - c2h = ( (this->signature.fft_outputLayout == CLFFT_HERMITIAN_PLANAR) || (this->signature.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED) ); - - bool general = !(h2c || c2h); - - size_t count = this->plan->batchsize; - - switch(this->signature.fft_DataDim) - { - case 5: assert(false); - case 4: count *= this->signature.fft_N[2]; - case 3: count *= this->signature.fft_N[1]; - case 2: - { - if(general) - { - count *= 64; - } - else - { - count *= (DivRoundingUp((1 + this->signature.fft_N[0]/2), 64) * 64); - } - } - break; - case 1: assert(false); - } - - globalWS.push_back( count ); - localWS.push_back( 64 ); - - return CLFFT_SUCCESS; -} + this->signature.fft_hasPreCallback = true; + this->signature.fft_preCallback = this->plan->preCallback; + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by main FFT kernel + if (this->plan->preCallback.localMemSize > + this->plan->envelope.limit_LocalMemSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } -using namespace CopyGenerator; + if (this->plan->hasPostCallback) { + assert(!this->plan->hasPreCallback); -clfftStatus FFTGeneratedCopyAction::generateKernel(FFTRepo& fftRepo, const cl_command_queue commQueueFFT ) -{ + this->signature.fft_hasPostCallback = true; + this->signature.fft_postCallback = this->plan->postCallbackParam; + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by main FFT kernel Assumes + // copy kernel does not have both pre and post callback + if (this->plan->postCallbackParam.localMemSize > + this->plan->envelope.limit_LocalMemSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } + this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; + + return CLFFT_SUCCESS; +} + +clfftStatus FFTGeneratedCopyAction::getWorkSizes(std::vector &globalWS, + std::vector &localWS) { bool h2c, c2h; - h2c = ( (this->signature.fft_inputLayout == CLFFT_HERMITIAN_PLANAR) || (this->signature.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED) ); - c2h = ( (this->signature.fft_outputLayout == CLFFT_HERMITIAN_PLANAR) || (this->signature.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED) ); - + h2c = ((this->signature.fft_inputLayout == CLFFT_HERMITIAN_PLANAR) || + (this->signature.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED)); + c2h = ((this->signature.fft_outputLayout == CLFFT_HERMITIAN_PLANAR) || + (this->signature.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED)); + bool general = !(h2c || c2h); - std::string programCode; - Precision pr = (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE; - switch(pr) - { - case P_SINGLE: - { - CopyKernel kernel(this->signature); - kernel.GenerateKernel(programCode); - } break; - case P_DOUBLE: - { - CopyKernel kernel(this->signature); - kernel.GenerateKernel(programCode); - } break; + size_t count = this->plan->batchsize; + + switch (this->signature.fft_DataDim) { + case 5: + assert(false); + case 4: + count *= this->signature.fft_N[2]; + case 3: + count *= this->signature.fft_N[1]; + case 2: { + if (general) { + count *= 64; + } else { + count *= + (DivRoundingUp((1 + this->signature.fft_N[0] / 2), 64) * 64); + } + } break; + case 1: + assert(false); } - cl_int status = CL_SUCCESS; - cl_device_id Device = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL); - OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) ); + globalWS.push_back(count); + localWS.push_back(64); - cl_context QueueContext = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL); - OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) ); + return CLFFT_SUCCESS; +} - OPENCL_V( fftRepo.setProgramCode( this->getGenerator(), this->getSignatureData(), programCode, Device, QueueContext ), _T( "fftRepo.setclString() failed!" ) ); +using namespace CopyGenerator; - if(general) - { - OPENCL_V( fftRepo.setProgramEntryPoints( this->getGenerator(), this->getSignatureData(), "copy_general", "copy_general", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) ); +clfftStatus +FFTGeneratedCopyAction::generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) { + + bool h2c, c2h; + h2c = ((this->signature.fft_inputLayout == CLFFT_HERMITIAN_PLANAR) || + (this->signature.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED)); + c2h = ((this->signature.fft_outputLayout == CLFFT_HERMITIAN_PLANAR) || + (this->signature.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED)); + + bool general = !(h2c || c2h); + + std::string programCode; + Precision pr = + (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE; + switch (pr) { + case P_SINGLE: { + CopyKernel kernel(this->signature); + kernel.GenerateKernel(programCode); + } break; + case P_DOUBLE: { + CopyKernel kernel(this->signature); + kernel.GenerateKernel(programCode); + } break; } - else - { - OPENCL_V( fftRepo.setProgramEntryPoints( this->getGenerator(), this->getSignatureData(), "copy_c2h", "copy_h2c", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) ); + + cl_int status = CL_SUCCESS; + cl_device_id Device = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, + sizeof(cl_device_id), &Device, nullptr); + OPENCL_V(status, _T( "clGetCommandQueueInfo failed" )); + + cl_context QueueContext = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, + sizeof(cl_context), &QueueContext, nullptr); + OPENCL_V(status, _T( "clGetCommandQueueInfo failed" )); + + OPENCL_V(fftRepo.setProgramCode(this->getGenerator(), + this->getSignatureData(), programCode, Device, + QueueContext), + _T( "fftRepo.setclString() failed!" )); + + if (general) { + OPENCL_V(fftRepo.setProgramEntryPoints( + this->getGenerator(), this->getSignatureData(), "copy_general", + "copy_general", Device, QueueContext), + _T( "fftRepo.setProgramEntryPoint() failed!" )); + } else { + OPENCL_V(fftRepo.setProgramEntryPoints(this->getGenerator(), + this->getSignatureData(), "copy_c2h", + "copy_h2c", Device, QueueContext), + _T( "fftRepo.setProgramEntryPoint() failed!" )); } return CLFFT_SUCCESS; diff --git a/src/library/generator.h b/src/library/generator.h index fbf5cce2..9eb8ab25 100644 --- a/src/library/generator.h +++ b/src/library/generator.h @@ -14,20 +14,20 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( AMD_CLFFT_generator_H ) +#if !defined(AMD_CLFFT_generator_H) #define AMD_CLFFT_generator_H -// Enum to help provide descriptive names to array indices, when indexing into our various vectors -enum clfftGenerators -{ - Stockham, // Using the Stockham autosort frameworks - Transpose_GCN, - Transpose_SQUARE, - Transpose_NONSQUARE, - Copy, - ENDGENERATORS ///< This value will always be last, and marks the length of clfftGenerators +// Enum to help provide descriptive names to array indices, when indexing +//into our various vectors +enum clfftGenerators { + Stockham, // Using the Stockham autosort frameworks + Transpose_GCN, + Transpose_SQUARE, + Transpose_NONSQUARE, + Copy, + ENDGENERATORS ///< This value will always be last, and marks the length of + ///< clfftGenerators }; #endif diff --git a/src/library/generator.stockham.cpp b/src/library/generator.stockham.cpp index 83583514..844c598f 100644 --- a/src/library/generator.stockham.cpp +++ b/src/library/generator.stockham.cpp @@ -14,85 +14,79 @@ * limitations under the License. * ************************************************************************/ - -#include "stdafx.h" -#include #include "generator.stockham.h" -#include #include "action.h" +#include "stdafx.h" +#include +#include +FFTGeneratedStockhamAction::FFTGeneratedStockhamAction(clfftPlanHandle plHandle, + FFTPlan *plan, + cl_command_queue queue, + clfftStatus &err) + : FFTStockhamAction(plHandle, plan, queue, err) { + if (err != CLFFT_SUCCESS) { + // FFTAction() failed, exit + fprintf(stderr, "FFTStockhamAction() failed!\n"); + return; + } -FFTGeneratedStockhamAction::FFTGeneratedStockhamAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTStockhamAction(plHandle, plan, queue, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTAction() failed, exit - fprintf(stderr, "FFTStockhamAction() failed!\n"); - return; - } + // Initialize the FFTAction::FFTKernelGenKeyParams member + err = this->initParams(); - // Initialize the FFTAction::FFTKernelGenKeyParams member - err = this->initParams(); + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedStockhamAction::initParams() failed!\n"); + return; + } - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedStockhamAction::initParams() failed!\n"); - return; - } - - FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTRepo &fftRepo = FFTRepo::getInstance(); - err = this->generateKernel(fftRepo, queue); + err = this->generateKernel(fftRepo, queue); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedStockhamAction::generateKernel failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedStockhamAction::generateKernel failed\n"); + return; + } - err = compileKernels( queue, plHandle, plan); + err = compileKernels(queue, plHandle, plan); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedStockhamAction::compileKernels failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedStockhamAction::compileKernels failed\n"); + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } -bool FFTGeneratedStockhamAction::buildForwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedStockhamAction::buildForwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || r2c_transform; + return (!real_transform) || r2c_transform; } -bool FFTGeneratedStockhamAction::buildBackwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedStockhamAction::buildBackwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || c2r_transform; + return (!real_transform) || c2r_transform; } - // FFT Stockham Autosort Method // -// Each pass does one digit reverse in essence. Hence by the time all passes are done, complete -// digit reversal is done and output FFT is in correct order. Intermediate FFTs are stored in natural order, -// which is not the case with basic Cooley-Tukey algorithm. Natural order in intermediate data makes it -// convenient for stitching together passes with different radices. +// Each pass does one digit reverse in essence. Hence by the time all passes +// are done, complete digit reversal is done and output FFT is in correct +// order. Intermediate FFTs are stored in natural order, which is not the case +// with basic Cooley-Tukey algorithm. Natural order in intermediate data makes +// it convenient for stitching together passes with different radices. // // Basic FFT algorithm: // @@ -106,27 +100,30 @@ bool FFTGeneratedStockhamAction::buildBackwardKernel() // } // } // -// The sweeps of the outer and inner loop resemble matrix indexing, this matrix changes shape with every pass as noted below +// The sweeps of the outer and inner loop resemble matrix indexing, this matrix +// changes shape with every pass as noted below // // FFT pass diagram (radix 2) // // k k+R k -// * * * * * * * * * * * * * * * * * * * * * * * * -// * | | * * | * -// * | | * * | * -// * | | * LS --> * | * -// * | | * * | * -// * | | * * | * -// * * * * * * * * * * * * * * * * * | * -// RS * | * L -// * | * -// * | * -// * | * -// * | * -// * | * -// * | * -// * | * -// * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * +// * +// * | | * * | * +// * | | * * | * +// * | | * LS --> * | * +// * | | * * | * +// * | | * * | * +// * * * * * * * * * * * * * * * * * | * +// RS * | * L +// * | * +// * | * +// * | * +// * | * +// * | * +// * | * +// * | * +// * * * * * * * +// * // R // // @@ -153,4602 +150,5424 @@ bool FFTGeneratedStockhamAction::buildBackwardKernel() // Radix 2: k*LS + j, (k+R)*LS + j // Radix 3: k*LS + j, (k+R)*LS + j, (k+2R)*LS + j // Radix 4: k*LS + j, (k+R)*LS + j, (k+2R)*LS + j, (k+3R)*LS + j -// Radix 5: k*LS + j, (k+R)*LS + j, (k+2R)*LS + j, (k+3R)*LS + j, (k+4R)*LS + j +// Radix 5: k*LS + j, (k+R)*LS + j, (k+2R)*LS + j, (k+3R)*LS + j, (k+4R)*LS +// + j // // Data Write Order // Radix 2: k*L + j, k*L + j + LS // Radix 3: k*L + j, k*L + j + LS, k*L + j + 2*LS // Radix 4: k*L + j, k*L + j + LS, k*L + j + 2*LS, k*L + j + 3*LS -// Radix 5: k*L + j, k*L + j + LS, k*L + j + 2*LS, k*L + j + 3*LS, k*L + j + 4*LS +// Radix 5: k*L + j, k*L + j + LS, k*L + j + 2*LS, k*L + j + 3*LS, k*L + j +// + 4*LS // -namespace StockhamGenerator -{ - // Experimnetal Start ========================================= - // Kernel Generator Parameterization ========================== +namespace StockhamGenerator { +// Experimnetal Start ========================================= +// Kernel Generator Parameterization ========================== - // Uncomment this directive to activate parameter reads from file +// Uncomment this directive to activate parameter reads from file //#define PARMETERS_TO_BE_READ - // Parameters to read - struct ParamRead - { - size_t workGroupSize; - size_t numTransformsPerWg; - std::vector radices; - bool halfLds; - }; - - // File format - - // WorkGroupSize: - // TransformsPerWorkGroup: - // Radices: - // LdsUse: - - void ReadParameterFile(ParamRead &readParam) - { - const char *fileName = "parameters.txt"; - std::ifstream file(fileName); - - if(!file.is_open()) - { - std::cout << "File: " << fileName << " could not be opened, exiting ...." << std::endl; - exit(-1); - } - - std::string strWgs = "WorkGroupSize:"; - std::string strNtw = "TransformsPerWorkGroup:"; - std::string strRad = "Radices:"; - std::string strLds = "LdsUse:"; - std::string numbers = "0123456789"; - - std::string line; - while(std::getline(file, line)) - { - - size_t pos; - - pos = line.find(strWgs); - if(pos != std::string::npos) - { - line.erase(pos, strWgs.length()); - size_t numStart = line.find_first_of(numbers); - size_t numEnd = line.find_first_not_of(numbers, numStart); - std::string val = line.substr(numStart, numEnd-numStart); - readParam.workGroupSize = strtol(val.c_str(), NULL, 10); - continue; - } - - pos = line.find(strNtw); - if(pos != std::string::npos) - { - line.erase(pos, strNtw.length()); - size_t numStart = line.find_first_of(numbers); - size_t numEnd = line.find_first_not_of(numbers, numStart); - std::string val = line.substr(numStart, numEnd-numStart); - readParam.numTransformsPerWg = strtol(val.c_str(), NULL, 10); - continue; - } - - pos = line.find(strRad); - if(pos != std::string::npos) - { - line.erase(pos, strRad.length()); - while(std::string::npos != line.find_first_of(numbers)) - { - size_t numStart = line.find_first_of(numbers); - size_t numEnd = line.find_first_not_of(numbers, numStart); - std::string val = line.substr(numStart, numEnd-numStart); - readParam.radices.push_back(strtol(val.c_str(), NULL, 10)); - line.erase(0, numEnd); - } - continue; - } - } - - //std::cout << std::endl; - //std::cout << "File Parameters" << std::endl; - //std::cout << strWgs << " " << readParam.workGroupSize << std::endl; - //std::cout << strNtw << " " << readParam.numTransformsPerWg << std::endl; - //std::cout << strRad << " "; for(size_t i=0; i radices; + bool halfLds; +}; + +// File format + +// WorkGroupSize: +// TransformsPerWorkGroup: +// Radices: +// LdsUse: + +void ReadParameterFile(ParamRead &readParam) { + const char *fileName = "parameters.txt"; + std::ifstream file(fileName); + + if (!file.is_open()) { + std::cout << "File: " << fileName << " could not be opened, exiting ...." + << std::endl; + exit(-1); + } + + std::string strWgs = "WorkGroupSize:"; + std::string strNtw = "TransformsPerWorkGroup:"; + std::string strRad = "Radices:"; + std::string strLds = "LdsUse:"; + std::string numbers = "0123456789"; + + std::string line; + while (std::getline(file, line)) { + + size_t pos; + + pos = line.find(strWgs); + if (pos != std::string::npos) { + line.erase(pos, strWgs.length()); + size_t numStart = line.find_first_of(numbers); + size_t numEnd = line.find_first_not_of(numbers, numStart); + std::string val = line.substr(numStart, numEnd - numStart); + readParam.workGroupSize = strtol(val.c_str(), nullptr, 10); + continue; + } + + pos = line.find(strNtw); + if (pos != std::string::npos) { + line.erase(pos, strNtw.length()); + size_t numStart = line.find_first_of(numbers); + size_t numEnd = line.find_first_not_of(numbers, numStart); + std::string val = line.substr(numStart, numEnd - numStart); + readParam.numTransformsPerWg = strtol(val.c_str(), nullptr, 10); + continue; + } + + pos = line.find(strRad); + if (pos != std::string::npos) { + line.erase(pos, strRad.length()); + while (std::string::npos != line.find_first_of(numbers)) { + size_t numStart = line.find_first_of(numbers); + size_t numEnd = line.find_first_not_of(numbers, numStart); + std::string val = line.substr(numStart, numEnd - numStart); + readParam.radices.push_back(strtol(val.c_str(), nullptr, 10)); + line.erase(0, numEnd); + } + continue; + } + } + + // std::cout << std::endl; + // std::cout << "File Parameters" << std::endl; + // std::cout << strWgs << " " << readParam.workGroupSize << std::endl; + // std::cout << strNtw << " " << readParam.numTransformsPerWg << std::endl; + // std::cout << strRad << " "; for(size_t i=0; i - class KernelCoreSpecs - { - struct SpecRecord - { - size_t length; - size_t workGroupSize; - size_t numTransforms; - size_t numPasses; - size_t radices[12]; // Setting upper limit of number of passes to 12 - }; - - typedef typename std::map SpecTable; - SpecTable specTable; - - public: - KernelCoreSpecs() - { - switch(PR) - { - case P_SINGLE: - { - SpecRecord specRecord[] = { - - RADIX_TABLE_COMMON - - // Length, WorkGroupSize, NumTransforms, NumPasses, Radices - { 4096, 256, 1, 4, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1024, 128, 1, 4, 8, 8, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 128, 64, 4, 3, 8, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 8, 64, 32, 2, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - - }; - - size_t tableLength = sizeof(specRecord)/sizeof(specRecord[0]); - for(size_t i=0; isecond.radices; - numPasses = it->second.numPasses; - } - } - - void GetWGSAndNT(size_t length, size_t &workGroupSize, size_t &numTransforms) const - { - workGroupSize = 0; - numTransforms = 0; - - typename SpecTable::const_iterator it = specTable.find(length); - if(it != specTable.end()) - { - workGroupSize = it->second.workGroupSize; - numTransforms = it->second.numTransforms; - } - } - }; - - - - // Given the length of 1d fft, this function determines the appropriate work group size - // and the number of transforms per work group - // TODO for optimizations - experiment with different possibilities for work group sizes and num transforms for improving performance - void DetermineSizes(const size_t &MAX_WGS, const size_t &length, size_t &workGroupSize, size_t &numTrans, Precision &pr) - { - assert(MAX_WGS >= 64); - - if(length == 1) // special case - { - workGroupSize = 64; - numTrans = 64; - return; - } - - size_t baseRadix[] = {13,11,7,5,3,2}; // list only supported primes - size_t baseRadixSize = sizeof(baseRadix)/sizeof(baseRadix[0]); - - size_t l = length; - std::map primeFactorsExpanded; - for(size_t r=0; r= 1024) { workGroupSize = (MAX_WGS >= 256) ? 256 : MAX_WGS; numTrans = 1; } - else if (length == 512) { workGroupSize = 64; numTrans = 1; } - else if (length >= 16) { workGroupSize = 64; numTrans = 256/length; } - else { workGroupSize = 64; numTrans = 128/length; } - } - else if (primeFactorsExpanded[3] == length) // Length is pure power of 3 - { - workGroupSize = (MAX_WGS >= 256) ? 243 : 27; - numTrans = length >= 3*workGroupSize ? 1 : (3*workGroupSize)/length; - } - else if (primeFactorsExpanded[5] == length) // Length is pure power of 5 - { - workGroupSize = (MAX_WGS >= 128) ? 125 : 25; - numTrans = length >= 5*workGroupSize ? 1 : (5*workGroupSize)/length; - } - else if (primeFactorsExpanded[7] == length) // Length is pure power of 7 - { - workGroupSize = 49; - numTrans = length >= 7*workGroupSize ? 1 : (7*workGroupSize)/length; - } - else if (primeFactorsExpanded[11] == length) // Length is pure power of 11 - { - workGroupSize = 121; - numTrans = length >= 11 * workGroupSize ? 1 : (11 * workGroupSize) / length; - } - else if (primeFactorsExpanded[13] == length) // Length is pure power of 13 - { - workGroupSize = 169; - numTrans = length >= 13 * workGroupSize ? 1 : (13 * workGroupSize) / length; - } - else - { - size_t leastNumPerWI = 1; // least number of elements in one work item - size_t maxWorkGroupSize = MAX_WGS; // maximum work group size desired - - - if (primeFactorsExpanded[2] * primeFactorsExpanded[3] == length) { - if (length % 12 == 0) { - leastNumPerWI = 12; maxWorkGroupSize = 128; - } else { - leastNumPerWI = 6; maxWorkGroupSize = 256; - } - } else if (primeFactorsExpanded[2] * primeFactorsExpanded[5] == length) { - if (length % 20 == 0) { - leastNumPerWI = 20; maxWorkGroupSize = 64; - } else { - leastNumPerWI = 10; maxWorkGroupSize = 128; - } - } else if (primeFactorsExpanded[2] * primeFactorsExpanded[7] == length) { - leastNumPerWI = 14; maxWorkGroupSize = 64; - } else if (primeFactorsExpanded[3] * primeFactorsExpanded[5] == length) { - leastNumPerWI = 15; maxWorkGroupSize = 128; - } else if (primeFactorsExpanded[3] * primeFactorsExpanded[7] == length) { - leastNumPerWI = 21; maxWorkGroupSize = 128; - } else if (primeFactorsExpanded[5] * primeFactorsExpanded[7] == length) { - leastNumPerWI = 35; maxWorkGroupSize = 64; - } else if (primeFactorsExpanded[2] * primeFactorsExpanded[3] * primeFactorsExpanded[5] == length) { - leastNumPerWI = 30; maxWorkGroupSize = 64; - } else if (primeFactorsExpanded[2] * primeFactorsExpanded[3] * primeFactorsExpanded[7] == length) { - leastNumPerWI = 42; maxWorkGroupSize = 60; - } else if (primeFactorsExpanded[2] * primeFactorsExpanded[5] * primeFactorsExpanded[7] == length) { - leastNumPerWI = 70; maxWorkGroupSize = 36; - } else if (primeFactorsExpanded[3] * primeFactorsExpanded[5] * primeFactorsExpanded[7] == length) { - leastNumPerWI =105; maxWorkGroupSize = 24; - } - else if (primeFactorsExpanded[2] * primeFactorsExpanded[11] == length) { - leastNumPerWI = 22; maxWorkGroupSize = 128; - } - else if (primeFactorsExpanded[2] * primeFactorsExpanded[13] == length) { - leastNumPerWI = 26; maxWorkGroupSize = 128; - } - else { - leastNumPerWI =210; maxWorkGroupSize = 12; - } - if (pr==P_DOUBLE) - { - //leastNumPerWI /= 2; - maxWorkGroupSize /= 2; - } - - - if (maxWorkGroupSize > MAX_WGS) - maxWorkGroupSize = MAX_WGS; - assert (leastNumPerWI > 0 && length % leastNumPerWI == 0); - - for (size_t lnpi = leastNumPerWI; lnpi <= length; lnpi += leastNumPerWI) { - if (length % lnpi != 0) continue; - - if (length / lnpi <= MAX_WGS) { - leastNumPerWI = lnpi; - break; - } - } - - numTrans = maxWorkGroupSize / (length / leastNumPerWI); - numTrans = numTrans < 1 ? 1 : numTrans; - workGroupSize = numTrans * (length / leastNumPerWI); - } - - assert(workGroupSize <= MAX_WGS); - } - - // Twiddle factors table - class TwiddleTable - { - size_t N; // length - double *wc, *ws; // cosine, sine arrays - - public: - TwiddleTable(size_t length) : N(length) - { - // Allocate memory for the tables - // We compute twiddle factors in double precision for both P_SINGLE and P_DOUBLE - wc = new double[N]; - ws = new double[N]; - } - - ~TwiddleTable() - { - // Free - delete[] wc; - delete[] ws; - } - - template - void GenerateTwiddleTable(const std::vector &radices, std::string &twStr) - { - const double TWO_PI = -6.283185307179586476925286766559; - - // Make sure the radices vector sums up to N - size_t sz = 1; - for(std::vector::const_iterator i = radices.begin(); - i != radices.end(); i++) - { - sz *= (*i); - } - assert(sz == N); - - // Generate the table - size_t L = 1; - size_t nt = 0; - for(std::vector::const_iterator i = radices.begin(); - i != radices.end(); i++) - { - size_t radix = *i; - - L *= radix; - - // Twiddle factors - for(size_t k=0; k<(L/radix); k++) - { - double theta = TWO_PI * ((double)k)/((double)L); - - for(size_t j=1; j(); - - // Stringize the table - std::stringstream ss; - ss.imbue(std::locale("C")); - ss.precision(34); - ss << std::scientific; - for(size_t i = 0; i < (N-1); i++) - { - ss << "("; ss << RegBaseType(2); ss << ")("; - ss << wc[i] << sfx << ", "; - ss << ws[i] << sfx << "),\n"; - } - twStr += ss.str(); - } - }; - - // A pass inside an FFT kernel - template - class Pass - { - size_t position; // Position in the kernel - - size_t algL; // 'L' value from fft algorithm - size_t algLS; // 'LS' value - size_t algR; // 'R' value - - size_t length; // Length of FFT - size_t radix; // Base radix - size_t cnPerWI; // Complex numbers per work-item - - size_t workGroupSize; // size of the workgroup = (length / cnPerWI) - // this number is essentially number of work-items needed to compute 1 transform - // this number will be different from the kernel class workGroupSize if there - // are multiple transforms per workgroup - - size_t numButterfly; // Number of basic FFT butterflies = (cnPerWI / radix) - size_t numB1, numB2, numB4; // number of different types of butterflies - - bool r2c; // real to complex transform - bool c2r; // complex to real transform - bool rcFull; - bool rcSimple; - - bool realSpecial; - - bool enableGrouping; - bool linearRegs; // scalar registers (non-vectorized registers) to be used - bool halfLds; // only half the LDS of a complex length need to be used - Pass *nextPass; - - //callback members - bool fft_doPreCallback; - clfftCallbackParam fft_preCallback; - - bool fft_doPostCallback; - clfftCallbackParam fft_postCallback; - - inline void RegBase(size_t regC, std::string &str) const - { - str += "B"; - str += SztToStr(regC); - } - - inline void RegBaseAndCount(size_t num, std::string &str) const - { - str += "C"; - str += SztToStr(num); - } - - inline void RegBaseAndCountAndPos(const std::string &RealImag, size_t radPos, std::string &str) const - { - str += RealImag; - str += SztToStr(radPos); - } - - void RegIndex(size_t regC, size_t num, const std::string &RealImag, size_t radPos, std::string &str) const - { - RegBase(regC, str); - RegBaseAndCount(num, str); - RegBaseAndCountAndPos(RealImag, radPos, str); - } - - void DeclareRegs(const std::string ®Type, size_t regC, size_t numB, std::string &passStr) const - { - std::string regBase; - RegBase(regC, regBase); - - if(linearRegs) - { - assert(regC == 1); - assert(numB == numButterfly); - } - - for(size_t i=0; i(2); - - for(size_t i=0; i class KernelCoreSpecs { + struct SpecRecord { + size_t length; + size_t workGroupSize; + size_t numTransforms; + size_t numPasses; + size_t radices[12]; // Setting upper limit of number of passes to 12 + }; + + typedef typename std::map SpecTable; + SpecTable specTable; + +public: + KernelCoreSpecs() { + switch (PR) { + case P_SINGLE: { + SpecRecord specRecord[] = { + + RADIX_TABLE_COMMON + + // Length, WorkGroupSize, NumTransforms, NumPasses, Radices + {4096, 256, 1, 4, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0}, + {1024, 128, 1, 4, 8, 8, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}, + {128, 64, 4, 3, 8, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 64, 32, 2, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + }; + + size_t tableLength = sizeof(specRecord) / sizeof(specRecord[0]); + for (size_t i = 0; i < tableLength; i++) + specTable[specRecord[i].length] = specRecord[i]; + + } break; + + case P_DOUBLE: { + SpecRecord specRecord[] = { + + RADIX_TABLE_COMMON + + // Length, WorkGroupSize, NumTransforms, NumPasses, Radices + {1024, 128, 1, 4, 8, 8, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}, + {128, 64, 4, 3, 8, 8, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {8, 64, 16, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + }; + + size_t tableLength = sizeof(specRecord) / sizeof(specRecord[0]); + for (size_t i = 0; i < tableLength; i++) + specTable[specRecord[i].length] = specRecord[i]; + } break; + + default: + assert(false); + } + } + + void GetRadices(size_t length, size_t &numPasses, + const size_t *&pRadices) const { + pRadices = nullptr; + numPasses = 0; + + auto it = specTable.find(length); + if (it != specTable.end()) { + pRadices = it->second.radices; + numPasses = it->second.numPasses; + } + } + + void GetWGSAndNT(size_t length, size_t &workGroupSize, + size_t &numTransforms) const { + workGroupSize = 0; + numTransforms = 0; + + auto it = specTable.find(length); + if (it != specTable.end()) { + workGroupSize = it->second.workGroupSize; + numTransforms = it->second.numTransforms; + } + } +}; + +// Given the length of 1d fft, this function determines the appropriate work +// group size and the number of transforms per work group +// TODO for optimizations - experiment with different possibilities for work +// group sizes and num transforms for improving performance +void DetermineSizes(const size_t &MAX_WGS, const size_t &length, + size_t &workGroupSize, size_t &numTrans, Precision &pr) { + assert(MAX_WGS >= 64); + + if (length == 1) // special case + { + workGroupSize = 64; + numTrans = 64; + return; + } + + size_t baseRadix[] = {13, 11, 7, 5, 3, 2}; // list only supported primes + size_t baseRadixSize = sizeof(baseRadix) / sizeof(baseRadix[0]); + + size_t l = length; + std::map primeFactorsExpanded; + for (size_t r = 0; r < baseRadixSize; r++) { + size_t rad = baseRadix[r]; + size_t e = 1; + while (!(l % rad)) { + l /= rad; + e *= rad; + } + + primeFactorsExpanded[rad] = e; + } + + assert(l == 1); // Makes sure the number is composed of only supported primes + + if (primeFactorsExpanded[2] == length) // Length is pure power of 2 + { + if (length >= 1024) { + workGroupSize = (MAX_WGS >= 256) ? 256 : MAX_WGS; + numTrans = 1; + } else if (length == 512) { + workGroupSize = 64; + numTrans = 1; + } else if (length >= 16) { + workGroupSize = 64; + numTrans = 256 / length; + } else { + workGroupSize = 64; + numTrans = 128 / length; + } + } else if (primeFactorsExpanded[3] == length) // Length is pure power of 3 + { + workGroupSize = (MAX_WGS >= 256) ? 243 : 27; + numTrans = length >= 3 * workGroupSize ? 1 : (3 * workGroupSize) / length; + } else if (primeFactorsExpanded[5] == length) // Length is pure power of 5 + { + workGroupSize = (MAX_WGS >= 128) ? 125 : 25; + numTrans = length >= 5 * workGroupSize ? 1 : (5 * workGroupSize) / length; + } else if (primeFactorsExpanded[7] == length) // Length is pure power of 7 + { + workGroupSize = 49; + numTrans = length >= 7 * workGroupSize ? 1 : (7 * workGroupSize) / length; + } else if (primeFactorsExpanded[11] == length) // Length is pure power of 11 + { + workGroupSize = 121; + numTrans = length >= 11 * workGroupSize ? 1 : (11 * workGroupSize) / length; + } else if (primeFactorsExpanded[13] == length) // Length is pure power of 13 + { + workGroupSize = 169; + numTrans = length >= 13 * workGroupSize ? 1 : (13 * workGroupSize) / length; + } else { + size_t leastNumPerWI = 1; // least number of elements in one work item + size_t maxWorkGroupSize = MAX_WGS; // maximum work group size desired + + if (primeFactorsExpanded[2] * primeFactorsExpanded[3] == length) { + if (length % 12 == 0) { + leastNumPerWI = 12; + maxWorkGroupSize = 128; + } else { + leastNumPerWI = 6; + maxWorkGroupSize = 256; + } + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[5] == length) { + if (length % 20 == 0) { + leastNumPerWI = 20; + maxWorkGroupSize = 64; + } else { + leastNumPerWI = 10; + maxWorkGroupSize = 128; + } + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[7] == length) { + leastNumPerWI = 14; + maxWorkGroupSize = 64; + } else if (primeFactorsExpanded[3] * primeFactorsExpanded[5] == length) { + leastNumPerWI = 15; + maxWorkGroupSize = 128; + } else if (primeFactorsExpanded[3] * primeFactorsExpanded[7] == length) { + leastNumPerWI = 21; + maxWorkGroupSize = 128; + } else if (primeFactorsExpanded[5] * primeFactorsExpanded[7] == length) { + leastNumPerWI = 35; + maxWorkGroupSize = 64; + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[3] * + primeFactorsExpanded[5] == + length) { + leastNumPerWI = 30; + maxWorkGroupSize = 64; + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[3] * + primeFactorsExpanded[7] == + length) { + leastNumPerWI = 42; + maxWorkGroupSize = 60; + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[5] * + primeFactorsExpanded[7] == + length) { + leastNumPerWI = 70; + maxWorkGroupSize = 36; + } else if (primeFactorsExpanded[3] * primeFactorsExpanded[5] * + primeFactorsExpanded[7] == + length) { + leastNumPerWI = 105; + maxWorkGroupSize = 24; + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[11] == length) { + leastNumPerWI = 22; + maxWorkGroupSize = 128; + } else if (primeFactorsExpanded[2] * primeFactorsExpanded[13] == length) { + leastNumPerWI = 26; + maxWorkGroupSize = 128; + } else { + leastNumPerWI = 210; + maxWorkGroupSize = 12; + } + if (pr == P_DOUBLE) { + // leastNumPerWI /= 2; + maxWorkGroupSize /= 2; + } + + if (maxWorkGroupSize > MAX_WGS) + maxWorkGroupSize = MAX_WGS; + assert(leastNumPerWI > 0 && length % leastNumPerWI == 0); + + for (size_t lnpi = leastNumPerWI; lnpi <= length; lnpi += leastNumPerWI) { + if (length % lnpi != 0) + continue; + + if (length / lnpi <= MAX_WGS) { + leastNumPerWI = lnpi; + break; + } + } + + numTrans = maxWorkGroupSize / (length / leastNumPerWI); + numTrans = numTrans < 1 ? 1 : numTrans; + workGroupSize = numTrans * (length / leastNumPerWI); + } + + assert(workGroupSize <= MAX_WGS); +} + +// Twiddle factors table +class TwiddleTable { + size_t N; // length + double *wc, *ws; // cosine, sine arrays + +public: + TwiddleTable(size_t length) : N(length) { + // Allocate memory for the tables + // We compute twiddle factors in double precision for both P_SINGLE and + // P_DOUBLE + wc = new double[N]; + ws = new double[N]; + } + + ~TwiddleTable() { + // Free + delete[] wc; + delete[] ws; + } + + template + void GenerateTwiddleTable(const std::vector &radices, + std::string &twStr) { + const double TWO_PI = -6.283185307179586476925286766559; + + // Make sure the radices vector sums up to N + size_t sz = 1; + for (unsigned long radice : radices) { + sz *= radice; + } + assert(sz == N); + + // Generate the table + size_t L = 1; + size_t nt = 0; + for (unsigned long radix : radices) { + L *= radix; + + // Twiddle factors + for (size_t k = 0; k < (L / radix); k++) { + double theta = TWO_PI * ((double)k) / ((double)L); + + for (size_t j = 1; j < radix; j++) { + double c = cos(((double)j) * theta); + double s = sin(((double)j) * theta); + + // if (fabs(c) < 1.0E-12) c = 0.0; + // if (fabs(s) < 1.0E-12) s = 0.0; + + wc[nt] = c; + ws[nt++] = s; + } + } + } + + std::string sfx = FloatSuffix(); + + // Stringize the table + std::stringstream ss; + ss.imbue(std::locale("C")); + ss.precision(34); + ss << std::scientific; + for (size_t i = 0; i < (N - 1); i++) { + ss << "("; + ss << RegBaseType(2); + ss << ")("; + ss << wc[i] << sfx << ", "; + ss << ws[i] << sfx << "),\n"; + } + twStr += ss.str(); + } +}; + +// A pass inside an FFT kernel +template class Pass { + size_t position; // Position in the kernel + + size_t algL; // 'L' value from fft algorithm + size_t algLS; // 'LS' value + size_t algR; // 'R' value + + size_t length; // Length of FFT + size_t radix; // Base radix + size_t cnPerWI; // Complex numbers per work-item + + size_t workGroupSize; // size of the workgroup = (length / cnPerWI) + // this number is essentially number of work-items + // needed to compute 1 transform this number will be + // different from the kernel class workGroupSize if + // there are multiple transforms per workgroup + + size_t numButterfly; // Number of basic FFT butterflies = (cnPerWI / radix) + size_t numB1, numB2, numB4; // number of different types of butterflies + + bool r2c; // real to complex transform + bool c2r; // complex to real transform + bool rcFull; + bool rcSimple; + + bool realSpecial; + + bool enableGrouping; + bool linearRegs; // scalar registers (non-vectorized registers) to be used + bool halfLds; // only half the LDS of a complex length need to be used + Pass *nextPass; + + // callback members + bool fft_doPreCallback; + clfftCallbackParam fft_preCallback; + + bool fft_doPostCallback; + clfftCallbackParam fft_postCallback; + + inline void RegBase(size_t regC, std::string &str) const { + str += "B"; + str += SztToStr(regC); + } + + inline void RegBaseAndCount(size_t num, std::string &str) const { + str += "C"; + str += SztToStr(num); + } + + inline void RegBaseAndCountAndPos(const std::string &RealImag, size_t radPos, + std::string &str) const { + str += RealImag; + str += SztToStr(radPos); + } + + void RegIndex(size_t regC, size_t num, const std::string &RealImag, + size_t radPos, std::string &str) const { + RegBase(regC, str); + RegBaseAndCount(num, str); + RegBaseAndCountAndPos(RealImag, radPos, str); + } + + void DeclareRegs(const std::string ®Type, size_t regC, size_t numB, + std::string &passStr) const { + std::string regBase; + RegBase(regC, regBase); + + if (linearRegs) { + assert(regC == 1); + assert(numB == numButterfly); + } + + for (size_t i = 0; i < numB; i++) { + passStr += "\n\t"; + passStr += regType; + passStr += " "; + + std::string regBaseCount = regBase; + RegBaseAndCount(i, regBaseCount); + + for (size_t r = 0;; r++) { + if (linearRegs) { + std::string regIndex = "R"; + RegBaseAndCountAndPos("", i * radix + r, regIndex); + + passStr += regIndex; + } else { + std::string regRealIndex(regBaseCount), regImagIndex(regBaseCount); + + RegBaseAndCountAndPos("R", r, regRealIndex); // real + RegBaseAndCountAndPos("I", r, regImagIndex); // imaginary + + passStr += regRealIndex; + passStr += ", "; + passStr += regImagIndex; + } + + if (r == radix - 1) { + passStr += ";"; + break; + } else { + passStr += ", "; + } + } + } + } + + inline std::string IterRegArgs() const { + std::string str = ""; + + if (linearRegs) { + std::string regType = RegBaseType(2); + + for (size_t i = 0; i < cnPerWI; i++) { + if (i != 0) + str += ", "; + str += regType; + str += " *R"; + str += SztToStr(i); + } + } + + return str; + } + +#define SR_READ 1 +#define SR_TWMUL 2 +#define SR_TWMUL_3STEP 3 +#define SR_WRITE 4 #define SR_COMP_REAL 0 // real #define SR_COMP_IMAG 1 // imag #define SR_COMP_BOTH 2 // real & imag - // SweepRegs is to iterate through the registers to do the three basic operations: - // reading, twiddle multiplication, writing - void SweepRegs( size_t flag, bool fwd, bool interleaved, size_t stride, size_t component, - double scale, bool frontTwiddle, - const std::string &bufferRe, const std::string &bufferIm, const std::string &offset, - size_t regC, size_t numB, size_t numPrev, std::string &passStr, bool initZero = false, bool isPrecallVector = false, bool oddt = false) const - { - assert( (flag == SR_READ ) || - (flag == SR_TWMUL) || - (flag == SR_TWMUL_3STEP) || - (flag == SR_WRITE) ); - - const std::string twTable = TwTableName(); - const std::string tw3StepFunc = TwTableLargeFunc(); - - // component: 0 - real, 1 - imaginary, 2 - both - size_t cStart, cEnd; - switch(component) - { - case SR_COMP_REAL: cStart = 0; cEnd = 1; break; - case SR_COMP_IMAG: cStart = 1; cEnd = 2; break; - case SR_COMP_BOTH: cStart = 0; cEnd = 2; break; - default: assert(false); - } - - // Read/Write logic: - // The double loop inside pass loop of FFT algorithm is mapped into the - // workGroupSize work items with each work item handling cnPerWI numbers - - // Read logic: - // Reads for any pass appear the same with the stockham algorithm when mapped to - // the work items. The buffer is divided into (L/radix) sized blocks and the - // values are read in linear order inside each block. - - // Vector reads are possible if we have unit strides - // since read pattern remains the same for all passes and they are contiguous - // Writes are not contiguous - - // TODO : twiddle multiplies can be combined with read - // TODO : twiddle factors can be reordered in the table to do vector reads of them - - // Write logic: - // outer loop index k and the inner loop index j map to 'me' as follows: - // In one work-item (1 'me'), there are 'numButterfly' fft butterflies. They - // are indexed as numButterfly*me + butterflyIndex, where butterflyIndex's range is - // 0 ... numButterfly-1. The total number of butterflies needed is covered over all - // the work-items. So essentially the double loop k,j is flattened to fit this linearly - // increasing 'me'. - // j = (numButterfly*me + butterflyIndex)%LS - // k = (numButterfly*me + butterflyIndex)/LS - - - std::string twType = RegBaseType(2); - std::string rType = RegBaseType(1); - - size_t butterflyIndex = numPrev; - std::string bufOffset; - - std::string regBase; - RegBase(regC, regBase); - - // special write back to global memory with float4 grouping, writing 2 complex numbers at once - if( numB && (numB%2 == 0) && (regC == 1) && (stride == 1) && (numButterfly%2 == 0) && (algLS%2 == 0) && (flag == SR_WRITE) && - (nextPass == NULL) && interleaved && (component == SR_COMP_BOTH) && linearRegs && enableGrouping && !fft_doPostCallback ) - { - assert((numButterfly * workGroupSize) == algLS); - assert(bufferRe.compare(bufferIm) == 0); // Make sure Real & Imag buffer strings are same for interleaved data - - passStr += "\n\t"; - passStr += "__global "; passStr += RegBaseType(4); - passStr += " *buff4g = (__global "; passStr += RegBaseType(4); passStr += " *)"; - passStr += bufferRe; passStr += ";\n\t"; // Assuming 'outOffset' is 0, so not adding it here - - for(size_t r=0; r(4); passStr += ")("; - passStr += regIndexA; passStr += ".x, "; - passStr += regIndexA; passStr += ".y, "; - passStr += regIndexB; passStr += ".x, "; - passStr += regIndexB; passStr += ".y) "; - if(scale != 1.0f) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } - passStr += ";"; - - butterflyIndex++; - } - } - - return; - } - - size_t hid = 0; - bool swapElement = false; - size_t tIter = numB * radix; - - // block to rearrange reads of adjacent memory locations together - if(linearRegs && (flag == SR_READ)) - { - for(size_t r=0; r 1 ? (tIter / 2) : 1 ); - swapElement = swapElement && hid != 0; - swapElement = (oddt && ((i * radix + r) >= (tIter - 1))) ? false : swapElement; //for c2r odd size don't swap for last register - if (swapElement) - { - regIndexC = regIndex; regIndexC += ").y"; - } - - regIndex += ").x"; - buffer = bufferRe; - tail = interleaved ? ".x;" : ";"; - } - else - { - RegBaseAndCountAndPos("", i*radix + r, regIndex); regIndex += ").y"; - buffer = bufferIm; - tail = interleaved ? ".y;" : ";"; - } - } - - //get offset - bufOffset.clear(); - bufOffset += offset; bufOffset += " + ( "; bufOffset += SztToStr(numPrev); bufOffset += " + "; - bufOffset += "me*"; bufOffset += SztToStr(numButterfly); bufOffset += " + "; - bufOffset += SztToStr(i); bufOffset += " + "; - bufOffset += SztToStr(r*length/radix); bufOffset += " )*"; - bufOffset += SztToStr(stride); - - //If precallback is set invoke callback function - //Invoke callback only once in Planar data layout (i.e.c==0) - if (fft_doPreCallback && c == 0 && component == SR_COMP_BOTH) - { - passStr += "\n\t"; - passStr += "retPrecallback = "; passStr += fft_preCallback.funcname; passStr += "("; - if(interleaved) - { - passStr += buffer; passStr += ", "; - } - else - { - passStr += bufferRe; passStr += ", "; passStr += bufferIm; passStr += ", "; - } - passStr += bufOffset; passStr += ", pre_userdata"; - if (fft_preCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");"; - } - - if (swapElement) - { - passStr += "\n\t"; - passStr += regIndexC; passStr += " = "; passStr += regIndex; passStr += ";"; - } - - passStr += "\n\t"; - passStr += regIndex; - passStr += " = "; - - if (initZero) - { - if (interleaved && (component == SR_COMP_BOTH)) - passStr += "(fvect2)(0, 0);"; - else - passStr += "0;"; - } - else - { - //Use the return value from precallback if set - if (fft_doPreCallback && (component == SR_COMP_BOTH || r2c)) - { - if (component == SR_COMP_BOTH) - { - passStr += "retPrecallback"; - passStr += interleaved ? tail : (c == 0) ? ".x;" : ".y;"; - } - else if (r2c) - { - passStr += fft_preCallback.funcname; passStr += "("; passStr += buffer; passStr += ", "; - passStr += bufOffset; passStr += ", pre_userdata"; - - if (fft_preCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");"; - } - } - else - { - passStr += buffer; - passStr += "["; passStr += bufOffset; passStr += "]"; passStr += tail; - } - } - - // Since we read real & imag at once, we break the loop - if(interleaved && (component == SR_COMP_BOTH) ) - break; - } - } - } - return; - } - - // block to rearrange writes of adjacent memory locations together - if(linearRegs && (flag == SR_WRITE) && (nextPass == NULL)) - { - for(size_t r=0; r (radix/2))) - break; - - if(realSpecial && (nextPass == NULL) && (r == radix/2) && (i != 0)) - break; - - if(realSpecial && (nextPass == NULL) && (r == radix/2) && (i == 0)) - passStr += "\n\t}\n\tif( rw && !me)\n\t{"; - - std::string regIndexC0; - for(size_t c=cStart; c algLS ) - { - bufOffset += "(("; bufOffset += SztToStr(numButterfly); - bufOffset += "*me + "; bufOffset += SztToStr(butterflyIndex); bufOffset += ")/"; - bufOffset += SztToStr(algLS); bufOffset += ")*"; bufOffset += SztToStr(algL); bufOffset += " + ("; - bufOffset += SztToStr(numButterfly); bufOffset += "*me + "; bufOffset += SztToStr(butterflyIndex); - bufOffset += ")%"; bufOffset += SztToStr(algLS); bufOffset += " + "; - } - else - { - bufOffset += SztToStr(numButterfly); bufOffset += "*me + "; bufOffset += SztToStr(butterflyIndex); - bufOffset += " + "; - } - bufOffset += SztToStr(r*algLS); bufOffset += " )*"; bufOffset += SztToStr(stride); - - if(scale != 1.0f) { regIndex += " * "; regIndex += FloatToStr(scale); regIndex += FloatSuffix(); } - if (c == cStart) regIndexC0 = regIndex; - - if (fft_doPostCallback && !r2c) - { - if (interleaved || c == (cEnd - 1)) - { - passStr += "\n\t"; - passStr += fft_postCallback.funcname; passStr += "("; - - if (interleaved || (c2r && bufferRe.compare(bufferIm) == 0)) - { - passStr += buffer; - } - else - { - passStr += bufferRe; passStr += ", "; passStr += bufferIm; - } - passStr += ", "; - passStr += bufOffset; passStr += ", post_userdata, ("; passStr += regIndexC0; passStr += ")"; - if (!(interleaved || (c2r && bufferRe.compare(bufferIm) == 0))) { passStr += ", ("; passStr += regIndex; passStr += ")"; } - - if (fft_postCallback.localMemSize > 0) - { - passStr += ", post_localmem"; - } - passStr += ");"; - } - } - else - { - passStr += "\n\t"; - passStr += buffer; passStr += "["; passStr += bufOffset; passStr += "]"; - passStr += tail; passStr += " = "; passStr += regIndex; passStr += ";"; - } - - // Since we write real & imag at once, we break the loop - if(interleaved && (component == SR_COMP_BOTH)) - break; - } - - if(realSpecial && (nextPass == NULL) && (r == radix/2) && (i == 0)) - passStr += "\n\t}\n\tif(rw)\n\t{"; - - butterflyIndex++; - } - } - - return; - } - - - for(size_t i=0; i 0) - { - passStr += ", localmem"; - } - passStr += ");"; - } - - if (fft_doPreCallback && c2r && component == SR_COMP_REAL && hid != 0) - { - passStr += "\n\t"; - passStr += regIndexC; passStr += " = "; passStr += regIndexSub; passStr += ";"; - } - - passStr += "\n\t"; - passStr += regIndexSub; - passStr += " = "; - - //Use the return value from precallback if set - if (fft_doPreCallback && (component == SR_COMP_BOTH || r2c)) - { - if (component == SR_COMP_BOTH) - { - passStr += "retPrecallback"; - - if (isPrecallVector) - { - passStr += "["; passStr += SztToStr(v); passStr += "]"; - } - passStr += interleaved ? tail : (c == 0) ? ".x;" : ".y;"; - } - else if (r2c) - { - passStr += fft_preCallback.funcname; passStr += "("; passStr += buffer; passStr += ", "; - passStr += bufOffset; passStr += ", pre_userdata"; - - if (fft_preCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");"; - } - } - else - { - passStr += buffer; - passStr += "["; passStr += bufOffset; passStr += "]"; passStr += tail; - } - } - - // Since we read real & imag at once, we break the loop - if(interleaved && (component == SR_COMP_BOTH) && linearRegs) - break; - } - } - } - else if( (flag == SR_TWMUL) || (flag == SR_TWMUL_3STEP) ) // twiddle multiplies and writes require that 'r' loop be innermost - { - for(size_t v=0; v (radix/2))) - break; - - if(realSpecial && (nextPass == NULL) && (r == radix/2) && (i != 0)) - break; - - if(realSpecial && (nextPass == NULL) && (r == radix/2) && (i == 0)) - passStr += "\n\t}\n\tif( rw && !me)\n\t{"; - - std::string regIndexC0; - - for(size_t c=cStart; c(); } - if (c == 0) regIndexC0 += regIndex; - - bufOffset.clear(); - bufOffset += offset; bufOffset += " + ( "; - if( (numButterfly * workGroupSize) > algLS ) - { - bufOffset += "(("; bufOffset += SztToStr(numButterfly); - bufOffset += "*me + "; bufOffset += SztToStr(butterflyIndex); bufOffset += ")/"; - bufOffset += SztToStr(algLS); bufOffset += ")*"; bufOffset += SztToStr(algL); bufOffset += " + ("; - bufOffset += SztToStr(numButterfly); bufOffset += "*me + "; bufOffset += SztToStr(butterflyIndex); - bufOffset += ")%"; bufOffset += SztToStr(algLS); bufOffset += " + "; - } - else - { - bufOffset += SztToStr(numButterfly); bufOffset += "*me + "; bufOffset += SztToStr(butterflyIndex); - bufOffset += " + "; - } - - bufOffset += SztToStr(r*algLS); bufOffset += " )*"; bufOffset += SztToStr(stride); - - if (fft_doPostCallback) - { - if(interleaved && (component == SR_COMP_BOTH)) - { - if (c == (cEnd - 1)) - { - passStr += "tempC.x = "; passStr += regIndexC0; passStr += ";\n\t"; - passStr += "tempC.y = "; passStr += regIndex; passStr += ";\n\t"; - - passStr += fft_postCallback.funcname; passStr += "("; - passStr += buffer; passStr += ", ("; - passStr += bufOffset; passStr += "), post_userdata, tempC"; - if (fft_postCallback.localMemSize > 0) - { - passStr += ", post_localmem"; - } - passStr += ");"; - } - } - else if (c == (cEnd - 1)) - { - passStr += fft_postCallback.funcname; passStr += "("; - passStr += bufferRe; passStr += ", "; passStr += bufferIm; passStr += ", ("; - passStr += bufOffset; passStr += "), post_userdata, ("; - passStr += regIndexC0; passStr += "), ("; passStr += regIndex; passStr += ")"; - if (fft_postCallback.localMemSize > 0) - { - passStr += ", post_localmem"; - } - passStr += ");"; - } - } - else - { - passStr += buffer; passStr += "["; passStr += bufOffset; passStr += "]"; - passStr += tail; passStr += " = "; passStr += regIndex; - passStr += ";"; - } - - // Since we write real & imag at once, we break the loop - if(interleaved && (component == SR_COMP_BOTH) && linearRegs) - break; - } - - if(realSpecial && (nextPass == NULL) && (r == radix/2) && (i == 0)) - passStr += "\n\t}\n\tif(rw)\n\t{"; - - } - - butterflyIndex++; - } - - } - } - - assert(butterflyIndex <= numButterfly); - } - - - // Special SweepRegs function to carry out some R-C/C-R specific operations - void SweepRegsRC( size_t flag, bool fwd, bool interleaved, size_t stride, size_t component, - double scale, bool setZero, bool batch2, bool oddt, - const std::string &bufferRe, const std::string &bufferIm, const std::string &offset, - std::string &passStr) const - { - assert( (flag == SR_READ ) || - (flag == SR_WRITE) ); - - - // component: 0 - real, 1 - imaginary, 2 - both - size_t cStart, cEnd; - switch(component) - { - case SR_COMP_REAL: cStart = 0; cEnd = 1; break; - case SR_COMP_IMAG: cStart = 1; cEnd = 2; break; - case SR_COMP_BOTH: cStart = 0; cEnd = 2; break; - default: assert(false); - } - - std::string rType = RegBaseType(1); - - assert(r2c || c2r); - assert(linearRegs); - bool singlePass = ((position == 0) && (nextPass == NULL)); - - size_t numCR = numButterfly * radix; - if(!(numCR%2)) assert(!oddt); - - size_t rStart = 0; - size_t rEnd = numCR; - - bool oddp = ((numCR%2) && (numCR > 1) && !setZero); - if(oddp) - { - if(oddt) { rStart = numCR-1; rEnd = numCR+1; } - else { rStart = 0; rEnd = numCR-1; } - } - - if(!oddp) assert(!oddt); - - for(size_t r=rStart; r 0) ? ", localmem);" : ");"; - } - else - { - passStr += "]"; - - if(fwd) { passStr += tail; } - else { if(!batch2) passStr += tail; else passStr += tail2; } - } - } - } - } - else // write operation - { - std::string tail; - std::string regIndex = "(*R"; - std::string regIndexPair = "(*R"; - std::string buffer; - - // Write real & imag at once - if(interleaved && (component == SR_COMP_BOTH)) - { - assert(bufferRe.compare(bufferIm) == 0); // Make sure Real & Imag buffer strings are same for interleaved data - buffer = bufferRe; - } - else - { - if(c == 0) - { - buffer = bufferRe; - tail = interleaved ? ".x" : ""; - } - else - { - buffer = bufferIm; - tail = interleaved ? ".y" : ""; - } - } - - - size_t bid, cid, lid; - if(singlePass && fwd) - { - bid = 1 + radix/2; - lid = r; - cid = r/bid; - - RegBaseAndCountAndPos("", r, regIndex); regIndex += ")"; - RegBaseAndCountAndPos("", (radix - r)%radix , regIndexPair); regIndexPair += ")"; - } - else - { - bid = numCR/2; - - if(oddt) - { - cid = r%2; - lid = 1 + (numCR/2); - - RegBaseAndCountAndPos("", r, regIndex); regIndex += ")"; - RegBaseAndCountAndPos("", r + 1, regIndexPair); regIndexPair += ")"; - } - else - { - cid = r/bid; - lid = 1 + r%bid; - - RegBaseAndCountAndPos("", r, regIndex); regIndex += ")"; - RegBaseAndCountAndPos("", r + bid, regIndexPair); regIndexPair += ")"; - } - } - - - if(!cid) - { - std::string oddpadd = oddp ? " (me/2) + " : " "; - - std::string sclStr = ""; - if(scale != 1.0f) { sclStr += " * "; sclStr += FloatToStr(scale); sclStr += FloatSuffix(); } - - if(fwd) - { - std::string idxStr, idxStrRev; - if((length <= 2) || ((length & (length - 1)) != 0)) - { - idxStr += SztToStr(length/(2*workGroupSize)); idxStr += "*me +"; idxStr += oddpadd; idxStr += SztToStr(lid); - } - else - { - idxStr += "me + "; idxStr += SztToStr(1 + length*(r%bid)/numCR); idxStr += oddpadd; - } - idxStrRev += SztToStr(length); idxStrRev += " - ("; idxStrRev += idxStr; idxStrRev += " )"; - - std::string val1Str, val2Str; - - if (fft_doPostCallback && !rcFull) - { - if (interleaved) - { - val1Str += "\n\t"; - val1Str += fft_postCallback.funcname; val1Str += "("; val1Str += buffer; val1Str += ", "; - val1Str += offset; val1Str += " + ( "; val1Str += idxStr; val1Str += " )*"; val1Str += SztToStr(stride); - val1Str += ", post_userdata, "; - } - else if (c == 0) - { - val1StrExt += "\n\t"; - val1StrExt += fft_postCallback.funcname; val1StrExt += "("; val1StrExt += bufferRe; val1StrExt += ", "; - val1StrExt += bufferIm; val1StrExt += ", "; val1StrExt += offset; val1StrExt += " + ( "; val1StrExt += idxStr; - val1StrExt += " )*"; val1StrExt += SztToStr(stride); val1StrExt += ", post_userdata, "; - } - } - else - { - val1Str += "\n\t"; - val1Str += buffer; val1Str += "["; val1Str += offset; val1Str += " + ( "; - val1Str += idxStr; val1Str += " )*"; val1Str += SztToStr(stride); val1Str += "]"; - val1Str += tail; val1Str += " = "; - } - - val2Str += "\n\t"; - val2Str += buffer; val2Str += "["; val2Str += offset; val2Str += " + ( "; - val2Str += idxStrRev; val2Str += " )*"; val2Str += SztToStr(stride); val2Str += "]"; - val2Str += tail; val2Str += " = "; - - std::string real1, imag1, real2, imag2; - - real1 += "("; real1 += regIndex; real1 += ".x + "; real1 += regIndexPair; real1 += ".x)*0.5"; - imag1 += "("; imag1 += regIndex; imag1 += ".y - "; imag1 += regIndexPair; imag1 += ".y)*0.5"; - real2 += "("; real2 += regIndex; real2 += ".y + "; real2 += regIndexPair; real2 += ".y)*0.5"; - imag2 += "(-"; imag2 += regIndex; imag2 += ".x + "; imag2 += regIndexPair; imag2 += ".x)*0.5"; - - if(interleaved && (component == SR_COMP_BOTH)) - { - val1Str += "("; val1Str += RegBaseType(2); val1Str += ")( "; - val2Str += "("; val2Str += RegBaseType(2); val2Str += ")( "; - - if(!batch2) { val1Str += real1; val1Str += ", "; val1Str += "+"; val1Str += imag1; - val2Str += real1; val2Str += ", "; val2Str += "-"; val2Str += imag1; } - else { val1Str += real2; val1Str += ", "; val1Str += "+"; val1Str += imag2; - val2Str += real2; val2Str += ", "; val2Str += "-"; val2Str += imag2; } - - val1Str += " )"; - val2Str += " )"; - } - else - { - val1Str += " ("; - val2Str += " ("; - if(c == 0) - { - if(!batch2) { val1Str += real1; - val2Str += real1; } - else { val1Str += real2; - val2Str += real2; } - } - else - { - if(!batch2) { val1Str += "+"; val1Str += imag1; - val2Str += "-"; val2Str += imag1; } - else { val1Str += "+"; val1Str += imag2; - val2Str += "-"; val2Str += imag2; } - } - val1Str += " )"; - val2Str += " )"; - } - - val1Str += sclStr; - val2Str += sclStr; - - if (fft_doPostCallback && !rcFull) - { - if (!interleaved) - { - val1StrExt += val1Str; - val1Str.clear(); - - if(c == 0) val1StrExt += ", "; - else val1Str += val1StrExt; - } - - if (interleaved || c == (cEnd - 1)) - { - if (fft_postCallback.localMemSize > 0) val1Str += ", localmem"; - val1Str += ");"; - } - } - else - { - val1Str += ";"; - } - - passStr += val1Str; - if(rcFull) { passStr += val2Str; passStr += ";"; } - } - else - { - std::string idxStr, idxStrRev; - if((length <= 2) || ((length & (length - 1)) != 0)) - { - idxStr += SztToStr(bid); idxStr += "*me +"; idxStr += oddpadd; idxStr += SztToStr(lid); - } - else - { - idxStr += "me + "; idxStr += SztToStr(1 + length*(r%bid)/numCR); idxStr += oddpadd; - } - idxStrRev += SztToStr(length); idxStrRev += " - ("; idxStrRev += idxStr; idxStrRev += " )"; - - passStr += "\n\t"; - passStr += buffer; passStr += "["; passStr += offset; passStr += " + ( "; - - if(!batch2) passStr += idxStr; - else passStr += idxStrRev; - - passStr += " )*"; passStr += SztToStr(stride); passStr += "]"; - passStr += tail; passStr += " = "; - - passStr += "( "; - if(c == 0) - { - regIndex += ".x"; - regIndexPair += fft_doPreCallback ? ".y" : ".x"; - - if(!batch2) { passStr += regIndex; passStr += " - "; passStr += regIndexPair; } - else { passStr += regIndex; passStr += " + "; passStr += regIndexPair; } - } - else - { - regIndex += ".y"; regIndexPair += (fft_doPreCallback && oddt) ? ".x" : ".y"; - - if(!batch2) { passStr += regIndex; passStr += " + "; passStr += regIndexPair; } - else { passStr += " - "; passStr += regIndex; passStr += " + "; passStr += regIndexPair; } - } - passStr += " )"; - passStr += sclStr; - passStr += ";"; - } - - - - // Since we write real & imag at once, we break the loop - if(interleaved && (component == SR_COMP_BOTH)) - break; - } - } - } - } - - } - - - void CallButterfly(const std::string &bflyName, size_t regC, size_t numB, std::string &passStr) const - { - std::string regBase; - RegBase(regC, regBase); - - for(size_t i=0; i *np) { nextPass = np; } - void SetGrouping(bool grp) { enableGrouping = grp; } - - void SetPrecallback(bool hasPrecallback, clfftCallbackParam precallbackParam) - { - fft_doPreCallback = hasPrecallback; - fft_preCallback = precallbackParam; - } - - void SetPostcallback(bool hasPostcallback, clfftCallbackParam postcallbackParam) - { - fft_doPostCallback = hasPostcallback; - fft_postCallback = postcallbackParam; - } - - void GeneratePass( bool fwd, std::string &passStr, bool fft_3StepTwiddle, bool twiddleFront, - bool inInterleaved, bool outInterleaved, - bool inReal, bool outReal, - size_t inStride, size_t outStride, double scale, - bool gIn = false, bool gOut = false) const - { - const std::string bufferInRe = (inReal || inInterleaved) ? "bufIn" : "bufInRe"; - const std::string bufferInIm = (inReal || inInterleaved) ? "bufIn" : "bufInIm"; - const std::string bufferOutRe = (outReal || outInterleaved) ? "bufOut" : "bufOutRe"; - const std::string bufferOutIm = (outReal || outInterleaved) ? "bufOut" : "bufOutIm"; - - const std::string bufferInRe2 = (inReal || inInterleaved) ? "bufIn2" : "bufInRe2"; - const std::string bufferInIm2 = (inReal || inInterleaved) ? "bufIn2" : "bufInIm2"; - const std::string bufferOutRe2 = (outReal || outInterleaved) ? "bufOut2" : "bufOutRe2"; - const std::string bufferOutIm2 = (outReal || outInterleaved) ? "bufOut2" : "bufOutIm2"; - - // for real transforms we use only B1 butteflies (regC = 1) - if(r2c || c2r) - { - assert(numB1 == numButterfly); - assert(linearRegs); - } - - // Check if it is single pass transform - bool singlePass = ((position == 0) && (nextPass == NULL)); - if(singlePass) assert(numButterfly == 1); // for single pass transforms, there can be only 1 butterfly per transform - if(singlePass) assert(workGroupSize == 1); - - // Register types - std::string regB1Type = RegBaseType(1); - std::string regB2Type = RegBaseType(2); - std::string regB4Type = RegBaseType(4); - - //Function attribute - passStr += "__attribute__((always_inline)) void\n"; - - //Function name - passStr += PassName(position, fwd); - - // Function arguments - passStr += "("; - passStr += "uint rw, uint b, "; - if(realSpecial) passStr += "uint t, "; - passStr += "uint me, uint inOffset, uint outOffset, "; - - if(r2c || c2r) - { - assert(halfLds); - - if(gIn) - { - if(inInterleaved) - { - passStr += "__global "; passStr += regB2Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - if(!rcSimple) { passStr += "__global "; passStr += regB2Type; passStr += " *"; passStr += bufferInRe2; passStr += ", "; } - } - else if(inReal) - { - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - if(!rcSimple) { passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe2; passStr += ", "; } - } - else - { - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - if(!rcSimple) { passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe2; passStr += ", "; } - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInIm; passStr += ", "; - if(!rcSimple) { passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInIm2; passStr += ", "; } - } - } - else - { - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferInIm; passStr += ", "; - } - - if(gOut) - { - if(outInterleaved) - { - passStr += "__global "; passStr += regB2Type; passStr += " *"; passStr += bufferOutRe; - if(!rcSimple) { passStr += ", "; passStr += "__global "; passStr += regB2Type; passStr += " *"; passStr += bufferOutRe2; } - } - else if(outReal) - { - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe; - if(!rcSimple) { passStr += ", "; passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe2; } - } - else - { - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe; passStr += ", "; - if(!rcSimple) { passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe2; passStr += ", "; } - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutIm; - if(!rcSimple) { passStr += ", "; passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutIm2; } - } - } - else - { - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe; passStr += ", "; - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferOutIm; - } - } - else - { - if(gIn) - { - if(inInterleaved) - { - passStr += "__global "; passStr += regB2Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - } - else - { - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferInIm; passStr += ", "; - } - } - else - { - if(inInterleaved) - { - passStr += "__local "; passStr += regB2Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - } - else - { - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferInRe; passStr += ", "; - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferInIm; passStr += ", "; - } - } - - - if(gOut) - { - if(outInterleaved) - { - passStr += "__global "; passStr += regB2Type; passStr += " *"; passStr += bufferOutRe; - } - else - { - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe; passStr += ", "; - passStr += "__global "; passStr += regB1Type; passStr += " *"; passStr += bufferOutIm; - } - } - else - { - if(outInterleaved) - { - passStr += "__local "; passStr += regB2Type; passStr += " *"; passStr += bufferOutRe; - } - else - { - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferOutRe; passStr += ", "; - passStr += "__local "; passStr += regB1Type; passStr += " *"; passStr += bufferOutIm; - } - } - } - - // Register arguments - if(linearRegs) - { - passStr += ", "; passStr += IterRegArgs(); - } - - if (fft_doPreCallback || fft_doPostCallback) - { - //Include pre-callback parameters if pre-callback is set - if (fft_doPreCallback ) - { - if ((r2c && !rcSimple) || c2r) - { - passStr += ", uint inOffset2"; - } - - passStr += ", __global void* pre_userdata"; - } - - //Include post-callback parameters if post-callback is set - if (fft_doPostCallback ) - { - if (r2c || (c2r && !rcSimple)) - { - passStr += ", uint outOffset2"; - } - passStr += ", __global void* post_userdata"; - } - - if (fft_doPreCallback && fft_preCallback.localMemSize > 0) - { - passStr += ", __local void* localmem"; - } - if (fft_doPostCallback && fft_postCallback.localMemSize > 0) - { - passStr += ", __local void* post_localmem"; - } - } - - passStr += ")\n{\n"; - - // Register Declarations - if(!linearRegs) - { - DeclareRegs(regB1Type, 1, numB1, passStr); - DeclareRegs(regB2Type, 2, numB2, passStr); - DeclareRegs(regB4Type, 4, numB4, passStr); - } - - // odd cnPerWI processing - bool oddp = false; - oddp = ((cnPerWI%2) && (length > 1) && (!singlePass)); - - // additional register for odd - if( !rcSimple && oddp && ((r2c && (nextPass == NULL)) || (c2r && (position == 0))) ) - { - passStr += "\n\t"; - passStr += "uint brv = 0;\n\t"; - passStr += "\n\t"; - passStr += regB2Type; passStr += " R"; passStr += SztToStr(cnPerWI); passStr += "[1];\n\t"; - passStr += "(*R"; passStr += SztToStr(cnPerWI); passStr += ").x = 0; "; - passStr += "(*R"; passStr += SztToStr(cnPerWI); passStr += ").y = 0;\n"; - } - - // Special private memory for c-r 1 pass transforms - if( !rcSimple && (c2r && (position == 0)) && singlePass ) - { - assert(radix == length); - - passStr += "\n\t"; - passStr += regB1Type; - passStr += " mpvt["; passStr += SztToStr(length); passStr += "];\n"; - } - - passStr += "\n"; - - // Read into registers - if(r2c) - { - if(position == 0) - { - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, passStr); - passStr += "\n\t}\n"; - - if(rcSimple) - { - passStr += "\n"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, true, true, false, bufferInRe2, bufferInIm2, "inOffset", passStr); - passStr += "\n"; - } - else - { - passStr += "\n\tif(rw > 1)\n\t{"; - if (fft_doPreCallback) - { - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, bufferInRe2, bufferInIm2, "inOffset2", 1, numB1, 0, passStr); - } - else - { - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, bufferInRe2, bufferInIm2, "inOffset", 1, numB1, 0, passStr); - } - passStr += "\n\t}\n"; - - passStr += "\telse\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, true, true, false, bufferInRe2, bufferInIm2, "inOffset", passStr); - passStr += "\n\t}\n"; - } - } - } - else if(c2r && !rcSimple) - { - if(position == 0) - { - std::string processBufRe = bufferOutRe; - std::string processBufIm = bufferOutIm; - std::string processBufOffset = "outOffset"; - size_t processBufStride = outStride; - - if(singlePass) - { - processBufRe = "mpvt"; - processBufIm = "mpvt"; - processBufOffset = "0"; - processBufStride = 1; - } - - passStr += "\n\tif(rw && !me)\n\t{\n\t"; - passStr += processBufRe; passStr += "["; passStr += processBufOffset; passStr += "] = "; - - if (fft_doPreCallback) - { - passStr += fft_preCallback.funcname; passStr += "("; passStr += bufferInRe; - if (!inInterleaved) { passStr += ", "; passStr += bufferInIm; } - passStr += ", inOffset, pre_userdata"; - passStr += fft_preCallback.localMemSize > 0 ? ", localmem)" : ")"; - } - else - { - passStr += bufferInRe; passStr+= "[inOffset]"; - } - - if(inInterleaved || fft_doPreCallback) passStr += ".x;\n\t}"; else passStr += ";\n\t}"; - - if(length > 1) - { - passStr += "\n\n\tif(rw)\n\t{"; - if (fft_doPreCallback && !inInterleaved) - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, false, false, bufferInRe, bufferInIm, "inOffset", passStr); - } - else - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, false, false, bufferInRe, bufferInRe, "inOffset", passStr); - } - passStr += "\n\t}\n"; - - passStr += "\n\tif(rw > 1)\n\t{"; - if (fft_doPreCallback) - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, true, false, bufferInRe2, bufferInIm2, "inOffset2", passStr); - } - else - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, true, false, bufferInIm2, bufferInIm2, "inOffset", passStr); - } - - passStr += "\n\t}\n\telse\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, true, true, false, bufferInIm2, bufferInIm2, "inOffset", passStr); - passStr += "\n\t}\n"; - - if(oddp) - { - passStr += "\n\tif(rw && (me%2))\n\t{"; - if (fft_doPreCallback) - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, false, true, bufferInRe, bufferInIm, "inOffset", passStr); - } - else - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, false, true, bufferInRe, bufferInRe, "inOffset", passStr); - } - passStr += "\n\t}"; - passStr += "\n\tif((rw > 1) && (me%2))\n\t{"; - if (fft_doPreCallback) - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, true, true, bufferInRe2, bufferInIm2, "inOffset2", passStr); - } - else - { - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, true, true, bufferInIm2, bufferInIm2, "inOffset", passStr); - } - passStr += "\n\t}\n"; - } - - - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_REAL, 1.0f, false, true, false, processBufRe, processBufIm, processBufOffset, passStr); - if(oddp) - { - passStr += "\n\tif(me%2)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_REAL, 1.0f, false, true, true, processBufRe, processBufIm, processBufOffset, passStr); - passStr += "\n\t}\n"; - } - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_REAL, 1.0f, false, false, false, processBufRe, processBufIm, processBufOffset, passStr); - if(oddp) - { - passStr += "\n\tif(me%2)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_REAL, 1.0f, false, false, true, processBufRe, processBufIm, processBufOffset, passStr); - passStr += "\n\t}\n"; - } - } - - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - SweepRegs(SR_READ, fwd, outInterleaved, processBufStride, SR_COMP_REAL, 1.0f, false, processBufRe, processBufIm, processBufOffset, 1, numB1, 0, passStr, false, false, oddp); - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - - - passStr += "\n\tif((rw > 1) && !me)\n\t{\n\t"; - passStr += processBufIm; passStr += "["; passStr += processBufOffset; passStr += "] = "; - - if (fft_doPreCallback) - { - passStr += fft_preCallback.funcname; passStr += "("; passStr += bufferInRe2; - if (!inInterleaved) { passStr += ", "; passStr += bufferInIm2; } - passStr += ", inOffset2, pre_userdata"; - passStr += fft_preCallback.localMemSize > 0 ? ", localmem)" : ")"; - } - else - { - passStr += bufferInRe2; passStr+= "[inOffset]"; - } - if(inInterleaved || fft_doPreCallback) passStr += ".x;\n\t}"; else passStr += ";\n\t}"; - passStr += "\n\tif((rw == 1) && !me)\n\t{\n\t"; passStr += processBufIm; passStr += "["; passStr += processBufOffset; passStr += "] = 0;\n\t}"; - - - if(length > 1) - { - if (!fft_doPreCallback) - { - passStr += "\n\n\tif(rw)\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, false, false, bufferInIm, bufferInIm, "inOffset", passStr); - passStr += "\n\t}\n"; - - passStr += "\n\tif(rw > 1)\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, true, false, bufferInRe2, bufferInRe2, "inOffset", passStr); - passStr += "\n\t}\n\telse\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, true, true, false, bufferInRe2, bufferInRe2, "inOffset", passStr); - passStr += "\n\t}"; - - - if(oddp) - { - passStr += "\n\tif(rw && (me%2))\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, false, true, bufferInIm, bufferInIm, "inOffset", passStr); - passStr += "\n\t}"; - passStr += "\n\tif((rw > 1) && (me%2))\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, true, true, bufferInRe2, bufferInRe2, "inOffset", passStr); - passStr += "\n\t}"; - } - } - passStr += "\n"; - - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_IMAG, 1.0f, false, true, false, processBufRe, processBufIm, processBufOffset, passStr); - if(oddp) - { - passStr += "\n\tif(me%2)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_IMAG, 1.0f, false, true, true, processBufRe, processBufIm, processBufOffset, passStr); - passStr += "\n\t}\n"; - } - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_IMAG, 1.0f, false, false, false, processBufRe, processBufIm, processBufOffset, passStr); - if(oddp) - { - passStr += "\n\tif(me%2)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, SR_COMP_IMAG, 1.0f, false, false, true, processBufRe, processBufIm, processBufOffset, passStr); - passStr += "\n\t}\n"; - } - } - - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - SweepRegs(SR_READ, fwd, outInterleaved, processBufStride, SR_COMP_IMAG, 1.0f, false, processBufRe, processBufIm, processBufOffset, 1, numB1, 0, passStr); - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - } - } - else - { - if( (!halfLds) || (halfLds && (position == 0)) ) - { - bool isPrecallVector = false; - //If precallback is set - if (fft_doPreCallback) - { - passStr += "\n\t"; passStr += regB2Type; passStr += " retPrecallback"; - - if (numB4 > 0 || numB2 > 0) - { - passStr += "["; - passStr += (numB4 > 0) ? "4" : (numB2 > 0) ? "2" : "1"; - passStr += "]"; - - isPrecallVector = true; - } - passStr += ";"; - } - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, passStr, false, isPrecallVector); - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 2, numB2, numB1, passStr, false, isPrecallVector); - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 4, numB4, 2*numB2 + numB1, passStr, false, isPrecallVector); - passStr += "\n\t}\n"; - passStr += "\n\telse\n\t{"; - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, passStr, true, isPrecallVector); - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 2, numB2, numB1, passStr, true, isPrecallVector); - SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 4, numB4, 2 * numB2 + numB1, passStr, true, isPrecallVector); - passStr += "\n\t}\n"; - } - } - - passStr += "\n"; - - // 3-step twiddle multiplies done in the front - bool tw3Done = false; - if(fft_3StepTwiddle && twiddleFront) - { - tw3Done = true; - if(linearRegs) - { - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); - } - else - { - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, bufferInRe, bufferInIm, "", 2, numB2, numB1, passStr); - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, bufferInRe, bufferInIm, "", 4, numB4, 2*numB2 + numB1, passStr); - } - } - - passStr += "\n"; - - // Twiddle multiply - if( (position > 0) && (radix > 1) ) - { - SweepRegs(SR_TWMUL, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); - SweepRegs(SR_TWMUL, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 2, numB2, numB1, passStr); - SweepRegs(SR_TWMUL, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 4, numB4, 2*numB2 + numB1, passStr); - } - - // Butterfly calls - if(radix > 1) - { - if(numB1) CallButterfly(ButterflyName(radix, 1, fwd), 1, numB1, passStr); - if(numB2) CallButterfly(ButterflyName(radix, 2, fwd), 2, numB2, passStr); - if(numB4) CallButterfly(ButterflyName(radix, 4, fwd), 4, numB4, passStr); - } - - - if(!halfLds) passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - passStr += "\n\n"; - - // 3-step twiddle multiplies - if(fft_3StepTwiddle && !tw3Done) - { - assert(nextPass == NULL); - if(linearRegs) - { - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); - } - else - { - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 2, numB2, numB1, passStr); - SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, bufferInIm, "", 4, numB4, 2*numB2 + numB1, passStr); - } - } - - // Write back from registers - if(halfLds) - { - // In this case, we have to write & again read back for the next pass since we are - // using only half the lds. Number of barriers will increase at the cost of halving the lds. - - if(nextPass == NULL) // last pass - { - if(r2c && !rcSimple) - { - if(!singlePass) - { - SweepRegs(SR_WRITE, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, passStr); - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, false, false, bufferInRe, bufferInIm, "inOffset", passStr); - if(oddp) - { - passStr += "\n\tif(me%2)\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, false, false, true, bufferInRe, bufferInIm, "inOffset", passStr); - passStr += "\n\t}\n"; - } - - passStr += "\n\tif(rw && !me)\n\t{\n\t"; - if(outInterleaved) - { - if (fft_doPostCallback) - { - passStr += fft_postCallback.funcname; passStr += "(bufOut, outOffset, post_userdata, "; - passStr += "("; passStr += RegBaseType(2); passStr += ") ( ("; passStr += bufferInRe; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ") , 0 )"; - if (fft_postCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");\n\t}"; - } - else - { - passStr += bufferOutRe; passStr+= "[outOffset].x = "; passStr += bufferInRe; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ";\n\t"; - passStr += bufferOutIm; passStr+= "[outOffset].y = "; passStr += "0;\n\t}"; - } - } - else - { - if (fft_doPostCallback) - { - passStr += fft_postCallback.funcname; passStr += "("; passStr += bufferOutRe; passStr += ", "; passStr += bufferOutIm; - passStr += ", outOffset, post_userdata, "; passStr += bufferInRe; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ", 0"; - if (fft_postCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");\n\t}"; - } - else - { - passStr += bufferOutRe; passStr+= "[outOffset] = "; passStr += bufferInRe; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ";\n\t"; - passStr += bufferOutIm; passStr+= "[outOffset] = "; passStr += "0;\n\t}"; - } - } - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - - - SweepRegs(SR_WRITE, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, passStr); - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, false, false, bufferInRe, bufferInIm, "inOffset", passStr); - if(oddp) - { - passStr += "\n\tif(me%2)\n\t{"; - SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, false, false, true, bufferInRe, bufferInIm, "inOffset", passStr); - passStr += "\n\t}\n"; - } - - passStr += "\n\tif((rw > 1) && !me)\n\t{\n\t"; - if(outInterleaved) - { - if (fft_doPostCallback) - { - passStr += fft_postCallback.funcname; passStr += "(bufOut2, outOffset2, post_userdata, "; - passStr += "("; passStr += RegBaseType(2); passStr += ") ( ("; passStr += bufferInIm; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ") , 0 )"; - if (fft_postCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");\n\t}"; - } - else - { - passStr += bufferOutRe2; passStr+= "[outOffset].x = "; passStr += bufferInIm; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ";\n\t"; - passStr += bufferOutIm2; passStr+= "[outOffset].y = "; passStr += "0;\n\t}"; - } - } - else - { - if (fft_doPostCallback) - { - passStr += fft_postCallback.funcname; passStr += "("; passStr += bufferOutRe2; passStr += ", "; passStr += bufferOutIm2; - passStr+= ", outOffset2, post_userdata, "; passStr += bufferInIm; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ", 0"; - if (fft_postCallback.localMemSize > 0) - { - passStr += ", localmem"; - } - passStr += ");\n\t}"; - } - else - { - passStr += bufferOutRe2; passStr+= "[outOffset] = "; passStr += bufferInIm; passStr += "[inOffset]"; - if(scale != 1.0) { passStr += " * "; passStr += FloatToStr(scale); passStr += FloatSuffix(); } passStr += ";\n\t"; - passStr += bufferOutIm2; passStr+= "[outOffset] = "; passStr += "0;\n\t}"; - } - } - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - } - - - passStr += "\n\n\tif(rw)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, false, false, bufferOutRe, bufferOutIm, "outOffset", passStr); - passStr += "\n\t}\n"; - if(oddp) - { - passStr += "\n\n\tbrv = ((rw != 0) & (me%2 == 1));\n\t"; - passStr += "if(brv)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, false, true, bufferOutRe, bufferOutIm, "outOffset", passStr); - passStr += "\n\t}\n"; - } - - passStr += "\n\n\tif(rw > 1)\n\t{"; - - std::string outOffset; - outOffset += "outOffset"; - if (fft_doPostCallback) outOffset += "2"; - - SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, true, false, bufferOutRe2, bufferOutIm2, outOffset, passStr); - passStr += "\n\t}\n"; - if(oddp) - { - passStr += "\n\n\tbrv = ((rw > 1) & (me%2 == 1));\n\t"; - passStr += "if(brv)\n\t{"; - SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, true, true, bufferOutRe2, bufferOutIm2, outOffset, passStr); - passStr += "\n\t}\n"; - } - - } - else if(c2r) - { - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_REAL, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, passStr); - passStr += "\n\t}\n"; - - if(!rcSimple) - { - std::string outOffset; - outOffset += "outOffset"; - if (fft_doPostCallback) outOffset += "2"; - - passStr += "\n\tif(rw > 1)\n\t{"; - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_IMAG, scale, false, bufferOutRe2, bufferOutIm2, outOffset, 1, numB1, 0, passStr); - passStr += "\n\t}\n"; - } - } - else - { - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, passStr); - passStr += "\n\t}\n"; - } - } - else - { - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_REAL, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, passStr); - passStr += "\n\t}\n"; - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - passStr += "\n\tif(rw)\n\t{"; - nextPass->SweepRegs(SR_READ, fwd, outInterleaved, outStride, SR_COMP_REAL, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, nextPass->GetNumB1(), 0, passStr); - passStr += "\n\t}\n"; - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_IMAG, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, passStr); - passStr += "\n\t}\n"; - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - passStr += "\n\tif(rw)\n\t{"; - nextPass->SweepRegs(SR_READ, fwd, outInterleaved, outStride, SR_COMP_IMAG, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, nextPass->GetNumB1(), 0, passStr); - passStr += "\n\t}\n"; - passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; - } - } - else - { - if (fft_doPostCallback && outInterleaved) - { - passStr += "\n\t"; passStr += regB2Type; passStr += " tempC;"; - } - passStr += "\n\tif(rw)\n\t{"; - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, passStr); - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, bufferOutRe, bufferOutIm, "outOffset", 2, numB2, numB1, passStr); - SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, false, bufferOutRe, bufferOutIm, "outOffset", 4, numB4, 2*numB2 + numB1, passStr); - passStr += "\n\t}\n"; - } - - - passStr += "\n}\n\n"; - } - }; + // SweepRegs is to iterate through the registers to do the three basic + // operations: reading, twiddle multiplication, writing + void SweepRegs(size_t flag, bool fwd, bool interleaved, size_t stride, + size_t component, double scale, bool frontTwiddle, + const std::string &bufferRe, const std::string &bufferIm, + const std::string &offset, size_t regC, size_t numB, + size_t numPrev, std::string &passStr, bool initZero = false, + bool isPrecallVector = false, bool oddt = false) const { + assert((flag == SR_READ) || (flag == SR_TWMUL) || + (flag == SR_TWMUL_3STEP) || (flag == SR_WRITE)); + + const std::string twTable = TwTableName(); + const std::string tw3StepFunc = TwTableLargeFunc(); + + // component: 0 - real, 1 - imaginary, 2 - both + size_t cStart, cEnd; + switch (component) { + case SR_COMP_REAL: + cStart = 0; + cEnd = 1; + break; + case SR_COMP_IMAG: + cStart = 1; + cEnd = 2; + break; + case SR_COMP_BOTH: + cStart = 0; + cEnd = 2; + break; + default: + assert(false); + } + + // Read/Write logic: + // The double loop inside pass loop of FFT algorithm is mapped into the + // workGroupSize work items with each work item handling cnPerWI numbers + + // Read logic: + // Reads for any pass appear the same with the stockham algorithm when + // mapped to the work items. The buffer is divided into (L/radix) sized + // blocks and the values are read in linear order inside each block. + + // Vector reads are possible if we have unit strides + // since read pattern remains the same for all passes and they are + // contiguous Writes are not contiguous + + // TODO : twiddle multiplies can be combined with read + // TODO : twiddle factors can be reordered in the table to do vector reads + // of them + + // Write logic: + // outer loop index k and the inner loop index j map to 'me' as follows: + // In one work-item (1 'me'), there are 'numButterfly' fft butterflies. They + // are indexed as numButterfly*me + butterflyIndex, where butterflyIndex's + // range is 0 ... numButterfly-1. The total number of butterflies needed is + // covered over all the work-items. So essentially the double loop k,j is + // flattened to fit this linearly increasing 'me'. j = (numButterfly*me + + // butterflyIndex)%LS k = (numButterfly*me + butterflyIndex)/LS + + std::string twType = RegBaseType(2); + std::string rType = RegBaseType(1); + + size_t butterflyIndex = numPrev; + std::string bufOffset; + + std::string regBase; + RegBase(regC, regBase); + + // special write back to global memory with float4 grouping, writing 2 + // complex numbers at once + if (numB && (numB % 2 == 0) && (regC == 1) && (stride == 1) && + (numButterfly % 2 == 0) && (algLS % 2 == 0) && (flag == SR_WRITE) && + (nextPass == nullptr) && interleaved && (component == SR_COMP_BOTH) && + linearRegs && enableGrouping && !fft_doPostCallback) { + assert((numButterfly * workGroupSize) == algLS); + assert(bufferRe.compare(bufferIm) == + 0); // Make sure Real & Imag buffer strings are same for + // interleaved data + + passStr += "\n\t"; + passStr += "__global "; + passStr += RegBaseType(4); + passStr += " *buff4g = (__global "; + passStr += RegBaseType(4); + passStr += " *)"; + passStr += bufferRe; + passStr += ";\n\t"; // Assuming 'outOffset' is 0, so not adding it here + + for (size_t r = 0; r < radix; + r++) // setting the radix loop outside to facilitate grouped writing + { + butterflyIndex = numPrev; + + for (size_t i = 0; i < (numB / 2); i++) { + std::string regIndexA = "(*R"; + std::string regIndexB = "(*R"; + + RegBaseAndCountAndPos("", (2 * i + 0) * radix + r, regIndexA); + regIndexA += ")"; + RegBaseAndCountAndPos("", (2 * i + 1) * radix + r, regIndexB); + regIndexB += ")"; + + passStr += "\n\t"; + passStr += "buff4g"; + passStr += "[ "; + passStr += SztToStr(numButterfly / 2); + passStr += "*me + "; + passStr += SztToStr(butterflyIndex); + passStr += " + "; + passStr += SztToStr(r * (algLS / 2)); + passStr += " ]"; + passStr += " = "; + passStr += "("; + passStr += RegBaseType(4); + passStr += ")("; + passStr += regIndexA; + passStr += ".x, "; + passStr += regIndexA; + passStr += ".y, "; + passStr += regIndexB; + passStr += ".x, "; + passStr += regIndexB; + passStr += ".y) "; + if (scale != 1.0f) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ";"; + + butterflyIndex++; + } + } + + return; + } + + size_t hid = 0; + bool swapElement = false; + size_t tIter = numB * radix; + + // block to rearrange reads of adjacent memory locations together + if (linearRegs && (flag == SR_READ)) { + for (size_t r = 0; r < radix; r++) { + for (size_t i = 0; i < numB; i++) { + for (size_t c = cStart; c < cEnd; + c++) // component loop: 0 - real, 1 - imaginary + { + swapElement = (fft_doPreCallback && c2r && + component == SR_COMP_REAL); // reset at start of loop + + std::string tail; + std::string regIndex; + std::string regIndexC; + regIndex = "(*R"; + std::string buffer; + + // Read real & imag at once + if (interleaved && (component == SR_COMP_BOTH)) { + assert(bufferRe.compare(bufferIm) == + 0); // Make sure Real & Imag buffer strings are same for + // interleaved data + buffer = bufferRe; + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ")"; + tail = ";"; + } else { + if (c == 0) { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + + hid = (i * radix + r) / (tIter > 1 ? (tIter / 2) : 1); + swapElement = swapElement && hid != 0; + swapElement = (oddt && ((i * radix + r) >= (tIter - 1))) + ? false + : swapElement; // for c2r odd size don't swap + // for last register + if (swapElement) { + regIndexC = regIndex; + regIndexC += ").y"; + } + + regIndex += ").x"; + buffer = bufferRe; + tail = interleaved ? ".x;" : ";"; + } else { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ").y"; + buffer = bufferIm; + tail = interleaved ? ".y;" : ";"; + } + } + + // get offset + bufOffset.clear(); + bufOffset += offset; + bufOffset += " + ( "; + bufOffset += SztToStr(numPrev); + bufOffset += " + "; + bufOffset += "me*"; + bufOffset += SztToStr(numButterfly); + bufOffset += " + "; + bufOffset += SztToStr(i); + bufOffset += " + "; + bufOffset += SztToStr(r * length / radix); + bufOffset += " )*"; + bufOffset += SztToStr(stride); + + // If precallback is set invoke callback function + // Invoke callback only once in Planar data layout (i.e.c==0) + if (fft_doPreCallback && c == 0 && component == SR_COMP_BOTH) { + passStr += "\n\t"; + passStr += "retPrecallback = "; + passStr += fft_preCallback.funcname; + passStr += "("; + if (interleaved) { + passStr += buffer; + passStr += ", "; + } else { + passStr += bufferRe; + passStr += ", "; + passStr += bufferIm; + passStr += ", "; + } + passStr += bufOffset; + passStr += ", pre_userdata"; + if (fft_preCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");"; + } + + if (swapElement) { + passStr += "\n\t"; + passStr += regIndexC; + passStr += " = "; + passStr += regIndex; + passStr += ";"; + } + + passStr += "\n\t"; + passStr += regIndex; + passStr += " = "; + + if (initZero) { + if (interleaved && (component == SR_COMP_BOTH)) + passStr += "(fvect2)(0, 0);"; + else + passStr += "0;"; + } else { + // Use the return value from precallback if set + if (fft_doPreCallback && (component == SR_COMP_BOTH || r2c)) { + if (component == SR_COMP_BOTH) { + passStr += "retPrecallback"; + passStr += interleaved ? tail : (c == 0) ? ".x;" : ".y;"; + } else if (r2c) { + passStr += fft_preCallback.funcname; + passStr += "("; + passStr += buffer; + passStr += ", "; + passStr += bufOffset; + passStr += ", pre_userdata"; + + if (fft_preCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");"; + } + } else { + passStr += buffer; + passStr += "["; + passStr += bufOffset; + passStr += "]"; + passStr += tail; + } + } + + // Since we read real & imag at once, we break the loop + if (interleaved && (component == SR_COMP_BOTH)) + break; + } + } + } + return; + } - // FFT kernel - template - class Kernel - { - size_t length; // Length of FFT - size_t workGroupSize; // Work group size - size_t cnPerWI; // complex numbers per work-item - - size_t offsetIn; - size_t offsetOut; - - size_t numTrans; // Number of transforms per work-group - size_t workGroupSizePerTrans; // Work group subdivision per transform - size_t numPasses; // Number of FFT passes - std::vector radices; // Base radix at each pass - std::vector > passes; // Array of pass objects - - bool halfLds; // LDS used to store one component (either real or imaginary) at a time - // for passing intermediate data between the passes, if this is set - // then each pass-function should accept same set of registers - - bool linearRegs; // scalar registers - - // Future optimization ideas - // bool limitRegs; // TODO: Incrementally write to LDS, thereby using same set of registers for more than 1 butterflies - // bool combineReadTwMul; // TODO: Combine reading into registers and Twiddle multiply - - bool r2c2r; // real to complex or complex to real transform - bool r2c, c2r; - bool rcFull; - bool rcSimple; - - bool blockCompute; // When we have to compute FFT in blocks (either read or write is along columns) - BlockComputeType blockComputeType; - size_t blockWidth, blockWGS, blockLDS; - - bool realSpecial; - - const FFTKernelGenKeyParams params; // key params - - - inline std::string IterRegs(const std::string &pfx, bool initComma = true) - { - std::string str = ""; - - if(linearRegs) - { - if(initComma) str += ", "; - - for(size_t i=0; i2; i--) - { - size_t currentLength = 1; - for(int j=2; j1; i--) - { - size_t currentLength = 1; - for(int j=1; j (radix / 2))) + break; + + if (realSpecial && (nextPass == nullptr) && (r == radix / 2) && (i != 0)) + break; + + if (realSpecial && (nextPass == nullptr) && (r == radix / 2) && (i == 0)) + passStr += "\n\t}\n\tif( rw && !me)\n\t{"; + + std::string regIndexC0; + for (size_t c = cStart; c < cEnd; + c++) // component loop: 0 - real, 1 - imaginary + { + std::string tail; + std::string regIndex; + regIndex = "(*R"; + std::string buffer; + + // Write real & imag at once + if (interleaved && (component == SR_COMP_BOTH)) { + assert(bufferRe.compare(bufferIm) == + 0); // Make sure Real & Imag buffer strings are same for + // interleaved data + buffer = bufferRe; + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ")"; + tail = ""; + } else { + if (c == 0) { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ").x"; + buffer = bufferRe; + tail = interleaved ? ".x" : ""; + } else { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ").y"; + buffer = bufferIm; + tail = interleaved ? ".y" : ""; + } + } + + bufOffset.clear(); + bufOffset += offset; + bufOffset += " + ( "; + if ((numButterfly * workGroupSize) > algLS) { + bufOffset += "(("; + bufOffset += SztToStr(numButterfly); + bufOffset += "*me + "; + bufOffset += SztToStr(butterflyIndex); + bufOffset += ")/"; + bufOffset += SztToStr(algLS); + bufOffset += ")*"; + bufOffset += SztToStr(algL); + bufOffset += " + ("; + bufOffset += SztToStr(numButterfly); + bufOffset += "*me + "; + bufOffset += SztToStr(butterflyIndex); + bufOffset += ")%"; + bufOffset += SztToStr(algLS); + bufOffset += " + "; + } else { + bufOffset += SztToStr(numButterfly); + bufOffset += "*me + "; + bufOffset += SztToStr(butterflyIndex); + bufOffset += " + "; + } + bufOffset += SztToStr(r * algLS); + bufOffset += " )*"; + bufOffset += SztToStr(stride); + + if (scale != 1.0f) { + regIndex += " * "; + regIndex += FloatToStr(scale); + regIndex += FloatSuffix(); + } + if (c == cStart) + regIndexC0 = regIndex; + + if (fft_doPostCallback && !r2c) { + if (interleaved || c == (cEnd - 1)) { + passStr += "\n\t"; + passStr += fft_postCallback.funcname; + passStr += "("; + + if (interleaved || (c2r && bufferRe.compare(bufferIm) == 0)) { + passStr += buffer; + } else { + passStr += bufferRe; + passStr += ", "; + passStr += bufferIm; + } + passStr += ", "; + passStr += bufOffset; + passStr += ", post_userdata, ("; + passStr += regIndexC0; + passStr += ")"; + if (!(interleaved || + (c2r && bufferRe.compare(bufferIm) == 0))) { + passStr += ", ("; + passStr += regIndex; + passStr += ")"; + } + + if (fft_postCallback.localMemSize > 0) { + passStr += ", post_localmem"; + } + passStr += ");"; + } + } else { + passStr += "\n\t"; + passStr += buffer; + passStr += "["; + passStr += bufOffset; + passStr += "]"; + passStr += tail; + passStr += " = "; + passStr += regIndex; + passStr += ";"; + } + + // Since we write real & imag at once, we break the loop + if (interleaved && (component == SR_COMP_BOTH)) + break; + } + + if (realSpecial && (nextPass == nullptr) && (r == radix / 2) && (i == 0)) + passStr += "\n\t}\n\tif(rw)\n\t{"; + + butterflyIndex++; + } + } + return; + } + + for (size_t i = 0; i < numB; i++) { + std::string regBaseCount = regBase; + RegBaseAndCount(i, regBaseCount); + + if (flag == SR_READ) // read operation + { + // the 'r' (radix index) loop is placed outer to the + // 'v' (vector index) loop to make possible vectorized reads + + for (size_t r = 0; r < radix; r++) { + for (size_t c = cStart; c < cEnd; + c++) // component loop: 0 - real, 1 - imaginary + { + std::string tail; + std::string regIndex; + std::string regIndexC; + regIndex = linearRegs ? "(*R" : regBaseCount; + std::string buffer; + + // Read real & imag at once + if (interleaved && (component == SR_COMP_BOTH) && linearRegs) { + assert(bufferRe.compare(bufferIm) == + 0); // Make sure Real & Imag buffer strings are same for + // interleaved data + buffer = bufferRe; + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ")"; + tail = ";"; + } else { + if (c == 0) { + if (linearRegs) { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + + hid = (i * radix + r) / (numB * radix / 2); + if (fft_doPreCallback && c2r && component == SR_COMP_REAL && + hid != 0) { + regIndexC = regIndex; + regIndexC += ").y"; + } + regIndex += ").x"; + } else { + RegBaseAndCountAndPos("R", r, regIndex); + } + buffer = bufferRe; + tail = interleaved ? ".x;" : ";"; + } else { + if (linearRegs) { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ").y"; + } else { + RegBaseAndCountAndPos("I", r, regIndex); + } + buffer = bufferIm; + tail = interleaved ? ".y;" : ";"; + } + } + + for (size_t v = 0; v < regC; + v++) // TODO: vectorize the reads; instead of reading + // individually for consecutive reads of vector elements + { + std::string regIndexSub(regIndex); + if (regC != 1) { + regIndexSub += ".s"; + regIndexSub += SztToStr(v); + } + + // get offset + bufOffset.clear(); + bufOffset += offset; + bufOffset += " + ( "; + bufOffset += SztToStr(numPrev); + bufOffset += " + "; + bufOffset += "me*"; + bufOffset += SztToStr(numButterfly); + bufOffset += " + "; + bufOffset += SztToStr(i * regC + v); + bufOffset += " + "; + bufOffset += SztToStr(r * length / radix); + bufOffset += " )*"; + bufOffset += SztToStr(stride); + + // If precallback is set invoke callback function + // Invoke callback only once in Planar data layout (i.e.c==0) + if (fft_doPreCallback && c == 0 && component == SR_COMP_BOTH) { + passStr += "\n\t"; + passStr += "retPrecallback"; + + if (isPrecallVector) { + passStr += "["; + passStr += SztToStr(v); + passStr += "]"; + } + + passStr += " = "; + passStr += fft_preCallback.funcname; + passStr += "("; + if (interleaved) { + passStr += buffer; + passStr += ", "; + } else { + passStr += bufferRe; + passStr += ", "; + passStr += bufferIm; + passStr += ", "; + } + passStr += bufOffset; + passStr += ", pre_userdata"; + if (fft_preCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");"; + } + + if (fft_doPreCallback && c2r && component == SR_COMP_REAL && + hid != 0) { + passStr += "\n\t"; + passStr += regIndexC; + passStr += " = "; + passStr += regIndexSub; + passStr += ";"; + } + + passStr += "\n\t"; + passStr += regIndexSub; + passStr += " = "; + + // Use the return value from precallback if set + if (fft_doPreCallback && (component == SR_COMP_BOTH || r2c)) { + if (component == SR_COMP_BOTH) { + passStr += "retPrecallback"; + + if (isPrecallVector) { + passStr += "["; + passStr += SztToStr(v); + passStr += "]"; + } + passStr += interleaved ? tail : (c == 0) ? ".x;" : ".y;"; + } else if (r2c) { + passStr += fft_preCallback.funcname; + passStr += "("; + passStr += buffer; + passStr += ", "; + passStr += bufOffset; + passStr += ", pre_userdata"; + + if (fft_preCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");"; + } + } else { + passStr += buffer; + passStr += "["; + passStr += bufOffset; + passStr += "]"; + passStr += tail; + } + } + + // Since we read real & imag at once, we break the loop + if (interleaved && (component == SR_COMP_BOTH) && linearRegs) + break; + } + } + } else if ((flag == SR_TWMUL) || + (flag == SR_TWMUL_3STEP)) // twiddle multiplies and writes + // require that 'r' loop be innermost + { + for (size_t v = 0; v < regC; v++) { + for (size_t r = 0; r < radix; r++) { + + std::string regRealIndex, regImagIndex; + regRealIndex = linearRegs ? "(*R" : regBaseCount; + regImagIndex = linearRegs ? "(*R" : regBaseCount; + + if (linearRegs) { + RegBaseAndCountAndPos("", i * radix + r, regRealIndex); + regRealIndex += ").x"; + RegBaseAndCountAndPos("", i * radix + r, regImagIndex); + regImagIndex += ").y"; + } else { + RegBaseAndCountAndPos("R", r, regRealIndex); + RegBaseAndCountAndPos("I", r, regImagIndex); + } + + if (regC != 1) { + regRealIndex += ".s"; + regRealIndex += SztToStr(v); + regImagIndex += ".s"; + regImagIndex += SztToStr(v); + } + + if (flag == SR_TWMUL) // twiddle multiply operation + { + if (r == 0) // no twiddle muls needed + continue; + + passStr += "\n\t{\n\t\t"; + passStr += twType; + passStr += " W = "; + passStr += twTable; + passStr += "["; + passStr += SztToStr(algLS - 1); + passStr += " + "; + passStr += SztToStr(radix - 1); + passStr += "*(("; + passStr += SztToStr(numButterfly); + passStr += "*me + "; + passStr += SztToStr(butterflyIndex); + passStr += ")%"; + passStr += SztToStr(algLS); + passStr += ") + "; + passStr += SztToStr(r - 1); + passStr += "];\n\t\t"; + } else // 3-step twiddle + { + passStr += "\n\t{\n\t\t"; + passStr += twType; + passStr += " W = "; + passStr += tw3StepFunc; + passStr += "( "; + + if (frontTwiddle) { + assert(linearRegs); + passStr += "("; + passStr += "me*"; + passStr += SztToStr(numButterfly); + passStr += " + "; + passStr += SztToStr(i); + passStr += " + "; + passStr += SztToStr(r * length / radix); + passStr += ") * b"; + } else { + passStr += "(("; + passStr += SztToStr(numButterfly); + passStr += "*me + "; + passStr += SztToStr(butterflyIndex); + passStr += ")%"; + passStr += SztToStr(algLS); + passStr += " + "; + passStr += SztToStr(r * algLS); + passStr += ") * b"; + } + + passStr += " );\n\t\t"; + } + + passStr += rType; + passStr += " TR, TI;\n\t\t"; + + if (realSpecial && (flag == SR_TWMUL_3STEP)) { + if (fwd) { + passStr += "if(t==0)\n\t\t{\n\t\t"; + + passStr += "TR = (W.x * "; + passStr += regRealIndex; + passStr += ") - (W.y * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + passStr += "TI = (W.y * "; + passStr += regRealIndex; + passStr += ") + (W.x * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + + passStr += "}\n\t\telse\n\t\t{\n\t\t"; + + passStr += "TR = (W.x * "; + passStr += regRealIndex; + passStr += ") + (W.y * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + passStr += "TI = (W.y * "; + passStr += regRealIndex; + passStr += ") - (W.x * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + + passStr += "}\n\t\t"; + } else { + passStr += "if(t==0)\n\t\t{\n\t\t"; + + passStr += "TR = (W.x * "; + passStr += regRealIndex; + passStr += ") + (W.y * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + passStr += "TI = (W.y * "; + passStr += regRealIndex; + passStr += ") - (W.x * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + + passStr += "}\n\t\telse\n\t\t{\n\t\t"; + + passStr += "TR = (W.x * "; + passStr += regRealIndex; + passStr += ") - (W.y * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + passStr += "TI = (W.y * "; + passStr += regRealIndex; + passStr += ") + (W.x * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + + passStr += "}\n\t\t"; + } + } else { + if (fwd) { + passStr += "TR = (W.x * "; + passStr += regRealIndex; + passStr += ") - (W.y * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + passStr += "TI = (W.y * "; + passStr += regRealIndex; + passStr += ") + (W.x * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + } else { + passStr += "TR = (W.x * "; + passStr += regRealIndex; + passStr += ") + (W.y * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + passStr += "TI = -(W.y * "; + passStr += regRealIndex; + passStr += ") + (W.x * "; + passStr += regImagIndex; + passStr += ");\n\t\t"; + } + } + + passStr += regRealIndex; + passStr += " = TR;\n\t\t"; + passStr += regImagIndex; + passStr += " = TI;\n\t}\n"; + } + + butterflyIndex++; + } + } else // write operation + { + for (size_t v = 0; v < regC; v++) { + for (size_t r = 0; r < radix; r++) { + if (realSpecial && (nextPass == nullptr) && (r > (radix / 2))) + break; + + if (realSpecial && (nextPass == nullptr) && (r == radix / 2) && + (i != 0)) + break; + + if (realSpecial && (nextPass == nullptr) && (r == radix / 2) && + (i == 0)) + passStr += "\n\t}\n\tif( rw && !me)\n\t{"; + + std::string regIndexC0; + + for (size_t c = cStart; c < cEnd; + c++) // component loop: 0 - real, 1 - imaginary + { + std::string tail; + std::string regIndex; + regIndex = linearRegs ? "(*R" : regBaseCount; + std::string buffer; + + // Write real & imag at once + if (interleaved && (component == SR_COMP_BOTH) && linearRegs) { + assert(bufferRe.compare(bufferIm) == + 0); // Make sure Real & Imag buffer strings are same for + // interleaved data + buffer = bufferRe; + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ")"; + tail = ""; + } else { + if (c == 0) { + if (linearRegs) { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ").x"; + } else { + RegBaseAndCountAndPos("R", r, regIndex); + } + buffer = bufferRe; + tail = interleaved ? ".x" : ""; + } else { + if (linearRegs) { + RegBaseAndCountAndPos("", i * radix + r, regIndex); + regIndex += ").y"; + } else { + RegBaseAndCountAndPos("I", r, regIndex); + } + buffer = bufferIm; + tail = interleaved ? ".y" : ""; + } + } + + if (regC != 1) { + regIndex += ".s"; + regIndex += SztToStr(v); + } + + passStr += "\n\t"; + + if (scale != 1.0f) { + regIndex += " * "; + regIndex += FloatToStr(scale); + regIndex += FloatSuffix(); + } + if (c == 0) + regIndexC0 += regIndex; + + bufOffset.clear(); + bufOffset += offset; + bufOffset += " + ( "; + if ((numButterfly * workGroupSize) > algLS) { + bufOffset += "(("; + bufOffset += SztToStr(numButterfly); + bufOffset += "*me + "; + bufOffset += SztToStr(butterflyIndex); + bufOffset += ")/"; + bufOffset += SztToStr(algLS); + bufOffset += ")*"; + bufOffset += SztToStr(algL); + bufOffset += " + ("; + bufOffset += SztToStr(numButterfly); + bufOffset += "*me + "; + bufOffset += SztToStr(butterflyIndex); + bufOffset += ")%"; + bufOffset += SztToStr(algLS); + bufOffset += " + "; + } else { + bufOffset += SztToStr(numButterfly); + bufOffset += "*me + "; + bufOffset += SztToStr(butterflyIndex); + bufOffset += " + "; + } + + bufOffset += SztToStr(r * algLS); + bufOffset += " )*"; + bufOffset += SztToStr(stride); + + if (fft_doPostCallback) { + if (interleaved && (component == SR_COMP_BOTH)) { + if (c == (cEnd - 1)) { + passStr += "tempC.x = "; + passStr += regIndexC0; + passStr += ";\n\t"; + passStr += "tempC.y = "; + passStr += regIndex; + passStr += ";\n\t"; + + passStr += fft_postCallback.funcname; + passStr += "("; + passStr += buffer; + passStr += ", ("; + passStr += bufOffset; + passStr += "), post_userdata, tempC"; + if (fft_postCallback.localMemSize > 0) { + passStr += ", post_localmem"; + } + passStr += ");"; + } + } else if (c == (cEnd - 1)) { + passStr += fft_postCallback.funcname; + passStr += "("; + passStr += bufferRe; + passStr += ", "; + passStr += bufferIm; + passStr += ", ("; + passStr += bufOffset; + passStr += "), post_userdata, ("; + passStr += regIndexC0; + passStr += "), ("; + passStr += regIndex; + passStr += ")"; + if (fft_postCallback.localMemSize > 0) { + passStr += ", post_localmem"; + } + passStr += ");"; + } + } else { + passStr += buffer; + passStr += "["; + passStr += bufOffset; + passStr += "]"; + passStr += tail; + passStr += " = "; + passStr += regIndex; + passStr += ";"; + } + + // Since we write real & imag at once, we break the loop + if (interleaved && (component == SR_COMP_BOTH) && linearRegs) + break; + } + + if (realSpecial && (nextPass == nullptr) && (r == radix / 2) && + (i == 0)) + passStr += "\n\t}\n\tif(rw)\n\t{"; + } + + butterflyIndex++; + } + } + } + + assert(butterflyIndex <= numButterfly); + } + + // Special SweepRegs function to carry out some R-C/C-R specific operations + void SweepRegsRC(size_t flag, bool fwd, bool interleaved, size_t stride, + size_t component, double scale, bool setZero, bool batch2, + bool oddt, const std::string &bufferRe, + const std::string &bufferIm, const std::string &offset, + std::string &passStr) const { + assert((flag == SR_READ) || (flag == SR_WRITE)); + + // component: 0 - real, 1 - imaginary, 2 - both + size_t cStart, cEnd; + switch (component) { + case SR_COMP_REAL: + cStart = 0; + cEnd = 1; + break; + case SR_COMP_IMAG: + cStart = 1; + cEnd = 2; + break; + case SR_COMP_BOTH: + cStart = 0; + cEnd = 2; + break; + default: + assert(false); + } + + std::string rType = RegBaseType(1); + + assert(r2c || c2r); + assert(linearRegs); + bool singlePass = ((position == 0) && (nextPass == nullptr)); + + size_t numCR = numButterfly * radix; + if (!(numCR % 2)) + assert(!oddt); + + size_t rStart = 0; + size_t rEnd = numCR; + + bool oddp = ((numCR % 2) && (numCR > 1) && !setZero); + if (oddp) { + if (oddt) { + rStart = numCR - 1; + rEnd = numCR + 1; + } else { + rStart = 0; + rEnd = numCR - 1; + } + } + + if (!oddp) + assert(!oddt); + + for (size_t r = rStart; r < rEnd; r++) { + std::string val1StrExt; + + for (size_t c = cStart; c < cEnd; + c++) // component loop: 0 - real, 1 - imaginary + { + if (flag == SR_READ) // read operation { - length = params.fft_N[0]; - - offsetIn = params.fft_offsetIn; - offsetIn = params.fft_offsetOut; - - workGroupSize = params.fft_SIMD; - numTrans = (workGroupSize * params.fft_R) / length; - - r2c = false; - c2r = false; - // Check if it is R2C or C2R transform - if(params.fft_inputLayout == CLFFT_REAL) r2c = true; - if(params.fft_outputLayout == CLFFT_REAL) c2r = true; - r2c2r = (r2c || c2r); - - if(r2c) - { - rcFull = ( (params.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) || - (params.fft_outputLayout == CLFFT_COMPLEX_PLANAR) ) ? true : false; - } - if(c2r) - { - rcFull = ( (params.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) || - (params.fft_inputLayout == CLFFT_COMPLEX_PLANAR) ) ? true : false; - } - - rcSimple = params.fft_RCsimple; - - halfLds = true; - linearRegs = true; - - realSpecial = params.fft_realSpecial; - - blockCompute = params.blockCompute; - blockComputeType = params.blockComputeType; - // Make sure we can utilize all Lds if we are going to - // use blocked columns to compute FFTs - if(blockCompute) - { - assert(length <= 256); // 256 parameter comes from prototype experiments - // largest length at which block column possible given 32KB LDS limit - // if LDS limit is different this number need to be changed appropriately - halfLds = false; - linearRegs = true; - } - - assert( ((length*numTrans)%workGroupSize) == 0 ); - cnPerWI = (numTrans * length) / workGroupSize; - workGroupSizePerTrans = workGroupSize/numTrans; - - // !!!! IMPORTANT !!!! Keep these assertions unchanged, algorithm depend on these to be true - assert( (cnPerWI * workGroupSize) == (numTrans * length) ); - assert( cnPerWI <= length ); // Don't do more than 1 fft per work-item - - // Breakdown into passes - - size_t LS = 1; - size_t L; - size_t R = length; - size_t pid = 0; - - // See if we can get radices from the lookup table - const size_t *pRadices = NULL; - size_t nPasses; - KernelCoreSpecs kcs; - kcs.GetRadices(length, nPasses, pRadices); - if((params.fft_MaxWorkGroupSize >= 256) && (pRadices != NULL)) - { - for(size_t i=0; i(i, length, rad, cnPerWI, L, LS, R, linearRegs, halfLds, r2c, c2r, rcFull, rcSimple, realSpecial)); - - //Pass precallback information to Pass object if its the first pass. - //This will be used in single kernel transforms - if (params.fft_hasPreCallback && i == 0 && !params.blockCompute) - { - passes[0].SetPrecallback(params.fft_hasPreCallback, params.fft_preCallback); - } - - //Pass post-callback information to Pass object if its the last pass. - //This will be used in single kernel transforms - if (params.fft_hasPostCallback && i == (nPasses - 1) && !params.blockCompute) - { - passes[i].SetPostcallback(params.fft_hasPostCallback, params.fft_postCallback); - } - - LS *= rad; - } - assert(R == 1); // this has to be true for correct radix composition of the length - numPasses = nPasses; - } - else - { - // Possible radices - size_t cRad[] = {13,11,10,8,7,6,5,4,3,2,1}; // Must be in descending order - size_t cRadSize = (sizeof(cRad)/sizeof(cRad[0])); - - // Generate the radix and pass objects - while(true) - { - size_t rad; - - assert(cRadSize >= 1); - - // Picks the radices in descending order (biggest radix first) - for(size_t r=0; r cnPerWI) || (cnPerWI%rad)) - continue; - - if(!(R % rad)) - break; - } - - assert((cnPerWI%rad) == 0); - - L = LS * rad; - R /= rad; - - radices.push_back(rad); - passes.push_back(Pass(pid, length, rad, cnPerWI, L, LS, R, linearRegs, halfLds, r2c, c2r, rcFull, rcSimple, realSpecial)); - - //Pass precallback information to Pass object if its the first pass. - //This will be used in single kernel transforms - if (pid == 0 && params.fft_hasPreCallback) - { - passes[0].SetPrecallback(params.fft_hasPreCallback, params.fft_preCallback); - } - - pid++; - LS *= rad; - - assert(R >= 1); - if(R == 1) - break; - } - numPasses = pid; - - //Pass post-callback information to Pass object if its the last pass. - //This will be used in single kernel transforms - if (params.fft_hasPostCallback) - { - passes[numPasses - 1].SetPostcallback(params.fft_hasPostCallback, params.fft_postCallback); - } - } - - assert(numPasses == passes.size()); - assert(numPasses == radices.size()); + std::string tail, tail2; + std::string regIndex = "(*R"; + std::string buffer; + + RegBaseAndCountAndPos("", r, regIndex); + if (fft_doPreCallback && c2r) { + regIndex += ")"; + if (interleaved) { + buffer = (c == 0) ? bufferRe : bufferIm; + } else { + buffer += bufferRe; + buffer += ", "; + buffer += bufferIm; + } + } else { + if (c == 0) { + regIndex += ").x"; + buffer = bufferRe; + tail = interleaved ? ".x;" : ";"; + tail2 = interleaved ? ".y;" : ";"; + } else { + regIndex += ").y"; + buffer = bufferIm; + tail = interleaved ? ".y;" : ";"; + tail2 = interleaved ? ".x;" : ";"; + } + } + + size_t bid = numCR / 2; + bid = bid ? bid : 1; + size_t cid, lid; + + if (oddt) { + cid = r % 2; + lid = 1 + (numCR / 2); + } else { + cid = r / bid; + lid = 1 + r % bid; + } + + std::string oddpadd = oddp ? " (me/2) + " : " "; + + std::string idxStr, idxStrRev; + if ((length <= 2) || ((length & (length - 1)) != 0)) { + idxStr += SztToStr(bid); + idxStr += "*me +"; + idxStr += oddpadd; + idxStr += SztToStr(lid); + } else { + idxStr += "me + "; + idxStr += SztToStr(1 + length * (r % bid) / numCR); + idxStr += oddpadd; + } + idxStrRev += SztToStr(length); + idxStrRev += " - ("; + idxStrRev += idxStr; + idxStrRev += " )"; + + bool act = + (fwd || ((cid == 0) && (!batch2)) || ((cid != 0) && batch2)); + if (act) { + passStr += "\n\t"; + passStr += regIndex; + passStr += " = "; + } + + if (setZero) { + if (act) + passStr += "0;"; + } else { + if (act) { + if (fft_doPreCallback) { + passStr += fft_preCallback.funcname; + passStr += "("; + passStr += buffer; + passStr += ", "; + } else { + passStr += buffer; + passStr += "["; + } + passStr += offset; + passStr += " + ( "; + } + + if (fwd) { + if (cid == 0) + passStr += idxStr; + else + passStr += idxStrRev; + } else { + if (cid == 0) { + if (!batch2) + passStr += idxStr; + } else { + if (batch2) + passStr += idxStr; + } + } + + if (act) { + passStr += " )*"; + passStr += SztToStr(stride); + + if (fft_doPreCallback) { + passStr += ", pre_userdata"; + passStr += + (fft_preCallback.localMemSize > 0) ? ", localmem);" : ");"; + } else { + passStr += "]"; + + if (fwd) { + passStr += tail; + } else { + if (!batch2) + passStr += tail; + else + passStr += tail2; + } + } + } + } + } else // write operation + { + std::string tail; + std::string regIndex = "(*R"; + std::string regIndexPair = "(*R"; + std::string buffer; + + // Write real & imag at once + if (interleaved && (component == SR_COMP_BOTH)) { + assert(bufferRe.compare(bufferIm) == + 0); // Make sure Real & Imag buffer strings are same for + // interleaved data + buffer = bufferRe; + } else { + if (c == 0) { + buffer = bufferRe; + tail = interleaved ? ".x" : ""; + } else { + buffer = bufferIm; + tail = interleaved ? ".y" : ""; + } + } + + size_t bid, cid, lid; + if (singlePass && fwd) { + bid = 1 + radix / 2; + lid = r; + cid = r / bid; + + RegBaseAndCountAndPos("", r, regIndex); + regIndex += ")"; + RegBaseAndCountAndPos("", (radix - r) % radix, regIndexPair); + regIndexPair += ")"; + } else { + bid = numCR / 2; + + if (oddt) { + cid = r % 2; + lid = 1 + (numCR / 2); + + RegBaseAndCountAndPos("", r, regIndex); + regIndex += ")"; + RegBaseAndCountAndPos("", r + 1, regIndexPair); + regIndexPair += ")"; + } else { + cid = r / bid; + lid = 1 + r % bid; + + RegBaseAndCountAndPos("", r, regIndex); + regIndex += ")"; + RegBaseAndCountAndPos("", r + bid, regIndexPair); + regIndexPair += ")"; + } + } + + if (!cid) { + std::string oddpadd = oddp ? " (me/2) + " : " "; + + std::string sclStr = ""; + if (scale != 1.0f) { + sclStr += " * "; + sclStr += FloatToStr(scale); + sclStr += FloatSuffix(); + } + + if (fwd) { + std::string idxStr, idxStrRev; + if ((length <= 2) || ((length & (length - 1)) != 0)) { + idxStr += SztToStr(length / (2 * workGroupSize)); + idxStr += "*me +"; + idxStr += oddpadd; + idxStr += SztToStr(lid); + } else { + idxStr += "me + "; + idxStr += SztToStr(1 + length * (r % bid) / numCR); + idxStr += oddpadd; + } + idxStrRev += SztToStr(length); + idxStrRev += " - ("; + idxStrRev += idxStr; + idxStrRev += " )"; + + std::string val1Str, val2Str; + + if (fft_doPostCallback && !rcFull) { + if (interleaved) { + val1Str += "\n\t"; + val1Str += fft_postCallback.funcname; + val1Str += "("; + val1Str += buffer; + val1Str += ", "; + val1Str += offset; + val1Str += " + ( "; + val1Str += idxStr; + val1Str += " )*"; + val1Str += SztToStr(stride); + val1Str += ", post_userdata, "; + } else if (c == 0) { + val1StrExt += "\n\t"; + val1StrExt += fft_postCallback.funcname; + val1StrExt += "("; + val1StrExt += bufferRe; + val1StrExt += ", "; + val1StrExt += bufferIm; + val1StrExt += ", "; + val1StrExt += offset; + val1StrExt += " + ( "; + val1StrExt += idxStr; + val1StrExt += " )*"; + val1StrExt += SztToStr(stride); + val1StrExt += ", post_userdata, "; + } + } else { + val1Str += "\n\t"; + val1Str += buffer; + val1Str += "["; + val1Str += offset; + val1Str += " + ( "; + val1Str += idxStr; + val1Str += " )*"; + val1Str += SztToStr(stride); + val1Str += "]"; + val1Str += tail; + val1Str += " = "; + } + + val2Str += "\n\t"; + val2Str += buffer; + val2Str += "["; + val2Str += offset; + val2Str += " + ( "; + val2Str += idxStrRev; + val2Str += " )*"; + val2Str += SztToStr(stride); + val2Str += "]"; + val2Str += tail; + val2Str += " = "; + + std::string real1, imag1, real2, imag2; + + real1 += "("; + real1 += regIndex; + real1 += ".x + "; + real1 += regIndexPair; + real1 += ".x)*0.5"; + imag1 += "("; + imag1 += regIndex; + imag1 += ".y - "; + imag1 += regIndexPair; + imag1 += ".y)*0.5"; + real2 += "("; + real2 += regIndex; + real2 += ".y + "; + real2 += regIndexPair; + real2 += ".y)*0.5"; + imag2 += "(-"; + imag2 += regIndex; + imag2 += ".x + "; + imag2 += regIndexPair; + imag2 += ".x)*0.5"; + + if (interleaved && (component == SR_COMP_BOTH)) { + val1Str += "("; + val1Str += RegBaseType(2); + val1Str += ")( "; + val2Str += "("; + val2Str += RegBaseType(2); + val2Str += ")( "; + + if (!batch2) { + val1Str += real1; + val1Str += ", "; + val1Str += "+"; + val1Str += imag1; + val2Str += real1; + val2Str += ", "; + val2Str += "-"; + val2Str += imag1; + } else { + val1Str += real2; + val1Str += ", "; + val1Str += "+"; + val1Str += imag2; + val2Str += real2; + val2Str += ", "; + val2Str += "-"; + val2Str += imag2; + } + + val1Str += " )"; + val2Str += " )"; + } else { + val1Str += " ("; + val2Str += " ("; + if (c == 0) { + if (!batch2) { + val1Str += real1; + val2Str += real1; + } else { + val1Str += real2; + val2Str += real2; + } + } else { + if (!batch2) { + val1Str += "+"; + val1Str += imag1; + val2Str += "-"; + val2Str += imag1; + } else { + val1Str += "+"; + val1Str += imag2; + val2Str += "-"; + val2Str += imag2; + } + } + val1Str += " )"; + val2Str += " )"; + } + + val1Str += sclStr; + val2Str += sclStr; + + if (fft_doPostCallback && !rcFull) { + if (!interleaved) { + val1StrExt += val1Str; + val1Str.clear(); + + if (c == 0) + val1StrExt += ", "; + else + val1Str += val1StrExt; + } + + if (interleaved || c == (cEnd - 1)) { + if (fft_postCallback.localMemSize > 0) + val1Str += ", localmem"; + val1Str += ");"; + } + } else { + val1Str += ";"; + } + + passStr += val1Str; + if (rcFull) { + passStr += val2Str; + passStr += ";"; + } + } else { + std::string idxStr, idxStrRev; + if ((length <= 2) || ((length & (length - 1)) != 0)) { + idxStr += SztToStr(bid); + idxStr += "*me +"; + idxStr += oddpadd; + idxStr += SztToStr(lid); + } else { + idxStr += "me + "; + idxStr += SztToStr(1 + length * (r % bid) / numCR); + idxStr += oddpadd; + } + idxStrRev += SztToStr(length); + idxStrRev += " - ("; + idxStrRev += idxStr; + idxStrRev += " )"; + + passStr += "\n\t"; + passStr += buffer; + passStr += "["; + passStr += offset; + passStr += " + ( "; + + if (!batch2) + passStr += idxStr; + else + passStr += idxStrRev; + + passStr += " )*"; + passStr += SztToStr(stride); + passStr += "]"; + passStr += tail; + passStr += " = "; + + passStr += "( "; + if (c == 0) { + regIndex += ".x"; + regIndexPair += fft_doPreCallback ? ".y" : ".x"; + + if (!batch2) { + passStr += regIndex; + passStr += " - "; + passStr += regIndexPair; + } else { + passStr += regIndex; + passStr += " + "; + passStr += regIndexPair; + } + } else { + regIndex += ".y"; + regIndexPair += (fft_doPreCallback && oddt) ? ".x" : ".y"; + + if (!batch2) { + passStr += regIndex; + passStr += " + "; + passStr += regIndexPair; + } else { + passStr += " - "; + passStr += regIndex; + passStr += " + "; + passStr += regIndexPair; + } + } + passStr += " )"; + passStr += sclStr; + passStr += ";"; + } + + // Since we write real & imag at once, we break the loop + if (interleaved && (component == SR_COMP_BOTH)) + break; + } + } + } + } + } + + void CallButterfly(const std::string &bflyName, size_t regC, size_t numB, + std::string &passStr) const { + std::string regBase; + RegBase(regC, regBase); + + for (size_t i = 0; i < numB; i++) { + std::string regBaseCount = regBase; + RegBaseAndCount(i, regBaseCount); + + passStr += "\n\t"; + passStr += bflyName; + passStr += "("; + + for (size_t r = 0;; r++) { + if (linearRegs) { + std::string regIndex = "R"; + RegBaseAndCountAndPos("", i * radix + r, regIndex); + + passStr += regIndex; + } else { + std::string regRealIndex(regBaseCount); + std::string regImagIndex(regBaseCount); + RegBaseAndCountAndPos("R", r, regRealIndex); + RegBaseAndCountAndPos("I", r, regImagIndex); + + passStr += "&"; + passStr += regRealIndex; + passStr += ", "; + passStr += "&"; + passStr += regImagIndex; + } -#ifdef PARMETERS_TO_BE_READ + if (r == radix - 1) { + passStr += ");"; + break; + } else { + passStr += ", "; + } + } + } + } + +public: + Pass(size_t positionVal, size_t lengthVal, size_t radixVal, size_t cnPerWIVal, + size_t L, size_t LS, size_t R, bool linearRegsVal, bool halfLdsVal, + bool r2cVal, bool c2rVal, bool rcFullVal, bool rcSimpleVal, + bool realSpecialVal) + : position(positionVal), length(lengthVal), radix(radixVal), + cnPerWI(cnPerWIVal), algL(L), algLS(LS), algR(R), + linearRegs(linearRegsVal), halfLds(halfLdsVal), r2c(r2cVal), + c2r(c2rVal), rcFull(rcFullVal), rcSimple(rcSimpleVal), + realSpecial(realSpecialVal), enableGrouping(true), numB1(0), numB2(0), + numB4(0), nextPass(nullptr), fft_doPreCallback(false), + fft_doPostCallback(false) { + assert(radix <= length); + assert(length % radix == 0); + + numButterfly = cnPerWI / radix; + workGroupSize = length / cnPerWI; + + // Total number of butterflies (over all work-tems) must be divisible by LS + assert(((numButterfly * workGroupSize) % algLS) == 0); + + // All butterflies in one work-item should always be part of no more than 1 + // FFT transform. In other words, there should not be more than 1 FFT + // transform per work-item. + assert(cnPerWI <= length); + + // Calculate the different types of Butterflies needed + if (linearRegs || r2c || c2r) { + numB1 = numButterfly; + } else { + numB4 = numButterfly / 4; + numB2 = (numButterfly % 4) / 2; // can be 0 or 1 + numB1 = (numButterfly % 2); // can be 0 or 1 - ParamRead pr; - ReadParameterFile(pr); + assert(numButterfly == (numB4 * 4 + numB2 * 2 + numB1)); + } - radices.clear(); - passes.clear(); + // if only half LDS can be used, we need the passes to share registers + // and hence they need to be linear registers + if (halfLds) + assert(linearRegs); + } + + size_t GetNumB1() const { return numB1; } + size_t GetNumB2() const { return numB2; } + size_t GetNumB4() const { return numB4; } + + size_t GetPosition() const { return position; } + size_t GetRadix() const { return radix; } + + void SetNextPass(Pass *np) { nextPass = np; } + void SetGrouping(bool grp) { enableGrouping = grp; } + + void SetPrecallback(bool hasPrecallback, + clfftCallbackParam precallbackParam) { + fft_doPreCallback = hasPrecallback; + fft_preCallback = precallbackParam; + } + + void SetPostcallback(bool hasPostcallback, + clfftCallbackParam postcallbackParam) { + fft_doPostCallback = hasPostcallback; + fft_postCallback = postcallbackParam; + } + + void GeneratePass(bool fwd, std::string &passStr, bool fft_3StepTwiddle, + bool twiddleFront, bool inInterleaved, bool outInterleaved, + bool inReal, bool outReal, size_t inStride, + size_t outStride, double scale, bool gIn = false, + bool gOut = false) const { + const std::string bufferInRe = + (inReal || inInterleaved) ? "bufIn" : "bufInRe"; + const std::string bufferInIm = + (inReal || inInterleaved) ? "bufIn" : "bufInIm"; + const std::string bufferOutRe = + (outReal || outInterleaved) ? "bufOut" : "bufOutRe"; + const std::string bufferOutIm = + (outReal || outInterleaved) ? "bufOut" : "bufOutIm"; + + const std::string bufferInRe2 = + (inReal || inInterleaved) ? "bufIn2" : "bufInRe2"; + const std::string bufferInIm2 = + (inReal || inInterleaved) ? "bufIn2" : "bufInIm2"; + const std::string bufferOutRe2 = + (outReal || outInterleaved) ? "bufOut2" : "bufOutRe2"; + const std::string bufferOutIm2 = + (outReal || outInterleaved) ? "bufOut2" : "bufOutIm2"; + + // for real transforms we use only B1 butteflies (regC = 1) + if (r2c || c2r) { + assert(numB1 == numButterfly); + assert(linearRegs); + } - radices = pr.radices; - numPasses = radices.size(); + // Check if it is single pass transform + bool singlePass = ((position == 0) && (nextPass == nullptr)); + if (singlePass) + assert(numButterfly == 1); // for single pass transforms, there can be + // only 1 butterfly per transform + if (singlePass) + assert(workGroupSize == 1); + + // Register types + std::string regB1Type = RegBaseType(1); + std::string regB2Type = RegBaseType(2); + std::string regB4Type = RegBaseType(4); + + // Function attribute + passStr += "__attribute__((always_inline)) void\n"; + + // Function name + passStr += PassName(position, fwd); + + // Function arguments + passStr += "("; + passStr += "uint rw, uint b, "; + if (realSpecial) + passStr += "uint t, "; + passStr += "uint me, uint inOffset, uint outOffset, "; + + if (r2c || c2r) { + assert(halfLds); + + if (gIn) { + if (inInterleaved) { + passStr += "__global "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + if (!rcSimple) { + passStr += "__global "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferInRe2; + passStr += ", "; + } + } else if (inReal) { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + if (!rcSimple) { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe2; + passStr += ", "; + } + } else { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + if (!rcSimple) { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe2; + passStr += ", "; + } + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInIm; + passStr += ", "; + if (!rcSimple) { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInIm2; + passStr += ", "; + } + } + } else { + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInIm; + passStr += ", "; + } + + if (gOut) { + if (outInterleaved) { + passStr += "__global "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferOutRe; + if (!rcSimple) { + passStr += ", "; + passStr += "__global "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferOutRe2; + } + } else if (outReal) { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe; + if (!rcSimple) { + passStr += ", "; + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe2; + } + } else { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe; + passStr += ", "; + if (!rcSimple) { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe2; + passStr += ", "; + } + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutIm; + if (!rcSimple) { + passStr += ", "; + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutIm2; + } + } + } else { + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe; + passStr += ", "; + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutIm; + } + } else { + if (gIn) { + if (inInterleaved) { + passStr += "__global "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + } else { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInIm; + passStr += ", "; + } + } else { + if (inInterleaved) { + passStr += "__local "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + } else { + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInRe; + passStr += ", "; + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferInIm; + passStr += ", "; + } + } + + if (gOut) { + if (outInterleaved) { + passStr += "__global "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferOutRe; + } else { + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe; + passStr += ", "; + passStr += "__global "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutIm; + } + } else { + if (outInterleaved) { + passStr += "__local "; + passStr += regB2Type; + passStr += " *"; + passStr += bufferOutRe; + } else { + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutRe; + passStr += ", "; + passStr += "__local "; + passStr += regB1Type; + passStr += " *"; + passStr += bufferOutIm; + } + } + } - LS = 1; - R = length; - for(size_t i=0; i(i, length, rad, cnPerWI, L, LS, R, linearRegs)); + if (fft_doPreCallback || fft_doPostCallback) { + // Include pre-callback parameters if pre-callback is set + if (fft_doPreCallback) { + if ((r2c && !rcSimple) || c2r) { + passStr += ", uint inOffset2"; + } - LS *= rad; - } - assert(R == 1); -#endif + passStr += ", __global void* pre_userdata"; + } + + // Include post-callback parameters if post-callback is set + if (fft_doPostCallback) { + if (r2c || (c2r && !rcSimple)) { + passStr += ", uint outOffset2"; + } + passStr += ", __global void* post_userdata"; + } + + if (fft_doPreCallback && fft_preCallback.localMemSize > 0) { + passStr += ", __local void* localmem"; + } + if (fft_doPostCallback && fft_postCallback.localMemSize > 0) { + passStr += ", __local void* post_localmem"; + } + } + + passStr += ")\n{\n"; + + // Register Declarations + if (!linearRegs) { + DeclareRegs(regB1Type, 1, numB1, passStr); + DeclareRegs(regB2Type, 2, numB2, passStr); + DeclareRegs(regB4Type, 4, numB4, passStr); + } + + // odd cnPerWI processing + bool oddp = false; + oddp = ((cnPerWI % 2) && (length > 1) && (!singlePass)); + + // additional register for odd + if (!rcSimple && oddp && + ((r2c && (nextPass == nullptr)) || (c2r && (position == 0)))) { + passStr += "\n\t"; + passStr += "uint brv = 0;\n\t"; + passStr += "\n\t"; + passStr += regB2Type; + passStr += " R"; + passStr += SztToStr(cnPerWI); + passStr += "[1];\n\t"; + passStr += "(*R"; + passStr += SztToStr(cnPerWI); + passStr += ").x = 0; "; + passStr += "(*R"; + passStr += SztToStr(cnPerWI); + passStr += ").y = 0;\n"; + } + + // Special private memory for c-r 1 pass transforms + if (!rcSimple && (c2r && (position == 0)) && singlePass) { + assert(radix == length); + + passStr += "\n\t"; + passStr += regB1Type; + passStr += " mpvt["; + passStr += SztToStr(length); + passStr += "];\n"; + } + + passStr += "\n"; + + // Read into registers + if (r2c) { + if (position == 0) { + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, + passStr); + passStr += "\n\t}\n"; + + if (rcSimple) { + passStr += "\n"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, + true, true, false, bufferInRe2, bufferInIm2, "inOffset", + passStr); + passStr += "\n"; + } else { + passStr += "\n\tif(rw > 1)\n\t{"; + if (fft_doPreCallback) { + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, + false, bufferInRe2, bufferInIm2, "inOffset2", 1, numB1, 0, + passStr); + } else { + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, + false, bufferInRe2, bufferInIm2, "inOffset", 1, numB1, 0, + passStr); + } + passStr += "\n\t}\n"; + + passStr += "\telse\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, 1.0f, + true, true, false, bufferInRe2, bufferInIm2, "inOffset", + passStr); + passStr += "\n\t}\n"; + } + } + } else if (c2r && !rcSimple) { + if (position == 0) { + std::string processBufRe = bufferOutRe; + std::string processBufIm = bufferOutIm; + std::string processBufOffset = "outOffset"; + size_t processBufStride = outStride; + + if (singlePass) { + processBufRe = "mpvt"; + processBufIm = "mpvt"; + processBufOffset = "0"; + processBufStride = 1; + } + + passStr += "\n\tif(rw && !me)\n\t{\n\t"; + passStr += processBufRe; + passStr += "["; + passStr += processBufOffset; + passStr += "] = "; + + if (fft_doPreCallback) { + passStr += fft_preCallback.funcname; + passStr += "("; + passStr += bufferInRe; + if (!inInterleaved) { + passStr += ", "; + passStr += bufferInIm; + } + passStr += ", inOffset, pre_userdata"; + passStr += fft_preCallback.localMemSize > 0 ? ", localmem)" : ")"; + } else { + passStr += bufferInRe; + passStr += "[inOffset]"; + } - // Grouping read/writes ok? - bool grp = IsGroupedReadWritePossible(); - for(size_t i=0; i < numPasses; i++) - passes[i].SetGrouping(grp); - - // Store the next pass-object pointers - if(numPasses > 1) - for(size_t i=0; i < (numPasses - 1); i++) - passes[i].SetNextPass(&passes[i+1]); - - - if(blockCompute) - { - blockWidth = BlockSizes::BlockWidth(length); - blockWGS = BlockSizes::BlockWorkGroupSize(length); - blockLDS = BlockSizes::BlockLdsSize(length); - } - else - { - blockWidth = blockWGS = blockLDS = 0; - } - } - - class BlockSizes - { - public: - enum ValType - { - BS_VT_WGS, - BS_VT_BWD, - BS_VT_LDS, - }; - - static size_t BlockLdsSize(size_t N) { return GetValue(N, BS_VT_LDS); } - static size_t BlockWidth(size_t N) { return GetValue(N, BS_VT_BWD); } - static size_t BlockWorkGroupSize(size_t N) { return GetValue(N, BS_VT_WGS); } - - private: - - static size_t GetValue(size_t N, ValType vt) - { - size_t wgs; // preferred work group size - size_t bwd; // block width to be used - size_t lds; // LDS size to be used for the block - - - KernelCoreSpecs kcs; - size_t t_wgs, t_nt; - kcs.GetWGSAndNT(N, t_wgs, t_nt); - - switch(N) - { - case 256: bwd = 8/PrecisionWidth(); wgs = (bwd > t_nt) ? 256 : t_wgs; break; - case 128: bwd = 8/PrecisionWidth(); wgs = (bwd > t_nt) ? 128 : t_wgs; break; - case 64: bwd = 16/PrecisionWidth(); wgs = (bwd > t_nt) ? 128 : t_wgs; break; - case 32: bwd = 32/PrecisionWidth(); wgs = (bwd > t_nt) ? 64 : t_wgs; break; - case 16: bwd = 64/PrecisionWidth(); wgs = (bwd > t_nt) ? 64 : t_wgs; break; - case 8: bwd = 128/PrecisionWidth(); wgs = (bwd > t_nt) ? 64 : t_wgs; break; - default: assert(false); - } - - // block width cannot be less than numTrans, math in other parts of code depend on this assumption - assert(bwd >= t_nt); - - lds = N*bwd; - - switch(vt) - { - case BS_VT_WGS: return wgs; - case BS_VT_BWD: return bwd; - case BS_VT_LDS: return lds; - default: assert(false); return 0; - } - } - }; - - void GenerateKernel(std::string &str, cl_device_id Dev_ID) - { - std::string twType = RegBaseType(2); - std::string rType = RegBaseType(1); - std::string r2Type = RegBaseType(2); - - bool inInterleaved; // Input is interleaved format - bool outInterleaved; // Output is interleaved format - inInterleaved = ( (params.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) || - (params.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED) ) ? true : false; - outInterleaved = ( (params.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) || - (params.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED) ) ? true : false; - - // use interleaved LDS when halfLds constraint absent - bool ldsInterleaved = inInterleaved || outInterleaved; - ldsInterleaved = halfLds ? false : ldsInterleaved; - ldsInterleaved = blockCompute ? true : ldsInterleaved; - - bool inReal; // Input is real format - bool outReal; // Output is real format - inReal = (params.fft_inputLayout == CLFFT_REAL) ? true : false; - outReal = (params.fft_outputLayout == CLFFT_REAL) ? true : false; - - size_t large1D = 0; - if(params.fft_realSpecial) - large1D = params.fft_N[0] * params.fft_realSpecial_Nr; - else - large1D = params.fft_N[0] * params.fft_N[1]; - - // Pragma - str += ClPragma(); - - // Twiddle table - if(length > 1) - { - TwiddleTable twTable(length); - - str += "\n__constant "; - str += twType; str += " "; - str += TwTableName(); - str += "["; str += SztToStr(length-1); str += "] = {\n"; - twTable.GenerateTwiddleTable(radices, str); - str += "};\n\n"; - } - str += "\n"; - - // twiddle factors for 1d-large 3-step algorithm - if(params.fft_3StepTwiddle) - { - TwiddleTableLarge twLarge(large1D); - twLarge.GenerateTwiddleTable(str); - } - - std::string sfx = FloatSuffix(); - - // Base type - str += "#define fptype "; str += RegBaseType(1); str += "\n\n"; - - // Vector type - str += "#define fvect2 "; str += RegBaseType(2); str += "\n\n"; - - bool cReg = linearRegs ? true : false; - - // Generate butterflies for all unique radices - std::list uradices; - for(std::vector::const_iterator r = radices.begin(); r != radices.end(); r++) - uradices.push_back(*r); - - uradices.sort(); - uradices.unique(); - - - //constants - if (length%8 == 0) - { - str += "#define C8Q 0.70710678118654752440084436210485"; str += sfx; str += "\n"; - } - - if (length % 5 == 0) - { - str += "#define C5QA 0.30901699437494742410229341718282"; str += sfx; str += "\n"; - str += "#define C5QB 0.95105651629515357211643933337938"; str += sfx; str += "\n"; - str += "#define C5QC 0.50000000000000000000000000000000"; str += sfx; str += "\n"; - str += "#define C5QD 0.58778525229247312916870595463907"; str += sfx; str += "\n"; - str += "#define C5QE 0.80901699437494742410229341718282"; str += sfx; str += "\n"; - } - - if (length % 3 == 0) - { - str += "#define C3QA 0.50000000000000000000000000000000"; str += sfx; str += "\n"; - str += "#define C3QB 0.86602540378443864676372317075294"; str += sfx; str += "\n"; - } - - if (length % 7 == 0) - { - str += "#define C7Q1 -1.16666666666666651863693004997913"; str += sfx; str += "\n"; - str += "#define C7Q2 0.79015646852540022404554065360571"; str += sfx; str += "\n"; - str += "#define C7Q3 0.05585426728964774240049351305970"; str += sfx; str += "\n"; - str += "#define C7Q4 0.73430220123575240531721419756650"; str += sfx; str += "\n"; - str += "#define C7Q5 0.44095855184409837868031445395900"; str += sfx; str += "\n"; - str += "#define C7Q6 0.34087293062393136944265847887436"; str += sfx; str += "\n"; - str += "#define C7Q7 -0.53396936033772524066165487965918"; str += sfx; str += "\n"; - str += "#define C7Q8 0.87484229096165666561546458979137"; str += sfx; str += "\n"; - } - - if (length % 11 == 0) - { - str += "#define b11_0 0.9898214418809327"; str += sfx; str += "\n"; - str += "#define b11_1 0.9594929736144973"; str += sfx; str += "\n"; - str += "#define b11_2 0.9189859472289947"; str += sfx; str += "\n"; - str += "#define b11_3 0.8767688310025893"; str += sfx; str += "\n"; - str += "#define b11_4 0.8308300260037728"; str += sfx; str += "\n"; - str += "#define b11_5 0.7784344533346518"; str += sfx; str += "\n"; - str += "#define b11_6 0.7153703234534297"; str += sfx; str += "\n"; - str += "#define b11_7 0.6343562706824244"; str += sfx; str += "\n"; - str += "#define b11_8 0.3425847256816375"; str += sfx; str += "\n"; - str += "#define b11_9 0.5211085581132027"; str += sfx; str += "\n"; - } - - if (length % 13 == 0) - { - str += "#define b13_0 0.9682872443619840"; str += sfx; str += "\n"; - str += "#define b13_1 0.9578059925946651"; str += sfx; str += "\n"; - str += "#define b13_2 0.8755023024091479"; str += sfx; str += "\n"; - str += "#define b13_3 0.8660254037844386"; str += sfx; str += "\n"; - str += "#define b13_4 0.8595425350987748"; str += sfx; str += "\n"; - str += "#define b13_5 0.8534800018598239"; str += sfx; str += "\n"; - str += "#define b13_6 0.7693388175729806"; str += sfx; str += "\n"; - str += "#define b13_7 0.6865583707817543"; str += sfx; str += "\n"; - str += "#define b13_8 0.6122646503767565"; str += sfx; str += "\n"; - str += "#define b13_9 0.6004772719326652"; str += sfx; str += "\n"; - str += "#define b13_10 0.5817047785105157"; str += sfx; str += "\n"; - str += "#define b13_11 0.5751407294740031"; str += sfx; str += "\n"; - str += "#define b13_12 0.5220263851612750"; str += sfx; str += "\n"; - str += "#define b13_13 0.5200285718888646"; str += sfx; str += "\n"; - str += "#define b13_14 0.5165207806234897"; str += sfx; str += "\n"; - str += "#define b13_15 0.5149187780863157"; str += sfx; str += "\n"; - str += "#define b13_16 0.5035370328637666"; str += sfx; str += "\n"; - str += "#define b13_17 0.5000000000000000"; str += sfx; str += "\n"; - str += "#define b13_18 0.3027756377319946"; str += sfx; str += "\n"; - str += "#define b13_19 0.3014792600477098"; str += sfx; str += "\n"; - str += "#define b13_20 0.3004626062886657"; str += sfx; str += "\n"; - str += "#define b13_21 0.2517685164318833"; str += sfx; str += "\n"; - str += "#define b13_22 0.2261094450357824"; str += sfx; str += "\n"; - str += "#define b13_23 0.0833333333333333"; str += sfx; str += "\n"; - str += "#define b13_24 0.0386329546443481"; str += sfx; str += "\n"; - } - - str += "\n"; - - - //If pre-callback is set for the plan - std::string callbackstr; - if (params.fft_hasPreCallback) - { - //Insert pre-callback function code at the beginning - callbackstr += params.fft_preCallback.funcstring; - callbackstr += "\n\n"; - - str += callbackstr; - } - - //If post-callback is set for the plan - if (params.fft_hasPostCallback) - { - //Insert post-callback function code - str += params.fft_postCallback.funcstring; - str += "\n\n"; - } - - typename std::vector< Pass >::const_iterator p; - if(length > 1) - { - for(std::list::const_iterator r = uradices.begin(); r != uradices.end(); r++) - { - size_t rad = *r; - p = passes.begin(); - while(p->GetRadix() != rad) p++; - - for(size_t d=0; d<2; d++) - { - bool fwd = d ? false : true; - - if(p->GetNumB1()) { Butterfly bfly(rad, 1, fwd, cReg); bfly.GenerateButterfly(str); str += "\n"; } - if(p->GetNumB2()) { Butterfly bfly(rad, 2, fwd, cReg); bfly.GenerateButterfly(str); str += "\n"; } - if(p->GetNumB4()) { Butterfly bfly(rad, 4, fwd, cReg); bfly.GenerateButterfly(str); str += "\n"; } - } - } - } - - // Generate passes - for(size_t d=0; d<2; d++) - { - bool fwd; - - if(r2c2r) - { - fwd = r2c; - } - else - { - fwd = d ? false : true; - } - - double scale = fwd ? params.fft_fwdScale : params.fft_backScale; - - for(p = passes.begin(); p != passes.end(); p++) - { - double s = 1.0; - size_t ins = 1, outs = 1; - bool gIn = false, gOut = false; - bool inIlvd = false, outIlvd = false; - bool inRl = false, outRl = false; - bool tw3Step = false; - - - if(p == passes.begin() && params.fft_twiddleFront ) { tw3Step = params.fft_3StepTwiddle; } - if((p+1) == passes.end()) { s = scale; if(!params.fft_twiddleFront) tw3Step = params.fft_3StepTwiddle; } - - if(blockCompute && !r2c2r) - { - inIlvd = ldsInterleaved; - outIlvd = ldsInterleaved; - } - else - { - if(p == passes.begin()) { inIlvd = inInterleaved; inRl = inReal; gIn = true; ins = params.fft_inStride[0]; } - if((p+1) == passes.end()) { outIlvd = outInterleaved; outRl = outReal; gOut = true; outs = params.fft_outStride[0]; } - - if(p != passes.begin()) { inIlvd = ldsInterleaved; } - if((p+1) != passes.end()) { outIlvd = ldsInterleaved; } - } - - p->GeneratePass(fwd, str, tw3Step, params.fft_twiddleFront, inIlvd, outIlvd, inRl, outRl, ins, outs, s, gIn, gOut); - } - - // if real transform we do only 1 direction - if(r2c2r) - break; - } - - - - // TODO : address this kludge - str += " typedef union { uint u; int i; } cb_t;\n\n"; - - for(size_t d=0; d<2; d++) - { - bool fwd; - - if(r2c2r) - { - fwd = inReal ? true : false; - } - else - { - fwd = d ? false : true; - } - - // FFT kernel begin - // Function attribute - str += "__kernel __attribute__((reqd_work_group_size ("; - if(blockCompute) str += SztToStr(blockWGS); - else str += SztToStr(workGroupSize); - str += ",1,1)))\nvoid "; - - // Function name - if(fwd) str += "fft_fwd"; - else str += "fft_back"; - str += "("; - - // TODO : address this kludge - size_t SizeParam_ret = 0; - clGetDeviceInfo(Dev_ID, CL_DEVICE_VENDOR, 0, NULL, &SizeParam_ret); - char* nameVendor = new char[SizeParam_ret]; - clGetDeviceInfo(Dev_ID, CL_DEVICE_VENDOR, SizeParam_ret, nameVendor, NULL); - - //nv compiler doesn't support __constant kernel argument - // TODO : works with CUDA 10.0, so might not be true anymore - if (strncmp(nameVendor, "NVIDIA",6)!=0) - str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; + if (inInterleaved || fft_doPreCallback) + passStr += ".x;\n\t}"; else - str += "__global cb_t *cb, "; - // str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; - delete [] nameVendor; - - //If plan has pre/post callback - callbackstr.clear(); - bool hasCallback = params.fft_hasPreCallback || params.fft_hasPostCallback; - - if (hasCallback) - { - if (params.fft_hasPreCallback) - { - callbackstr += ", __global void* pre_userdata"; - } - if (params.fft_hasPostCallback) - { - callbackstr += ", __global void* post_userdata"; - } - - if (params.fft_preCallback.localMemSize > 0 || params.fft_postCallback.localMemSize > 0) - { - callbackstr += ", __local void* localmem"; - } - } - // Function attributes - if(params.fft_placeness == CLFFT_INPLACE) - { - if(r2c2r) - { - if(outInterleaved) - { - str += "__global "; str += r2Type; str += " * restrict gb"; - } - else - { - str += "__global "; str += rType; str += " * restrict gb"; - } - } - else - { - assert(inInterleaved == outInterleaved); - assert(params.fft_inStride[1] == params.fft_outStride[1]); - assert(params.fft_inStride[0] == params.fft_outStride[0]); - - if(inInterleaved) - { - str += "__global "; str += r2Type; str += " * restrict gb"; - } - else - { - str += "__global "; str += rType; str += " * restrict gbRe, "; - str += "__global "; str += rType; str += " * restrict gbIm"; - } - } - } - else - { - if(r2c2r) - { - if(inInterleaved) - { - str += "__global "; str += r2Type; str += " * restrict gbIn, "; - } - else if(inReal) - { - str += "__global "; str += rType; str += " * restrict gbIn, "; - } - else - { - str += "__global const "; str += rType; str += " * restrict gbInRe, "; - str += "__global const "; str += rType; str += " * restrict gbInIm, "; - } - - if(outInterleaved) - { - str += "__global "; str += r2Type; str += " * restrict gbOut"; - } - else if(outReal) - { - str += "__global "; str += rType; str += " * restrict gbOut"; - } - else - { - str += "__global "; str += rType; str += " * restrict gbOutRe, "; - str += "__global "; str += rType; str += " * restrict gbOutIm"; - } - } - else - { - if(inInterleaved) - { - str += "__global const "; str += r2Type; str += " * restrict gbIn, "; - } - else - { - str += "__global const "; str += rType; str += " * restrict gbInRe, "; - str += "__global const "; str += rType; str += " * restrict gbInIm, "; - } - - if(outInterleaved) - { - str += "__global "; str += r2Type; str += " * restrict gbOut"; - } - else - { - str += "__global "; str += rType; str += " * restrict gbOutRe, "; - str += "__global "; str += rType; str += " * restrict gbOutIm"; - } - } - } - - //If plan has callback - if (hasCallback) - { - str += callbackstr; - } - str += ", const int offsetIn, const int offsetOut "; - str += ")\n"; - - str += "{\n"; - - // Initialize - str += "\t"; - str += "uint me = get_local_id(0);\n\t"; - str += "uint batch = get_group_id(0);"; - str += "\n"; - - - - // Allocate LDS - if(blockCompute) - { - str += "\n\t"; str += "__local "; str += r2Type; str += " lds["; - str += SztToStr(blockLDS); str += "];\n"; - } - else - { - size_t ldsSize = halfLds ? length*numTrans : 2*length*numTrans; - ldsSize = ldsInterleaved ? ldsSize/2 : ldsSize; - - if(numPasses > 1) - { - str += "\n\t"; - str += "__local "; str += ldsInterleaved ? r2Type: rType; str += " lds["; - str += SztToStr(ldsSize); str += "];\n"; - } - } - - // Declare memory pointers - str += "\n\t"; - if(r2c2r) - { - str += "uint iOffset;\n\t"; - str += "uint oOffset;\n\n\t"; - if(!rcSimple) - { - str += "uint iOffset2;\n\t"; - str += "uint oOffset2;\n\n\t"; - } - - if (!params.fft_hasPreCallback) - { - if(inInterleaved) - { - if(!rcSimple) { str += "__global "; str += r2Type; str += " *lwbIn2;\n\t"; } - str += "__global "; str += r2Type; str += " *lwbIn;\n\t"; - } - else if(inReal) - { - if(!rcSimple) { str += "__global "; str += rType; str += " *lwbIn2;\n\t"; } - str += "__global "; str += rType; str += " *lwbIn;\n\t"; - - } - else - { - if(!rcSimple) { str += "__global "; str += rType; str += " *lwbInRe2;\n\t"; } - if(!rcSimple) { str += "__global "; str += rType; str += " *lwbInIm2;\n\t"; } - - str += "__global "; str += rType; str += " *lwbInRe;\n\t"; - str += "__global "; str += rType; str += " *lwbInIm;\n\t"; - - } - } - - if(outInterleaved) - { - if (!params.fft_hasPostCallback) - { - if(!rcSimple) { str += "__global "; str += r2Type; str += " *lwbOut2;\n\t"; } - str += "__global "; str += r2Type; str += " *lwbOut;\n"; - } - } - else if(outReal) - { - if (!params.fft_hasPostCallback) - { - if(!rcSimple) { str += "__global "; str += rType; str += " *lwbOut2;\n\t"; } - str += "__global "; str += rType; str += " *lwbOut;\n"; - } - } - else - { - if (!params.fft_hasPostCallback) - { - if(!rcSimple) { str += "__global "; str += rType; str += " *lwbOutRe2;\n\t"; } - if(!rcSimple) { str += "__global "; str += rType; str += " *lwbOutIm2;\n\t"; } - str += "__global "; str += rType; str += " *lwbOutRe;\n\t"; - str += "__global "; str += rType; str += " *lwbOutIm;\n"; - } - } - str += "\n"; - } - else - { - if(params.fft_placeness == CLFFT_INPLACE) - { - str += "uint ioOffset;\n\t"; - - //Skip if callback is set - if (!params.fft_hasPreCallback || !params.fft_hasPostCallback) - { - if(inInterleaved) - { - str += "__global "; str += r2Type; str += " *lwb;\n"; - } - else - { - str += "__global "; str += rType; str += " *lwbRe;\n\t"; - str += "__global "; str += rType; str += " *lwbIm;\n"; - } - } - str += "\n"; - } - else - { - str += "uint iOffset;\n\t"; - str += "uint oOffset;\n\t"; - - //Skip if precallback is set - if (!(params.fft_hasPreCallback)) - { - if(inInterleaved) - { - str += "__global "; str += r2Type; str += " *lwbIn;\n\t"; - } - else - { - str += "__global "; str += rType; str += " *lwbInRe;\n\t"; - str += "__global "; str += rType; str += " *lwbInIm;\n\t"; - } - } - - //Skip if postcallback is set - if (!params.fft_hasPostCallback) - { - if(outInterleaved) - { - str += "__global "; str += r2Type; str += " *lwbOut;\n"; - } - else - { - str += "__global "; str += rType; str += " *lwbOutRe;\n\t"; - str += "__global "; str += rType; str += " *lwbOutIm;\n"; - } - } - str += "\n"; - } - } - - // Setup registers if needed - if(linearRegs) - { - str += "\t"; str += RegBaseType(2); - str += " "; str += IterRegs("", false); - str += ";\n\n"; - } - - // Calculate total transform count - std::string totalBatch = "("; - size_t i = 0; - while(i < (params.fft_DataDim - 2)) - { - totalBatch += SztToStr(params.fft_N[i+1]); totalBatch += " * "; - i++; - } - totalBatch += "cb[0].u)"; - - // Conditional read-write ('rw') for arbitrary batch number - if(r2c2r && !rcSimple) - { - str += "\tuint this = "; str += totalBatch; str += " - batch*"; - str += SztToStr(2*numTrans); str += ";\n"; - str += "\tuint rw = (me < ((this+1)/2)*"; str += SztToStr(workGroupSizePerTrans); - str += ") ? (this - 2*(me/"; str += SztToStr(workGroupSizePerTrans); str += ")) : 0;\n\n"; - } - else - { - if( (numTrans > 1) && !blockCompute ) - { - str += "\tuint rw = (me < ("; str += totalBatch; - str += " - batch*"; str += SztToStr(numTrans); str += ")*"; - str += SztToStr(workGroupSizePerTrans); str += ") ? 1 : 0;\n\n"; - } - else - { - str += "\tuint rw = 1;\n\n"; - } - } - - // Transform index for 3-step twiddles - if(params.fft_3StepTwiddle && !blockCompute) - { - if(numTrans == 1) - { - str += "\tuint b = batch%"; - } - else - { - str += "\tuint b = (batch*"; str += SztToStr(numTrans); str += " + (me/"; - str += SztToStr(workGroupSizePerTrans); str += "))%"; - } - - str += SztToStr(params.fft_N[1]); str += ";\n\n"; - - if(params.fft_realSpecial) - { - str += "\tuint bt = b;\n\n"; - } - } - else - { - str += "\tuint b = 0;\n\n"; - } - - // Setup memory pointers - if(r2c2r) - { - str += OffsetCalc("iOffset", true); - str += OffsetCalc("oOffset", false); - if(!rcSimple) { str += OffsetCalc("iOffset2", true, true); } - if(!rcSimple) { str += OffsetCalc("oOffset2", false, true); } - - str += "\n\t"; - if(params.fft_placeness == CLFFT_INPLACE) - { - if(!params.fft_hasPreCallback) - { - if(inInterleaved) - { - if(!rcSimple) { str += "lwbIn2 = (__global "; str += r2Type; str += " *)gb + iOffset2;\n\t"; } - str += "lwbIn = (__global "; str += r2Type; str += " *)gb + iOffset;\n\t"; - } - else - { - if(!rcSimple) { str += "lwbIn2 = (__global "; str += rType; str += " *)gb + iOffset2;\n\t"; } - str += "lwbIn = (__global "; str += rType; str += " *)gb + iOffset;\n\t"; - - } - } - - if(!params.fft_hasPostCallback) - { - if(!rcSimple) { str += "lwbOut2 = gb + oOffset2;\n\t"; } - str += "lwbOut = gb + oOffset;\n"; - } - str += "\n"; - } - else - { - if (!params.fft_hasPreCallback) - { - if(inInterleaved || inReal) - { - if(!rcSimple) { str += "lwbIn2 = gbIn + iOffset2;\n\t"; } - str += "lwbIn = gbIn + iOffset;\n\t"; - } - else - { - if(!rcSimple) { str += "lwbInRe2 = gbInRe + iOffset2;\n\t"; } - if(!rcSimple) { str += "lwbInIm2 = gbInIm + iOffset2;\n\t"; } - str += "lwbInRe = gbInRe + iOffset;\n\t"; - str += "lwbInIm = gbInIm + iOffset;\n\t"; - } - } - - if (!params.fft_hasPostCallback) - { - if(outInterleaved || outReal) - { - if(!rcSimple) { str += "lwbOut2 = gbOut + oOffset2;\n\t"; } - str += "lwbOut = gbOut + oOffset;\n"; - } - else - { - - if(!rcSimple) { str += "lwbOutRe2 = gbOutRe + oOffset2;\n\t"; } - if(!rcSimple) { str += "lwbOutIm2 = gbOutIm + oOffset2;\n\t"; } - str += "lwbOutRe = gbOutRe + oOffset;\n\t"; - str += "lwbOutIm = gbOutIm + oOffset;\n"; - } - } - str += "\n"; - } - } - else - { - if(params.fft_placeness == CLFFT_INPLACE) - { - if(blockCompute) - str += OffsetCalcBlock("ioOffset", true); - else - str += OffsetCalc("ioOffset", true); - - str += "\t"; - - //Skip if callback is set - if (!params.fft_hasPreCallback || !params.fft_hasPostCallback) - { - if(inInterleaved) - { - str += "lwb = gb + ioOffset;\n"; - } - else - { - str += "lwbRe = gbRe + ioOffset;\n\t"; - str += "lwbIm = gbIm + ioOffset;\n"; - } - } - str += "\n"; - } - else - { - if(blockCompute) - { - str += OffsetCalcBlock("iOffset", true); - str += OffsetCalcBlock("oOffset", false); - } - else - { - str += OffsetCalc("iOffset", true); - str += OffsetCalc("oOffset", false); - } - - str += "\t"; - - //Skip if precallback is set - if (!(params.fft_hasPreCallback)) - { - if(inInterleaved) - { - str += "lwbIn = gbIn + iOffset;\n\t"; - } - else - { - str += "lwbInRe = gbInRe + iOffset;\n\t"; - str += "lwbInIm = gbInIm + iOffset;\n\t"; - } - } - - //Skip if postcallback is set - if (!params.fft_hasPostCallback) - { - if(outInterleaved) - { - str += "lwbOut = gbOut + oOffset;\n"; - } - else - { - str += "lwbOutRe = gbOutRe + oOffset;\n\t"; - str += "lwbOutIm = gbOutIm + oOffset;\n"; - } - } - str += "\n"; - } - } - - std::string inOffset; - std::string outOffset; - if (params.fft_placeness == CLFFT_INPLACE && !r2c2r) - { - inOffset += "ioOffset"; - outOffset += "ioOffset"; - } - else - { - inOffset += "iOffset"; - outOffset += "oOffset"; - } - - // Read data into LDS for blocked access - if(blockCompute) - { - - size_t loopCount = (length * blockWidth)/blockWGS; - - if ((blockComputeType == BCT_C2C) && params.fft_hasPreCallback) - { - str += "\n\t"; str += r2Type; str += " retCallback;"; - } - - str += "\n\tfor(uint t=0; t<"; str += SztToStr(loopCount); - str += "; t++)\n\t{\n"; - - //get offset - std::string bufOffset; - - for(size_t c=0; c<2; c++) - { - std::string comp = ""; - std::string readBuf = (params.fft_placeness == CLFFT_INPLACE) ? "lwb" : "lwbIn"; - if(!inInterleaved) comp = c ? ".y" : ".x"; - if(!inInterleaved) - readBuf = (params.fft_placeness == CLFFT_INPLACE) ? (c ? "lwbIm" : "lwbRe") : (c ? "lwbInIm" : "lwbInRe"); - - if( (blockComputeType == BCT_C2C) || (blockComputeType == BCT_C2R) ) - { - bufOffset.clear(); - bufOffset += "(me%"; bufOffset += SztToStr(blockWidth); bufOffset += ") + "; - bufOffset += "(me/"; bufOffset+= SztToStr(blockWidth); bufOffset+= ")*"; bufOffset += SztToStr(params.fft_inStride[0]); - bufOffset += " + t*"; bufOffset += SztToStr(params.fft_inStride[0]*blockWGS/blockWidth); - - if ((blockComputeType == BCT_C2C) && params.fft_hasPreCallback) - { - if (c == 0) - { - str += "\t\tretCallback = "; str += params.fft_preCallback.funcname; str += "("; - - if(inInterleaved) - { - str += (params.fft_placeness == CLFFT_INPLACE) ? "gb, " : "gbIn, "; - } - else - { - str += (params.fft_placeness == CLFFT_INPLACE) ? "gbRe, gbIm, " : "gbInRe, gbInIm, "; - } - - str += inOffset; str += " + "; str += bufOffset; str += ", pre_userdata"; - str += (params.fft_preCallback.localMemSize > 0) ? str += ", localmem);\n" : ");\n"; - } - - str += "\t\tR0"; str+= comp; str+= " = retCallback"; str+= comp; str += ";\n"; - } - else - { - str += "\t\tR0"; str+= comp; str+= " = "; - str += readBuf; str += "["; str += bufOffset; str += "];\n"; - } - } - else - { - str += "\t\tR0"; str+= comp; str+= " = "; str += readBuf; str += "[me + t*"; str += SztToStr(blockWGS); str += "];\n"; - } - - - if(inInterleaved) break; - } - - if( (blockComputeType == BCT_C2C) || (blockComputeType == BCT_C2R) ) - { - str += "\t\tlds[t*"; str += SztToStr(blockWGS/blockWidth); str += " + "; - str += "(me%"; str+= SztToStr(blockWidth); str+= ")*"; str += SztToStr(length); str += " + "; - str += "(me/"; str+= SztToStr(blockWidth); str+= ")] = R0;"; str +="\n"; - } - else - { - str += "\t\tlds[t*"; str += SztToStr(blockWGS); str += " + me] = R0;"; str +="\n"; - } - - str += "\t}\n\n"; - str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n\n"; - } - - - // Set rw and 'me' per transform - // rw string also contains 'b' - std::string rw, me; - - if(r2c2r && !rcSimple) rw = "rw, b, "; - else rw = ((numTrans > 1) || realSpecial) ? "rw, b, " : "1, b, "; - - if(numTrans > 1) { me += "me%"; me += SztToStr(workGroupSizePerTrans); me += ", "; } - else { me += "me, "; } - - if(blockCompute) { me = "me%"; me += SztToStr(workGroupSizePerTrans); me += ", "; } - - // Buffer strings - std::string inBuf, outBuf; - if(r2c2r) - { - if(rcSimple) - { - if(inInterleaved || inReal) inBuf = params.fft_hasPreCallback ? "gbIn, " : "lwbIn, "; - else inBuf = "lwbInRe, lwbInIm, "; - if(outInterleaved || outReal) outBuf = params.fft_hasPostCallback ? "gbOut" : "lwbOut"; - else outBuf = "lwbOutRe, lwbOutIm"; - } - else - { - if(inInterleaved || inReal) - { - if (!params.fft_hasPreCallback) - { - inBuf = "lwbIn, lwbIn2, "; - } - else - { - if (params.fft_placeness == CLFFT_INPLACE) - { - inBuf = "(__global "; inBuf += r2c ? rType : r2Type; inBuf += "*) gb, "; - inBuf += "(__global "; inBuf += r2c ? rType : r2Type; inBuf += "*) gb, "; - } - else - { - inBuf = "gbIn, gbIn, " ; - } - } - } - else inBuf = (params.fft_hasPreCallback) ? "gbInRe, gbInRe, gbInIm, gbInIm, " : "lwbInRe, lwbInRe2, lwbInIm, lwbInIm2, "; - - if(outInterleaved || outReal) outBuf = params.fft_hasPostCallback ? ((params.fft_placeness == CLFFT_INPLACE) ? "gb, gb" : "gbOut, gbOut") : "lwbOut, lwbOut2"; - else outBuf = params.fft_hasPostCallback ? "gbOutRe, gbOutRe, gbOutIm, gbOutIm" : "lwbOutRe, lwbOutRe2, lwbOutIm, lwbOutIm2"; - } - } - else - { - if(params.fft_placeness == CLFFT_INPLACE) - { - if(inInterleaved) - { - inBuf = params.fft_hasPreCallback ? "gb, " : "lwb, "; - outBuf = params.fft_hasPostCallback ? "gb" : "lwb"; - } - else - { - inBuf = params.fft_hasPreCallback ? "gbRe, gbIm, " : "lwbRe, lwbIm, "; - outBuf = params.fft_hasPostCallback ? "gbRe, gbIm" : "lwbRe, lwbIm"; - } - } - else - { - if(inInterleaved) inBuf = params.fft_hasPreCallback ? "gbIn, " : "lwbIn, "; - else inBuf = params.fft_hasPreCallback ? "gbInRe, gbInIm, " : "lwbInRe, lwbInIm, "; - if(outInterleaved) outBuf = params.fft_hasPostCallback ? "gbOut" : "lwbOut"; - else outBuf = params.fft_hasPostCallback ? "gbOutRe, gbOutIm" : "lwbOutRe, lwbOutIm"; - } - } - - - if(blockCompute) - { - str += "\n\tfor(uint t=0; t<"; str += SztToStr(blockWidth/(blockWGS/workGroupSizePerTrans)); - str += "; t++)\n\t{\n\n"; - - inBuf = "lds, "; - outBuf = "lds"; - - if(params.fft_3StepTwiddle) - { - str += "\t\tb = (batch%"; str += SztToStr(params.fft_N[1]/blockWidth); str += ")*"; - str += SztToStr(blockWidth); str += " + t*"; str += SztToStr(blockWGS/workGroupSizePerTrans); - str += " + (me/"; str += SztToStr(workGroupSizePerTrans); str += ");\n\n"; - } - } - - if(realSpecial) - { - str += "\n\tfor(uint t=0; t<2; t++)\n\t{\n\n"; - } - - // Call passes - if(numPasses == 1) - { - str += "\t"; - str += PassName(0, fwd); - str += "("; str += rw; str += me; - - str += (params.fft_hasPreCallback) ? inOffset : "0"; - - if (params.fft_hasPostCallback) - { - str += ", "; str += outOffset; str += ", "; - } - else - { - str += ", 0, "; - } - - str += inBuf; str += outBuf; - str += IterRegs("&"); - - //If callback is set - if (hasCallback) - { - //if pre-calback set - if (params.fft_hasPreCallback) - { - str += (r2c2r && !rcSimple) ? ", iOffset2, pre_userdata" : ", pre_userdata"; - } - - //if post-calback set - if (params.fft_hasPostCallback) - { - if ((r2c || c2r) && !rcSimple) { str += ", "; str += outOffset; str += "2"; } - - str += ", post_userdata"; - } - - if (params.fft_preCallback.localMemSize > 0) - { - str += ", localmem"; - } - if (params.fft_postCallback.localMemSize > 0) - { - //if precallback localmem also requested, send the localmem with the right offset - if (params.fft_hasPreCallback && params.fft_preCallback.localMemSize > 0) - { - str += ", ((__local char *)localmem + "; str += SztToStr(params.fft_preCallback.localMemSize); str += ")"; - } - else - { - str += ", localmem"; - } - } - } - - str += ");\n"; - } - else - { - for(typename std::vector >::const_iterator p = passes.begin(); p != passes.end(); p++) - { - std::string exTab = ""; - if(blockCompute || realSpecial) exTab = "\t"; - - str += exTab; - str += "\t"; - str += PassName(p->GetPosition(), fwd); - str += "("; - - std::string ldsOff; - if(blockCompute) - { - ldsOff += "t*"; ldsOff += SztToStr(length*(blockWGS/workGroupSizePerTrans)); ldsOff += " + (me/"; - ldsOff += SztToStr(workGroupSizePerTrans); ldsOff += ")*"; ldsOff += SztToStr(length); - } - else - { - if(numTrans > 1) - { - ldsOff += "(me/"; ldsOff += SztToStr(workGroupSizePerTrans); - ldsOff += ")*"; ldsOff += SztToStr(length); - } - else - { - ldsOff += "0"; - } - } - - std::string ldsArgs; - if(halfLds) { ldsArgs += "lds, lds"; } - else { if(ldsInterleaved) { ldsArgs += "lds"; } - else { ldsArgs += "lds, lds + "; ldsArgs += SztToStr(length*numTrans); } } - - str += rw; - if(params.fft_realSpecial) str += "t, "; - str += me; - if(p == passes.begin()) // beginning pass - { - if (blockCompute) - { - str += ldsOff; - } - else - { - str += (params.fft_hasPreCallback) ? inOffset : "0"; - } - str += ", "; - str += ldsOff; - str += ", "; - str += inBuf; - str += ldsArgs; str += IterRegs("&"); - - //if precalback set, append additional arguments - if (!blockCompute && params.fft_hasPreCallback) - { - str += (r2c2r && !rcSimple) ? ", iOffset2, pre_userdata" : ", pre_userdata"; - - if (params.fft_preCallback.localMemSize > 0) - { - str += ", localmem"; - } - } - - str += ");\n"; - if(!halfLds) { str += exTab; str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; } - } - else if((p+1) == passes.end()) // ending pass - { - str += ldsOff; - str += ", "; - if (blockCompute) - { - str += ldsOff; - } - else - { - str += (params.fft_hasPostCallback) ? outOffset : "0"; - } - str += ", "; - str += ldsArgs; str += ", "; - str += outBuf; - - str += IterRegs("&"); - - if (!blockCompute && params.fft_hasPostCallback) - { - if ((c2r || r2c) && !rcSimple) { str += ", "; str += outOffset; str += "2"; } - - str += ", post_userdata"; - - if (params.fft_postCallback.localMemSize > 0) - { - //if precallback localmem also requested, send the localmem with the right offset - if (params.fft_hasPreCallback && params.fft_preCallback.localMemSize > 0) - { - str += ", ((__local char *)localmem + "; str += SztToStr(params.fft_preCallback.localMemSize); str += ")"; - } - else - { - str += ", localmem"; - } - } - } - str += ");\n"; - - if (!halfLds) { str += exTab; str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; } - } - else // intermediate pass - { - str += ldsOff; - str += ", "; - str += ldsOff; - str += ", "; - str += ldsArgs; str += ", "; - str += ldsArgs; str += IterRegs("&"); str += ");\n"; - if(!halfLds) { str += exTab; str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; } - } - } - } - - if(realSpecial) - { - size_t Nt = 1 + length/2; - str += "\n\t\tif( (bt == 0) || (2*bt == "; - str += SztToStr(params.fft_realSpecial_Nr); str += ") ) { rw = 0; }\n"; - - str += "\t\tlwbOut += ("; str += SztToStr(params.fft_realSpecial_Nr); - str += " - 2*bt)*"; str += SztToStr(Nt); str += ";\n"; - str += "\t\tb = "; str += SztToStr(params.fft_realSpecial_Nr); - str += " - b;\n\n"; - } - - if(blockCompute || realSpecial) - { - str += "\n\t}\n\n"; - } - - - - // Write data from LDS for blocked access - if(blockCompute) - { - - size_t loopCount = (length * blockWidth)/blockWGS; - - str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n\n"; - str += "\n\tfor(uint t=0; t<"; str += SztToStr(loopCount); - str += "; t++)\n\t{\n"; - - if( (blockComputeType == BCT_C2C) || (blockComputeType == BCT_R2C) ) - { - str += "\t\tR0 = lds[t*"; str += SztToStr(blockWGS/blockWidth); str += " + "; - str += "(me%"; str+= SztToStr(blockWidth); str+= ")*"; str += SztToStr(length); str += " + "; - str += "(me/"; str+= SztToStr(blockWidth); str+= ")];"; str +="\n"; - } - else - { - str += "\t\tR0 = lds[t*"; str += SztToStr(blockWGS); str += " + me];"; str +="\n"; - } - - for(size_t c=0; c<2; c++) - { - std::string comp = ""; - std::string writeBuf = (params.fft_placeness == CLFFT_INPLACE) ? "lwb" : "lwbOut"; - if(!outInterleaved) comp = c ? ".y" : ".x"; - if(!outInterleaved) - writeBuf = (params.fft_placeness == CLFFT_INPLACE) ? (c ? "lwbIm" : "lwbRe") : (c ? "lwbOutIm" : "lwbOutRe"); - - if( (blockComputeType == BCT_C2C) || (blockComputeType == BCT_R2C) ) - { - if (blockComputeType == BCT_R2C && params.fft_hasPostCallback) - { - if (outInterleaved) - writeBuf = (params.fft_placeness == CLFFT_INPLACE) ? "gb" : "gbOut"; - else - writeBuf = (params.fft_placeness == CLFFT_INPLACE) ? "gbRe, gbIm" : "gbOutRe, gbOutIm"; - - str += "\t\t"; str += params.fft_postCallback.funcname; str += "("; str += writeBuf; str += ", ("; - str += outOffset; str += " + (me%"; str+= SztToStr(blockWidth); str += ") + "; - str += "(me/"; str+= SztToStr(blockWidth); str+= ")*"; str += SztToStr(params.fft_outStride[0]); - str += " + t*"; str += SztToStr(params.fft_outStride[0]*blockWGS/blockWidth); - str += "), post_userdata, R0"; - if (!outInterleaved) str += ".x, R0.y"; - - if (params.fft_postCallback.localMemSize > 0) - { - if (params.fft_hasPreCallback && params.fft_preCallback.localMemSize > 0) - { - str += ", (char *)(localmem + "; str += SztToStr(params.fft_preCallback.localMemSize); str += ")"; - } - else - { - str += ", localmem"; - } - } - str += ");\n"; - - //in the planar case, break from for loop since both real and imag components are handled - //together in post-callback - if (!outInterleaved) break; - } - else - { - str += "\t\t"; str += writeBuf; str += "[(me%"; str+= SztToStr(blockWidth); str += ") + "; - str += "(me/"; str+= SztToStr(blockWidth); str+= ")*"; str += SztToStr(params.fft_outStride[0]); - str += " + t*"; str += SztToStr(params.fft_outStride[0]*blockWGS/blockWidth); str += "] = R0"; str+= comp; str += ";\n"; - } - } - else - { - str += "\t\t"; str += writeBuf; str += "[me + t*"; str += SztToStr(blockWGS); str += "] = R0"; str+= comp; str += ";\n"; - } - - if(outInterleaved) break; - } - - str += "\t}\n\n"; - } - - - - str += "}\n\n"; - - if(r2c2r) - break; - } - } - }; -}; + passStr += ";\n\t}"; + + if (length > 1) { + passStr += "\n\n\tif(rw)\n\t{"; + if (fft_doPreCallback && !inInterleaved) { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, false, false, bufferInRe, bufferInIm, + "inOffset", passStr); + } else { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, false, false, bufferInRe, bufferInRe, + "inOffset", passStr); + } + passStr += "\n\t}\n"; + + passStr += "\n\tif(rw > 1)\n\t{"; + if (fft_doPreCallback) { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, true, false, bufferInRe2, bufferInIm2, + "inOffset2", passStr); + } else { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, true, false, bufferInIm2, bufferInIm2, + "inOffset", passStr); + } + + passStr += "\n\t}\n\telse\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, 1.0f, + true, true, false, bufferInIm2, bufferInIm2, "inOffset", + passStr); + passStr += "\n\t}\n"; + + if (oddp) { + passStr += "\n\tif(rw && (me%2))\n\t{"; + if (fft_doPreCallback) { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, false, true, bufferInRe, bufferInIm, + "inOffset", passStr); + } else { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, false, true, bufferInRe, bufferInRe, + "inOffset", passStr); + } + passStr += "\n\t}"; + passStr += "\n\tif((rw > 1) && (me%2))\n\t{"; + if (fft_doPreCallback) { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, true, true, bufferInRe2, bufferInIm2, + "inOffset2", passStr); + } else { + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, true, true, bufferInIm2, bufferInIm2, + "inOffset", passStr); + } + passStr += "\n\t}\n"; + } + + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_REAL, 1.0f, false, true, false, processBufRe, + processBufIm, processBufOffset, passStr); + if (oddp) { + passStr += "\n\tif(me%2)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_REAL, 1.0f, false, true, true, processBufRe, + processBufIm, processBufOffset, passStr); + passStr += "\n\t}\n"; + } + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_REAL, 1.0f, false, false, false, processBufRe, + processBufIm, processBufOffset, passStr); + if (oddp) { + passStr += "\n\tif(me%2)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_REAL, 1.0f, false, false, true, processBufRe, + processBufIm, processBufOffset, passStr); + passStr += "\n\t}\n"; + } + } -using namespace StockhamGenerator; + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + SweepRegs(SR_READ, fwd, outInterleaved, processBufStride, SR_COMP_REAL, + 1.0f, false, processBufRe, processBufIm, processBufOffset, 1, + numB1, 0, passStr, false, false, oddp); + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + + passStr += "\n\tif((rw > 1) && !me)\n\t{\n\t"; + passStr += processBufIm; + passStr += "["; + passStr += processBufOffset; + passStr += "] = "; + + if (fft_doPreCallback) { + passStr += fft_preCallback.funcname; + passStr += "("; + passStr += bufferInRe2; + if (!inInterleaved) { + passStr += ", "; + passStr += bufferInIm2; + } + passStr += ", inOffset2, pre_userdata"; + passStr += fft_preCallback.localMemSize > 0 ? ", localmem)" : ")"; + } else { + passStr += bufferInRe2; + passStr += "[inOffset]"; + } + if (inInterleaved || fft_doPreCallback) + passStr += ".x;\n\t}"; + else + passStr += ";\n\t}"; + passStr += "\n\tif((rw == 1) && !me)\n\t{\n\t"; + passStr += processBufIm; + passStr += "["; + passStr += processBufOffset; + passStr += "] = 0;\n\t}"; + + if (length > 1) { + if (!fft_doPreCallback) { + passStr += "\n\n\tif(rw)\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, false, false, bufferInIm, bufferInIm, + "inOffset", passStr); + passStr += "\n\t}\n"; + + passStr += "\n\tif(rw > 1)\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, true, false, bufferInRe2, bufferInRe2, + "inOffset", passStr); + passStr += "\n\t}\n\telse\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, true, true, false, bufferInRe2, bufferInRe2, + "inOffset", passStr); + passStr += "\n\t}"; + + if (oddp) { + passStr += "\n\tif(rw && (me%2))\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, false, true, bufferInIm, bufferInIm, + "inOffset", passStr); + passStr += "\n\t}"; + passStr += "\n\tif((rw > 1) && (me%2))\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, true, true, bufferInRe2, bufferInRe2, + "inOffset", passStr); + passStr += "\n\t}"; + } + } + passStr += "\n"; + + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_IMAG, 1.0f, false, true, false, processBufRe, + processBufIm, processBufOffset, passStr); + if (oddp) { + passStr += "\n\tif(me%2)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_IMAG, 1.0f, false, true, true, processBufRe, + processBufIm, processBufOffset, passStr); + passStr += "\n\t}\n"; + } + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_IMAG, 1.0f, false, false, false, processBufRe, + processBufIm, processBufOffset, passStr); + if (oddp) { + passStr += "\n\tif(me%2)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, processBufStride, + SR_COMP_IMAG, 1.0f, false, false, true, processBufRe, + processBufIm, processBufOffset, passStr); + passStr += "\n\t}\n"; + } + } + + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + SweepRegs(SR_READ, fwd, outInterleaved, processBufStride, SR_COMP_IMAG, + 1.0f, false, processBufRe, processBufIm, processBufOffset, 1, + numB1, 0, passStr); + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + } + } else { + if ((!halfLds) || (halfLds && (position == 0))) { + bool isPrecallVector = false; + // If precallback is set + if (fft_doPreCallback) { + passStr += "\n\t"; + passStr += regB2Type; + passStr += " retPrecallback"; + + if (numB4 > 0 || numB2 > 0) { + passStr += "["; + passStr += (numB4 > 0) ? "4" : (numB2 > 0) ? "2" : "1"; + passStr += "]"; + + isPrecallVector = true; + } + passStr += ";"; + } + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, + passStr, false, isPrecallVector); + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 2, numB2, numB1, + passStr, false, isPrecallVector); + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 4, numB4, + 2 * numB2 + numB1, passStr, false, isPrecallVector); + passStr += "\n\t}\n"; + passStr += "\n\telse\n\t{"; + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 1, numB1, 0, + passStr, true, isPrecallVector); + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 2, numB2, numB1, + passStr, true, isPrecallVector); + SweepRegs(SR_READ, fwd, inInterleaved, inStride, SR_COMP_BOTH, 1.0f, + false, bufferInRe, bufferInIm, "inOffset", 4, numB4, + 2 * numB2 + numB1, passStr, true, isPrecallVector); + passStr += "\n\t}\n"; + } + } -clfftStatus FFTGeneratedStockhamAction::initParams () -{ + passStr += "\n"; + + // 3-step twiddle multiplies done in the front + bool tw3Done = false; + if (fft_3StepTwiddle && twiddleFront) { + tw3Done = true; + if (linearRegs) { + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, + bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); + } else { + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, + bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, + bufferInRe, bufferInIm, "", 2, numB2, numB1, passStr); + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, true, + bufferInRe, bufferInIm, "", 4, numB4, 2 * numB2 + numB1, + passStr); + } + } - // Query the devices in this context for their local memory sizes - // How we generate a kernel depends on the *minimum* LDS size for all devices. - // - const FFTEnvelope * pEnvelope = NULL; - OPENCL_V(this->plan->GetEnvelope (& pEnvelope), _T("GetEnvelope failed")); - BUG_CHECK (NULL != pEnvelope); - - // Remainder: params was properly cleared by its constructor - // clearing it again would destroy datasize and id!! - this->signature.fft_precision = this->plan->precision; - this->signature.fft_placeness = this->plan->placeness; - this->signature.fft_inputLayout = this->plan->inputLayout; - this->signature.fft_MaxWorkGroupSize = this->plan->envelope.limit_WorkGroupSize; - this->signature.fft_offsetIn = this->plan->offsetIn; - this->signature.fft_offsetOut = this->plan->offsetOut; - - ARG_CHECK(this->plan->length.size() > 0); - ARG_CHECK(this->plan->inStride.size() > 0); - ARG_CHECK(this->plan->outStride.size() > 0); - - ARG_CHECK (this->plan->inStride.size() == this->plan->outStride.size()) - - bool real_transform = ((this->plan->inputLayout == CLFFT_REAL) || (this->plan->outputLayout == CLFFT_REAL)); - - if ( (CLFFT_INPLACE == this->plan->placeness) && (!real_transform) ) { - // If this is an in-place transform the - // input and output layout, dimensions and strides - // *MUST* be the same. - // - ARG_CHECK (this->plan->inputLayout == this->plan->outputLayout) - this->signature.fft_outputLayout = this->plan->inputLayout; - for (size_t u = this->plan->inStride.size(); u-- > 0; ) { - ARG_CHECK (this->plan->inStride[u] == this->plan->outStride[u]); + passStr += "\n"; + + // Twiddle multiply + if ((position > 0) && (radix > 1)) { + SweepRegs(SR_TWMUL, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, + bufferInIm, "", 1, numB1, 0, passStr); + SweepRegs(SR_TWMUL, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, + bufferInIm, "", 2, numB2, numB1, passStr); + SweepRegs(SR_TWMUL, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, bufferInRe, + bufferInIm, "", 4, numB4, 2 * numB2 + numB1, passStr); + } + + // Butterfly calls + if (radix > 1) { + if (numB1) + CallButterfly(ButterflyName(radix, 1, fwd), 1, numB1, passStr); + if (numB2) + CallButterfly(ButterflyName(radix, 2, fwd), 2, numB2, passStr); + if (numB4) + CallButterfly(ButterflyName(radix, 4, fwd), 4, numB4, passStr); + } + + if (!halfLds) + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + passStr += "\n\n"; + + // 3-step twiddle multiplies + if (fft_3StepTwiddle && !tw3Done) { + assert(nextPass == NULL); + if (linearRegs) { + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, + bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); + } else { + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, + bufferInRe, bufferInIm, "", 1, numB1, 0, passStr); + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, + bufferInRe, bufferInIm, "", 2, numB2, numB1, passStr); + SweepRegs(SR_TWMUL_3STEP, fwd, false, 1, SR_COMP_BOTH, 1.0f, false, + bufferInRe, bufferInIm, "", 4, numB4, 2 * numB2 + numB1, + passStr); + } + } + + // Write back from registers + if (halfLds) { + // In this case, we have to write & again read back for the next pass + // since we are using only half the lds. Number of barriers will increase + // at the cost of halving the lds. + + if (nextPass == nullptr) // last pass + { + if (r2c && !rcSimple) { + if (!singlePass) { + SweepRegs(SR_WRITE, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, + 0, passStr); + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, false, false, bufferInRe, bufferInIm, + "inOffset", passStr); + if (oddp) { + passStr += "\n\tif(me%2)\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_REAL, + 1.0f, false, false, true, bufferInRe, bufferInIm, + "inOffset", passStr); + passStr += "\n\t}\n"; + } + + passStr += "\n\tif(rw && !me)\n\t{\n\t"; + if (outInterleaved) { + if (fft_doPostCallback) { + passStr += fft_postCallback.funcname; + passStr += "(bufOut, outOffset, post_userdata, "; + passStr += "("; + passStr += RegBaseType(2); + passStr += ") ( ("; + passStr += bufferInRe; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ") , 0 )"; + if (fft_postCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");\n\t}"; + } else { + passStr += bufferOutRe; + passStr += "[outOffset].x = "; + passStr += bufferInRe; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ";\n\t"; + passStr += bufferOutIm; + passStr += "[outOffset].y = "; + passStr += "0;\n\t}"; + } + } else { + if (fft_doPostCallback) { + passStr += fft_postCallback.funcname; + passStr += "("; + passStr += bufferOutRe; + passStr += ", "; + passStr += bufferOutIm; + passStr += ", outOffset, post_userdata, "; + passStr += bufferInRe; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ", 0"; + if (fft_postCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");\n\t}"; + } else { + passStr += bufferOutRe; + passStr += "[outOffset] = "; + passStr += bufferInRe; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ";\n\t"; + passStr += bufferOutIm; + passStr += "[outOffset] = "; + passStr += "0;\n\t}"; + } + } + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + + SweepRegs(SR_WRITE, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, bufferInRe, bufferInIm, "inOffset", 1, numB1, + 0, passStr); + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, false, false, bufferInRe, bufferInIm, + "inOffset", passStr); + if (oddp) { + passStr += "\n\tif(me%2)\n\t{"; + SweepRegsRC(SR_READ, fwd, inInterleaved, inStride, SR_COMP_IMAG, + 1.0f, false, false, true, bufferInRe, bufferInIm, + "inOffset", passStr); + passStr += "\n\t}\n"; + } + + passStr += "\n\tif((rw > 1) && !me)\n\t{\n\t"; + if (outInterleaved) { + if (fft_doPostCallback) { + passStr += fft_postCallback.funcname; + passStr += "(bufOut2, outOffset2, post_userdata, "; + passStr += "("; + passStr += RegBaseType(2); + passStr += ") ( ("; + passStr += bufferInIm; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ") , 0 )"; + if (fft_postCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");\n\t}"; + } else { + passStr += bufferOutRe2; + passStr += "[outOffset].x = "; + passStr += bufferInIm; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ";\n\t"; + passStr += bufferOutIm2; + passStr += "[outOffset].y = "; + passStr += "0;\n\t}"; + } + } else { + if (fft_doPostCallback) { + passStr += fft_postCallback.funcname; + passStr += "("; + passStr += bufferOutRe2; + passStr += ", "; + passStr += bufferOutIm2; + passStr += ", outOffset2, post_userdata, "; + passStr += bufferInIm; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ", 0"; + if (fft_postCallback.localMemSize > 0) { + passStr += ", localmem"; + } + passStr += ");\n\t}"; + } else { + passStr += bufferOutRe2; + passStr += "[outOffset] = "; + passStr += bufferInIm; + passStr += "[inOffset]"; + if (scale != 1.0) { + passStr += " * "; + passStr += FloatToStr(scale); + passStr += FloatSuffix(); + } + passStr += ";\n\t"; + passStr += bufferOutIm2; + passStr += "[outOffset] = "; + passStr += "0;\n\t}"; + } + } + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + } + + passStr += "\n\n\tif(rw)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, + scale, false, false, false, bufferOutRe, bufferOutIm, + "outOffset", passStr); + passStr += "\n\t}\n"; + if (oddp) { + passStr += "\n\n\tbrv = ((rw != 0) & (me%2 == 1));\n\t"; + passStr += "if(brv)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, + scale, false, false, true, bufferOutRe, bufferOutIm, + "outOffset", passStr); + passStr += "\n\t}\n"; + } + + passStr += "\n\n\tif(rw > 1)\n\t{"; + + std::string outOffset; + outOffset += "outOffset"; + if (fft_doPostCallback) + outOffset += "2"; + + SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, + scale, false, true, false, bufferOutRe2, bufferOutIm2, + outOffset, passStr); + passStr += "\n\t}\n"; + if (oddp) { + passStr += "\n\n\tbrv = ((rw > 1) & (me%2 == 1));\n\t"; + passStr += "if(brv)\n\t{"; + SweepRegsRC(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, + scale, false, true, true, bufferOutRe2, bufferOutIm2, + outOffset, passStr); + passStr += "\n\t}\n"; + } + + } else if (c2r) { + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_REAL, + scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, + numB1, 0, passStr); + passStr += "\n\t}\n"; + + if (!rcSimple) { + std::string outOffset; + outOffset += "outOffset"; + if (fft_doPostCallback) + outOffset += "2"; + + passStr += "\n\tif(rw > 1)\n\t{"; + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_IMAG, + scale, false, bufferOutRe2, bufferOutIm2, outOffset, 1, + numB1, 0, passStr); + passStr += "\n\t}\n"; + } + } else { + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, + scale, false, bufferOutRe, bufferOutIm, "outOffset", 1, + numB1, 0, passStr); + passStr += "\n\t}\n"; } + } else { + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_REAL, scale, + false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, + passStr); + passStr += "\n\t}\n"; + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + passStr += "\n\tif(rw)\n\t{"; + nextPass->SweepRegs(SR_READ, fwd, outInterleaved, outStride, + SR_COMP_REAL, scale, false, bufferOutRe, + bufferOutIm, "outOffset", 1, nextPass->GetNumB1(), + 0, passStr); + passStr += "\n\t}\n"; + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_IMAG, scale, + false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, + passStr); + passStr += "\n\t}\n"; + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + passStr += "\n\tif(rw)\n\t{"; + nextPass->SweepRegs(SR_READ, fwd, outInterleaved, outStride, + SR_COMP_IMAG, scale, false, bufferOutRe, + bufferOutIm, "outOffset", 1, nextPass->GetNumB1(), + 0, passStr); + passStr += "\n\t}\n"; + passStr += "\n\n\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + } + } else { + if (fft_doPostCallback && outInterleaved) { + passStr += "\n\t"; + passStr += regB2Type; + passStr += " tempC;"; + } + passStr += "\n\tif(rw)\n\t{"; + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, + false, bufferOutRe, bufferOutIm, "outOffset", 1, numB1, 0, + passStr); + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, + false, bufferOutRe, bufferOutIm, "outOffset", 2, numB2, numB1, + passStr); + SweepRegs(SR_WRITE, fwd, outInterleaved, outStride, SR_COMP_BOTH, scale, + false, bufferOutRe, bufferOutIm, "outOffset", 4, numB4, + 2 * numB2 + numB1, passStr); + passStr += "\n\t}\n"; + } + + passStr += "\n}\n\n"; + } +}; + +// FFT kernel +template class Kernel { + size_t length; // Length of FFT + size_t workGroupSize; // Work group size + size_t cnPerWI; // complex numbers per work-item + + size_t offsetIn; + size_t offsetOut; + + size_t numTrans; // Number of transforms per work-group + size_t workGroupSizePerTrans; // Work group subdivision per transform + size_t numPasses; // Number of FFT passes + std::vector radices; // Base radix at each pass + std::vector> passes; // Array of pass objects + + bool halfLds; // LDS used to store one component (either real or imaginary) at + // a time for passing intermediate data between the passes, if + // this is set then each pass-function should accept same set of + // registers + + bool linearRegs; // scalar registers + + // Future optimization ideas + // bool limitRegs; // TODO: Incrementally write to LDS, + // thereby using same set of registers for more than 1 butterflies bool + // combineReadTwMul; // TODO: Combine reading into registers and + // Twiddle multiply + + bool r2c2r; // real to complex or complex to real transform + bool r2c, c2r; + bool rcFull; + bool rcSimple; + + bool blockCompute; // When we have to compute FFT in blocks (either read or + // write is along columns) + BlockComputeType blockComputeType; + size_t blockWidth, blockWGS, blockLDS; + + bool realSpecial; + + const FFTKernelGenKeyParams params; // key params + + inline std::string IterRegs(const std::string &pfx, bool initComma = true) { + std::string str = ""; + + if (linearRegs) { + if (initComma) + str += ", "; + + for (size_t i = 0; i < cnPerWI; i++) { + if (i != 0) + str += ", "; + str += pfx; + str += "R"; + str += SztToStr(i); + } + } + + return str; + } + + inline bool IsGroupedReadWritePossible() { + bool possible = true; + const size_t *iStride, *oStride; + + if (r2c2r) + return false; + + if (realSpecial) + return false; + + if (params.fft_placeness == CLFFT_INPLACE) { + iStride = oStride = params.fft_inStride; } else { - this->signature.fft_outputLayout = this->plan->outputLayout; + iStride = params.fft_inStride; + oStride = params.fft_outStride; } - this->signature.fft_DataDim = this->plan->length.size() + 1; - int i = 0; - for(i = 0; i < (this->signature.fft_DataDim - 1); i++) - { - this->signature.fft_N[i] = this->plan->length[i]; - this->signature.fft_inStride[i] = this->plan->inStride[i]; - this->signature.fft_outStride[i] = this->plan->outStride[i]; + for (size_t i = 1; i < params.fft_DataDim; i++) { + if (iStride[i] % 2) { + possible = false; + break; + } + if (oStride[i] % 2) { + possible = false; + break; + } + } + + return possible; + } + + inline std::string OffsetCalcBlock(const std::string &off, + bool input = true) { + std::string str; + + const size_t *pStride = input ? params.fft_inStride : params.fft_outStride; + + str += "\t"; + str += off; + str += " = "; + std::string nextBatch = "batch"; + for (size_t i = (params.fft_DataDim - 1); i > 2; i--) { + size_t currentLength = 1; + for (int j = 2; j < i; j++) + currentLength *= params.fft_N[j]; + currentLength *= (params.fft_N[1] / blockWidth); + + str += "("; + str += nextBatch; + str += "/"; + str += SztToStr(currentLength); + str += ")*"; + str += SztToStr(pStride[i]); + str += " + "; + + nextBatch = "(" + nextBatch + "%" + SztToStr(currentLength) + ")"; + } + + str += "("; + str += nextBatch; + str += "/"; + str += SztToStr(params.fft_N[1] / blockWidth); + str += ")*"; + str += SztToStr(pStride[2]); + str += " + ("; + str += nextBatch; + str += "%"; + str += SztToStr(params.fft_N[1] / blockWidth); + str += ")*"; + if ((input && (blockComputeType == BCT_R2C)) || + (!input && (blockComputeType == BCT_C2R))) + str += SztToStr(blockWidth * length); + else + str += SztToStr(blockWidth); + str += ";\n"; + + return str; + } + + inline std::string OffsetCalc(const std::string &off, bool input = true, + bool rc_second_index = false) { + std::string str; + + const size_t *pStride = input ? params.fft_inStride : params.fft_outStride; + + std::string batch; + if (r2c2r && !rcSimple) { + batch += "(batch*"; + batch += SztToStr(2 * numTrans); + if (rc_second_index) + batch += " + 1"; + else + batch += " + 0"; + + if (numTrans != 1) { + batch += " + 2*(me/"; + batch += SztToStr(workGroupSizePerTrans); + batch += "))"; + } else { + batch += ")"; + } + } else { + if (numTrans == 1) { + batch += "batch"; + } else { + batch += "(batch*"; + batch += SztToStr(numTrans); + batch += " + (me/"; + batch += SztToStr(workGroupSizePerTrans); + batch += "))"; + } + } + + str += "\t"; + str += off; + str += " = "; + + str += " "; + str += input ? "offsetIn" : "offsetOut"; + str += " + "; + + std::string nextBatch = batch; + for (size_t i = (params.fft_DataDim - 1); i > 1; i--) { + size_t currentLength = 1; + for (int j = 1; j < i; j++) + currentLength *= params.fft_N[j]; + + str += "("; + str += nextBatch; + str += "/"; + str += SztToStr(currentLength); + str += ")*"; + str += SztToStr(pStride[i]); + str += " + "; + + nextBatch = "(" + nextBatch + "%" + SztToStr(currentLength) + ")"; + } + + str += nextBatch; + str += "*"; + str += SztToStr(pStride[1]); + str += ";\n"; + + return str; + } + +public: + Kernel(const FFTKernelGenKeyParams ¶msVal) + : params(paramsVal), r2c2r(false) + + { + length = params.fft_N[0]; + + offsetIn = params.fft_offsetIn; + offsetIn = params.fft_offsetOut; + + workGroupSize = params.fft_SIMD; + numTrans = (workGroupSize * params.fft_R) / length; + + r2c = false; + c2r = false; + // Check if it is R2C or C2R transform + if (params.fft_inputLayout == CLFFT_REAL) + r2c = true; + if (params.fft_outputLayout == CLFFT_REAL) + c2r = true; + r2c2r = (r2c || c2r); + + if (r2c) { + rcFull = ((params.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) || + (params.fft_outputLayout == CLFFT_COMPLEX_PLANAR)) + ? true + : false; + } + if (c2r) { + rcFull = ((params.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) || + (params.fft_inputLayout == CLFFT_COMPLEX_PLANAR)) + ? true + : false; + } + + rcSimple = params.fft_RCsimple; + + halfLds = true; + linearRegs = true; + + realSpecial = params.fft_realSpecial; + + blockCompute = params.blockCompute; + blockComputeType = params.blockComputeType; + // Make sure we can utilize all Lds if we are going to + // use blocked columns to compute FFTs + if (blockCompute) { + assert(length <= 256); // 256 parameter comes from prototype experiments + // largest length at which block column possible + // given 32KB LDS limit if LDS limit is different + // this number need to be changed appropriately + halfLds = false; + linearRegs = true; + } + + assert(((length * numTrans) % workGroupSize) == 0); + cnPerWI = (numTrans * length) / workGroupSize; + workGroupSizePerTrans = workGroupSize / numTrans; + + // !!!! IMPORTANT !!!! Keep these assertions unchanged, algorithm depend on + // these to be true + assert((cnPerWI * workGroupSize) == (numTrans * length)); + assert(cnPerWI <= length); // Don't do more than 1 fft per work-item + + // Breakdown into passes + + size_t LS = 1; + size_t L; + size_t R = length; + size_t pid = 0; + + // See if we can get radices from the lookup table + const size_t *pRadices = nullptr; + size_t nPasses; + KernelCoreSpecs kcs; + kcs.GetRadices(length, nPasses, pRadices); + if ((params.fft_MaxWorkGroupSize >= 256) && (pRadices != nullptr)) { + for (size_t i = 0; i < nPasses; i++) { + size_t rad = pRadices[i]; + L = LS * rad; + R /= rad; + + radices.push_back(rad); + passes.push_back(Pass(i, length, rad, cnPerWI, L, LS, R, linearRegs, + halfLds, r2c, c2r, rcFull, rcSimple, + realSpecial)); + + // Pass precallback information to Pass object if its the first pass. + // This will be used in single kernel transforms + if (params.fft_hasPreCallback && i == 0 && !params.blockCompute) { + passes[0].SetPrecallback(params.fft_hasPreCallback, + params.fft_preCallback); + } + + // Pass post-callback information to Pass object if its the last pass. + // This will be used in single kernel transforms + if (params.fft_hasPostCallback && i == (nPasses - 1) && + !params.blockCompute) { + passes[i].SetPostcallback(params.fft_hasPostCallback, + params.fft_postCallback); + } + + LS *= rad; + } + assert( + R == + 1); // this has to be true for correct radix composition of the length + numPasses = nPasses; + } else { + // Possible radices + size_t cRad[] = {13, 11, 10, 8, 7, 6, + 5, 4, 3, 2, 1}; // Must be in descending order + size_t cRadSize = (sizeof(cRad) / sizeof(cRad[0])); + + // Generate the radix and pass objects + while (true) { + size_t rad; + + assert(cRadSize >= 1); + + // Picks the radices in descending order (biggest radix first) + for (size_t r = 0; r < cRadSize; r++) { + rad = cRad[r]; + + if ((rad > cnPerWI) || (cnPerWI % rad)) + continue; + + if (!(R % rad)) + break; + } - } - this->signature.fft_inStride[i] = this->plan->iDist; - this->signature.fft_outStride[i] = this->plan->oDist; + assert((cnPerWI % rad) == 0); + L = LS * rad; + R /= rad; - this->signature.fft_RCsimple = this->plan->RCsimple; + radices.push_back(rad); + passes.push_back(Pass(pid, length, rad, cnPerWI, L, LS, R, + linearRegs, halfLds, r2c, c2r, rcFull, + rcSimple, realSpecial)); - this->signature.fft_realSpecial = this->plan->realSpecial; - this->signature.fft_realSpecial_Nr = this->plan->realSpecial_Nr; + // Pass precallback information to Pass object if its the first pass. + // This will be used in single kernel transforms + if (pid == 0 && params.fft_hasPreCallback) { + passes[0].SetPrecallback(params.fft_hasPreCallback, + params.fft_preCallback); + } - this->signature.blockCompute = this->plan->blockCompute; - this->signature.blockComputeType = this->plan->blockComputeType; + pid++; + LS *= rad; + + assert(R >= 1); + if (R == 1) + break; + } + numPasses = pid; + + // Pass post-callback information to Pass object if its the last pass. + // This will be used in single kernel transforms + if (params.fft_hasPostCallback) { + passes[numPasses - 1].SetPostcallback(params.fft_hasPostCallback, + params.fft_postCallback); + } + } - this->signature.fft_twiddleFront = this->plan->twiddleFront; + assert(numPasses == passes.size()); + assert(numPasses == radices.size()); - size_t wgs, nt; #ifdef PARMETERS_TO_BE_READ - ParamRead pr; - ReadParameterFile(pr); - wgs = pr.workGroupSize; - nt = pr.numTransformsPerWg; -#else - size_t t_wgs, t_nt; - Precision pr = (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE; - switch(pr) - { - case P_SINGLE: - { - KernelCoreSpecs kcs; - kcs.GetWGSAndNT(this->signature.fft_N[0], t_wgs, t_nt); - if(this->signature.blockCompute) - { - this->signature.blockSIMD = Kernel::BlockSizes::BlockWorkGroupSize(this->signature.fft_N[0]); - this->signature.blockLDS = Kernel::BlockSizes::BlockLdsSize(this->signature.fft_N[0]); - } - } break; - case P_DOUBLE: - { - KernelCoreSpecs kcs; - kcs.GetWGSAndNT(this->signature.fft_N[0], t_wgs, t_nt); - if(this->signature.blockCompute) - { - this->signature.blockSIMD = Kernel::BlockSizes::BlockWorkGroupSize(this->signature.fft_N[0]); - this->signature.blockLDS = Kernel::BlockSizes::BlockLdsSize(this->signature.fft_N[0]); - } - } break; - } - - if((t_wgs != 0) && (t_nt != 0) && (this->plan->envelope.limit_WorkGroupSize >= 256)) - { - wgs = t_wgs; - nt = t_nt; - } - else - DetermineSizes(this->plan->envelope.limit_WorkGroupSize, this->signature.fft_N[0], wgs, nt, pr); + + ParamRead pr; + ReadParameterFile(pr); + + radices.clear(); + passes.clear(); + + radices = pr.radices; + numPasses = radices.size(); + + LS = 1; + R = length; + for (size_t i = 0; i < numPasses; i++) { + size_t rad = radices[i]; + L = LS * rad; + R /= rad; + + passes.push_back(Pass(i, length, rad, cnPerWI, L, LS, R, linearRegs)); + + LS *= rad; + } + assert(R == 1); #endif - assert((nt * this->signature.fft_N[0]) >= wgs); - assert((nt * this->signature.fft_N[0])%wgs == 0); - - this->signature.fft_R = (nt * this->signature.fft_N[0])/wgs; - this->signature.fft_SIMD = wgs; - - //Set pre-callback if specified - if (this->plan->hasPreCallback) - { - this->signature.fft_hasPreCallback = true; - this->signature.fft_preCallback = this->plan->preCallback; - } - - //Set post-callback if specified - if (this->plan->hasPostCallback) - { - this->signature.fft_hasPostCallback = true; - this->signature.fft_postCallback = this->plan->postCallbackParam; - } - this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; - - if (this->plan->large1D != 0) { - ARG_CHECK (this->signature.fft_N[0] != 0) - ARG_CHECK ((this->plan->large1D % this->signature.fft_N[0]) == 0) - this->signature.fft_3StepTwiddle = true; - if(!(this->plan->realSpecial)) - ARG_CHECK ( this->plan->large1D == (this->signature.fft_N[1] * this->signature.fft_N[0]) ); + // Grouping read/writes ok? + bool grp = IsGroupedReadWritePossible(); + for (size_t i = 0; i < numPasses; i++) + passes[i].SetGrouping(grp); + + // Store the next pass-object pointers + if (numPasses > 1) + for (size_t i = 0; i < (numPasses - 1); i++) + passes[i].SetNextPass(&passes[i + 1]); + + if (blockCompute) { + blockWidth = BlockSizes::BlockWidth(length); + blockWGS = BlockSizes::BlockWorkGroupSize(length); + blockLDS = BlockSizes::BlockLdsSize(length); + } else { + blockWidth = blockWGS = blockLDS = 0; } + } + + class BlockSizes { + public: + enum ValType { + BS_VT_WGS, + BS_VT_BWD, + BS_VT_LDS, + }; - this->signature.fft_fwdScale = this->plan->forwardScale; - this->signature.fft_backScale = this->plan->backwardScale; + static size_t BlockLdsSize(size_t N) { return GetValue(N, BS_VT_LDS); } + static size_t BlockWidth(size_t N) { return GetValue(N, BS_VT_BWD); } + static size_t BlockWorkGroupSize(size_t N) { + return GetValue(N, BS_VT_WGS); + } - return CLFFT_SUCCESS; -} + private: + static size_t GetValue(size_t N, ValType vt) { + size_t wgs; // preferred work group size + size_t bwd; // block width to be used + size_t lds; // LDS size to be used for the block + + KernelCoreSpecs kcs; + size_t t_wgs, t_nt; + kcs.GetWGSAndNT(N, t_wgs, t_nt); + + switch (N) { + case 256: + bwd = 8 / PrecisionWidth(); + wgs = (bwd > t_nt) ? 256 : t_wgs; + break; + case 128: + bwd = 8 / PrecisionWidth(); + wgs = (bwd > t_nt) ? 128 : t_wgs; + break; + case 64: + bwd = 16 / PrecisionWidth(); + wgs = (bwd > t_nt) ? 128 : t_wgs; + break; + case 32: + bwd = 32 / PrecisionWidth(); + wgs = (bwd > t_nt) ? 64 : t_wgs; + break; + case 16: + bwd = 64 / PrecisionWidth(); + wgs = (bwd > t_nt) ? 64 : t_wgs; + break; + case 8: + bwd = 128 / PrecisionWidth(); + wgs = (bwd > t_nt) ? 64 : t_wgs; + break; + default: + assert(false); + } + + // block width cannot be less than numTrans, math in other parts of code + // depend on this assumption + assert(bwd >= t_nt); + + lds = N * bwd; + + switch (vt) { + case BS_VT_WGS: + return wgs; + case BS_VT_BWD: + return bwd; + case BS_VT_LDS: + return lds; + default: + assert(false); + return 0; + } + } + }; + + void GenerateKernel(std::string &str, cl_device_id Dev_ID) { + std::string twType = RegBaseType(2); + std::string rType = RegBaseType(1); + std::string r2Type = RegBaseType(2); + + bool inInterleaved; // Input is interleaved format + bool outInterleaved; // Output is interleaved format + inInterleaved = ((params.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) || + (params.fft_inputLayout == CLFFT_HERMITIAN_INTERLEAVED)) + ? true + : false; + outInterleaved = ((params.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) || + (params.fft_outputLayout == CLFFT_HERMITIAN_INTERLEAVED)) + ? true + : false; + + // use interleaved LDS when halfLds constraint absent + bool ldsInterleaved = inInterleaved || outInterleaved; + ldsInterleaved = halfLds ? false : ldsInterleaved; + ldsInterleaved = blockCompute ? true : ldsInterleaved; + + bool inReal; // Input is real format + bool outReal; // Output is real format + inReal = (params.fft_inputLayout == CLFFT_REAL) ? true : false; + outReal = (params.fft_outputLayout == CLFFT_REAL) ? true : false; + + size_t large1D = 0; + if (params.fft_realSpecial) + large1D = params.fft_N[0] * params.fft_realSpecial_Nr; + else + large1D = params.fft_N[0] * params.fft_N[1]; + + // Pragma + str += ClPragma(); + + // Twiddle table + if (length > 1) { + TwiddleTable twTable(length); + + str += "\n__constant "; + str += twType; + str += " "; + str += TwTableName(); + str += "["; + str += SztToStr(length - 1); + str += "] = {\n"; + twTable.GenerateTwiddleTable(radices, str); + str += "};\n\n"; + } + str += "\n"; + + // twiddle factors for 1d-large 3-step algorithm + if (params.fft_3StepTwiddle) { + TwiddleTableLarge twLarge(large1D); + twLarge.GenerateTwiddleTable(str); + } -clfftStatus FFTGeneratedStockhamAction::getWorkSizes (std::vector & globalWS, std::vector & localWS) -{ - // How many complex numbers in the input mutl-dimensional array? + std::string sfx = FloatSuffix(); + + // Base type + str += "#define fptype "; + str += RegBaseType(1); + str += "\n\n"; + + // Vector type + str += "#define fvect2 "; + str += RegBaseType(2); + str += "\n\n"; + + bool cReg = linearRegs ? true : false; + + // Generate butterflies for all unique radices + std::list uradices; + for (unsigned long radice : radices) + uradices.push_back(radice); + + uradices.sort(); + uradices.unique(); + + // constants + if (length % 8 == 0) { + str += "#define C8Q 0.70710678118654752440084436210485"; + str += sfx; + str += "\n"; + } + + if (length % 5 == 0) { + str += "#define C5QA 0.30901699437494742410229341718282"; + str += sfx; + str += "\n"; + str += "#define C5QB 0.95105651629515357211643933337938"; + str += sfx; + str += "\n"; + str += "#define C5QC 0.50000000000000000000000000000000"; + str += sfx; + str += "\n"; + str += "#define C5QD 0.58778525229247312916870595463907"; + str += sfx; + str += "\n"; + str += "#define C5QE 0.80901699437494742410229341718282"; + str += sfx; + str += "\n"; + } + + if (length % 3 == 0) { + str += "#define C3QA 0.50000000000000000000000000000000"; + str += sfx; + str += "\n"; + str += "#define C3QB 0.86602540378443864676372317075294"; + str += sfx; + str += "\n"; + } + + if (length % 7 == 0) { + str += "#define C7Q1 -1.16666666666666651863693004997913"; + str += sfx; + str += "\n"; + str += "#define C7Q2 0.79015646852540022404554065360571"; + str += sfx; + str += "\n"; + str += "#define C7Q3 0.05585426728964774240049351305970"; + str += sfx; + str += "\n"; + str += "#define C7Q4 0.73430220123575240531721419756650"; + str += sfx; + str += "\n"; + str += "#define C7Q5 0.44095855184409837868031445395900"; + str += sfx; + str += "\n"; + str += "#define C7Q6 0.34087293062393136944265847887436"; + str += sfx; + str += "\n"; + str += "#define C7Q7 -0.53396936033772524066165487965918"; + str += sfx; + str += "\n"; + str += "#define C7Q8 0.87484229096165666561546458979137"; + str += sfx; + str += "\n"; + } + + if (length % 11 == 0) { + str += "#define b11_0 0.9898214418809327"; + str += sfx; + str += "\n"; + str += "#define b11_1 0.9594929736144973"; + str += sfx; + str += "\n"; + str += "#define b11_2 0.9189859472289947"; + str += sfx; + str += "\n"; + str += "#define b11_3 0.8767688310025893"; + str += sfx; + str += "\n"; + str += "#define b11_4 0.8308300260037728"; + str += sfx; + str += "\n"; + str += "#define b11_5 0.7784344533346518"; + str += sfx; + str += "\n"; + str += "#define b11_6 0.7153703234534297"; + str += sfx; + str += "\n"; + str += "#define b11_7 0.6343562706824244"; + str += sfx; + str += "\n"; + str += "#define b11_8 0.3425847256816375"; + str += sfx; + str += "\n"; + str += "#define b11_9 0.5211085581132027"; + str += sfx; + str += "\n"; + } + + if (length % 13 == 0) { + str += "#define b13_0 0.9682872443619840"; + str += sfx; + str += "\n"; + str += "#define b13_1 0.9578059925946651"; + str += sfx; + str += "\n"; + str += "#define b13_2 0.8755023024091479"; + str += sfx; + str += "\n"; + str += "#define b13_3 0.8660254037844386"; + str += sfx; + str += "\n"; + str += "#define b13_4 0.8595425350987748"; + str += sfx; + str += "\n"; + str += "#define b13_5 0.8534800018598239"; + str += sfx; + str += "\n"; + str += "#define b13_6 0.7693388175729806"; + str += sfx; + str += "\n"; + str += "#define b13_7 0.6865583707817543"; + str += sfx; + str += "\n"; + str += "#define b13_8 0.6122646503767565"; + str += sfx; + str += "\n"; + str += "#define b13_9 0.6004772719326652"; + str += sfx; + str += "\n"; + str += "#define b13_10 0.5817047785105157"; + str += sfx; + str += "\n"; + str += "#define b13_11 0.5751407294740031"; + str += sfx; + str += "\n"; + str += "#define b13_12 0.5220263851612750"; + str += sfx; + str += "\n"; + str += "#define b13_13 0.5200285718888646"; + str += sfx; + str += "\n"; + str += "#define b13_14 0.5165207806234897"; + str += sfx; + str += "\n"; + str += "#define b13_15 0.5149187780863157"; + str += sfx; + str += "\n"; + str += "#define b13_16 0.5035370328637666"; + str += sfx; + str += "\n"; + str += "#define b13_17 0.5000000000000000"; + str += sfx; + str += "\n"; + str += "#define b13_18 0.3027756377319946"; + str += sfx; + str += "\n"; + str += "#define b13_19 0.3014792600477098"; + str += sfx; + str += "\n"; + str += "#define b13_20 0.3004626062886657"; + str += sfx; + str += "\n"; + str += "#define b13_21 0.2517685164318833"; + str += sfx; + str += "\n"; + str += "#define b13_22 0.2261094450357824"; + str += sfx; + str += "\n"; + str += "#define b13_23 0.0833333333333333"; + str += sfx; + str += "\n"; + str += "#define b13_24 0.0386329546443481"; + str += sfx; + str += "\n"; + } + + str += "\n"; + + // If pre-callback is set for the plan + std::string callbackstr; + if (params.fft_hasPreCallback) { + // Insert pre-callback function code at the beginning + callbackstr += params.fft_preCallback.funcstring; + callbackstr += "\n\n"; + + str += callbackstr; + } + + // If post-callback is set for the plan + if (params.fft_hasPostCallback) { + // Insert post-callback function code + str += params.fft_postCallback.funcstring; + str += "\n\n"; + } + + typename std::vector>::const_iterator p; + if (length > 1) { + for (std::list::const_iterator r = uradices.begin(); + r != uradices.end(); r++) { + size_t rad = *r; + p = passes.begin(); + while (p->GetRadix() != rad) + p++; + + for (size_t d = 0; d < 2; d++) { + bool fwd = d ? false : true; + + if (p->GetNumB1()) { + Butterfly bfly(rad, 1, fwd, cReg); + bfly.GenerateButterfly(str); + str += "\n"; + } + if (p->GetNumB2()) { + Butterfly bfly(rad, 2, fwd, cReg); + bfly.GenerateButterfly(str); + str += "\n"; + } + if (p->GetNumB4()) { + Butterfly bfly(rad, 4, fwd, cReg); + bfly.GenerateButterfly(str); + str += "\n"; + } + } + } + } + + // Generate passes + for (size_t d = 0; d < 2; d++) { + bool fwd; + + if (r2c2r) { + fwd = r2c; + } else { + fwd = d ? false : true; + } + + double scale = fwd ? params.fft_fwdScale : params.fft_backScale; + + for (p = passes.begin(); p != passes.end(); p++) { + double s = 1.0; + size_t ins = 1, outs = 1; + bool gIn = false, gOut = false; + bool inIlvd = false, outIlvd = false; + bool inRl = false, outRl = false; + bool tw3Step = false; + + if (p == passes.begin() && params.fft_twiddleFront) { + tw3Step = params.fft_3StepTwiddle; + } + if ((p + 1) == passes.end()) { + s = scale; + if (!params.fft_twiddleFront) + tw3Step = params.fft_3StepTwiddle; + } + + if (blockCompute && !r2c2r) { + inIlvd = ldsInterleaved; + outIlvd = ldsInterleaved; + } else { + if (p == passes.begin()) { + inIlvd = inInterleaved; + inRl = inReal; + gIn = true; + ins = params.fft_inStride[0]; + } + if ((p + 1) == passes.end()) { + outIlvd = outInterleaved; + outRl = outReal; + gOut = true; + outs = params.fft_outStride[0]; + } + + if (p != passes.begin()) { + inIlvd = ldsInterleaved; + } + if ((p + 1) != passes.end()) { + outIlvd = ldsInterleaved; + } + } + + p->GeneratePass(fwd, str, tw3Step, params.fft_twiddleFront, inIlvd, + outIlvd, inRl, outRl, ins, outs, s, gIn, gOut); + } + + // if real transform we do only 1 direction + if (r2c2r) + break; + } + + // TODO : address this kludge + str += " typedef union { uint u; int i; } cb_t;\n\n"; + + for (size_t d = 0; d < 2; d++) { + bool fwd; + + if (r2c2r) { + fwd = inReal ? true : false; + } else { + fwd = d ? false : true; + } + + // FFT kernel begin + // Function attribute + str += "__kernel __attribute__((reqd_work_group_size ("; + if (blockCompute) + str += SztToStr(blockWGS); + else + str += SztToStr(workGroupSize); + str += ",1,1)))\nvoid "; + + // Function name + if (fwd) + str += "fft_fwd"; + else + str += "fft_back"; + str += "("; + + // TODO : address this kludge + size_t SizeParam_ret = 0; + clGetDeviceInfo(Dev_ID, CL_DEVICE_VENDOR, 0, nullptr, &SizeParam_ret); + char *nameVendor = new char[SizeParam_ret]; + clGetDeviceInfo(Dev_ID, CL_DEVICE_VENDOR, SizeParam_ret, nameVendor, + nullptr); + + // nv compiler doesn't support __constant kernel argument + // TODO : works with CUDA 10.0, so might not be true anymore + if (strncmp(nameVendor, "NVIDIA", 6) != 0) + str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; + else + str += "__global cb_t *cb, "; + // str += "__constant cb_t *cb __attribute__((max_constant_size(32))), "; + delete[] nameVendor; + + // If plan has pre/post callback + callbackstr.clear(); + bool hasCallback = + params.fft_hasPreCallback || params.fft_hasPostCallback; + + if (hasCallback) { + if (params.fft_hasPreCallback) { + callbackstr += ", __global void* pre_userdata"; + } + if (params.fft_hasPostCallback) { + callbackstr += ", __global void* post_userdata"; + } + + if (params.fft_preCallback.localMemSize > 0 || + params.fft_postCallback.localMemSize > 0) { + callbackstr += ", __local void* localmem"; + } + } + // Function attributes + if (params.fft_placeness == CLFFT_INPLACE) { + if (r2c2r) { + if (outInterleaved) { + str += "__global "; + str += r2Type; + str += " * restrict gb"; + } else { + str += "__global "; + str += rType; + str += " * restrict gb"; + } + } else { + assert(inInterleaved == outInterleaved); + assert(params.fft_inStride[1] == params.fft_outStride[1]); + assert(params.fft_inStride[0] == params.fft_outStride[0]); + + if (inInterleaved) { + str += "__global "; + str += r2Type; + str += " * restrict gb"; + } else { + str += "__global "; + str += rType; + str += " * restrict gbRe, "; + str += "__global "; + str += rType; + str += " * restrict gbIm"; + } + } + } else { + if (r2c2r) { + if (inInterleaved) { + str += "__global "; + str += r2Type; + str += " * restrict gbIn, "; + } else if (inReal) { + str += "__global "; + str += rType; + str += " * restrict gbIn, "; + } else { + str += "__global const "; + str += rType; + str += " * restrict gbInRe, "; + str += "__global const "; + str += rType; + str += " * restrict gbInIm, "; + } + + if (outInterleaved) { + str += "__global "; + str += r2Type; + str += " * restrict gbOut"; + } else if (outReal) { + str += "__global "; + str += rType; + str += " * restrict gbOut"; + } else { + str += "__global "; + str += rType; + str += " * restrict gbOutRe, "; + str += "__global "; + str += rType; + str += " * restrict gbOutIm"; + } + } else { + if (inInterleaved) { + str += "__global const "; + str += r2Type; + str += " * restrict gbIn, "; + } else { + str += "__global const "; + str += rType; + str += " * restrict gbInRe, "; + str += "__global const "; + str += rType; + str += " * restrict gbInIm, "; + } + + if (outInterleaved) { + str += "__global "; + str += r2Type; + str += " * restrict gbOut"; + } else { + str += "__global "; + str += rType; + str += " * restrict gbOutRe, "; + str += "__global "; + str += rType; + str += " * restrict gbOutIm"; + } + } + } + + // If plan has callback + if (hasCallback) { + str += callbackstr; + } + str += ", const int offsetIn, const int offsetOut "; + str += ")\n"; + + str += "{\n"; + + // Initialize + str += "\t"; + str += "uint me = get_local_id(0);\n\t"; + str += "uint batch = get_group_id(0);"; + str += "\n"; + + // Allocate LDS + if (blockCompute) { + str += "\n\t"; + str += "__local "; + str += r2Type; + str += " lds["; + str += SztToStr(blockLDS); + str += "];\n"; + } else { + size_t ldsSize = halfLds ? length * numTrans : 2 * length * numTrans; + ldsSize = ldsInterleaved ? ldsSize / 2 : ldsSize; + + if (numPasses > 1) { + str += "\n\t"; + str += "__local "; + str += ldsInterleaved ? r2Type : rType; + str += " lds["; + str += SztToStr(ldsSize); + str += "];\n"; + } + } + + // Declare memory pointers + str += "\n\t"; + if (r2c2r) { + str += "uint iOffset;\n\t"; + str += "uint oOffset;\n\n\t"; + if (!rcSimple) { + str += "uint iOffset2;\n\t"; + str += "uint oOffset2;\n\n\t"; + } + + if (!params.fft_hasPreCallback) { + if (inInterleaved) { + if (!rcSimple) { + str += "__global "; + str += r2Type; + str += " *lwbIn2;\n\t"; + } + str += "__global "; + str += r2Type; + str += " *lwbIn;\n\t"; + } else if (inReal) { + if (!rcSimple) { + str += "__global "; + str += rType; + str += " *lwbIn2;\n\t"; + } + str += "__global "; + str += rType; + str += " *lwbIn;\n\t"; + + } else { + if (!rcSimple) { + str += "__global "; + str += rType; + str += " *lwbInRe2;\n\t"; + } + if (!rcSimple) { + str += "__global "; + str += rType; + str += " *lwbInIm2;\n\t"; + } + + str += "__global "; + str += rType; + str += " *lwbInRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbInIm;\n\t"; + } + } + + if (outInterleaved) { + if (!params.fft_hasPostCallback) { + if (!rcSimple) { + str += "__global "; + str += r2Type; + str += " *lwbOut2;\n\t"; + } + str += "__global "; + str += r2Type; + str += " *lwbOut;\n"; + } + } else if (outReal) { + if (!params.fft_hasPostCallback) { + if (!rcSimple) { + str += "__global "; + str += rType; + str += " *lwbOut2;\n\t"; + } + str += "__global "; + str += rType; + str += " *lwbOut;\n"; + } + } else { + if (!params.fft_hasPostCallback) { + if (!rcSimple) { + str += "__global "; + str += rType; + str += " *lwbOutRe2;\n\t"; + } + if (!rcSimple) { + str += "__global "; + str += rType; + str += " *lwbOutIm2;\n\t"; + } + str += "__global "; + str += rType; + str += " *lwbOutRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbOutIm;\n"; + } + } + str += "\n"; + } else { + if (params.fft_placeness == CLFFT_INPLACE) { + str += "uint ioOffset;\n\t"; + + // Skip if callback is set + if (!params.fft_hasPreCallback || !params.fft_hasPostCallback) { + if (inInterleaved) { + str += "__global "; + str += r2Type; + str += " *lwb;\n"; + } else { + str += "__global "; + str += rType; + str += " *lwbRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbIm;\n"; + } + } + str += "\n"; + } else { + str += "uint iOffset;\n\t"; + str += "uint oOffset;\n\t"; + + // Skip if precallback is set + if (!(params.fft_hasPreCallback)) { + if (inInterleaved) { + str += "__global "; + str += r2Type; + str += " *lwbIn;\n\t"; + } else { + str += "__global "; + str += rType; + str += " *lwbInRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbInIm;\n\t"; + } + } + + // Skip if postcallback is set + if (!params.fft_hasPostCallback) { + if (outInterleaved) { + str += "__global "; + str += r2Type; + str += " *lwbOut;\n"; + } else { + str += "__global "; + str += rType; + str += " *lwbOutRe;\n\t"; + str += "__global "; + str += rType; + str += " *lwbOutIm;\n"; + } + } + str += "\n"; + } + } + + // Setup registers if needed + if (linearRegs) { + str += "\t"; + str += RegBaseType(2); + str += " "; + str += IterRegs("", false); + str += ";\n\n"; + } + + // Calculate total transform count + std::string totalBatch = "("; + size_t i = 0; + while (i < (params.fft_DataDim - 2)) { + totalBatch += SztToStr(params.fft_N[i + 1]); + totalBatch += " * "; + i++; + } + totalBatch += "cb[0].u)"; + + // Conditional read-write ('rw') for arbitrary batch number + if (r2c2r && !rcSimple) { + str += "\tuint this = "; + str += totalBatch; + str += " - batch*"; + str += SztToStr(2 * numTrans); + str += ";\n"; + str += "\tuint rw = (me < ((this+1)/2)*"; + str += SztToStr(workGroupSizePerTrans); + str += ") ? (this - 2*(me/"; + str += SztToStr(workGroupSizePerTrans); + str += ")) : 0;\n\n"; + } else { + if ((numTrans > 1) && !blockCompute) { + str += "\tuint rw = (me < ("; + str += totalBatch; + str += " - batch*"; + str += SztToStr(numTrans); + str += ")*"; + str += SztToStr(workGroupSizePerTrans); + str += ") ? 1 : 0;\n\n"; + } else { + str += "\tuint rw = 1;\n\n"; + } + } + + // Transform index for 3-step twiddles + if (params.fft_3StepTwiddle && !blockCompute) { + if (numTrans == 1) { + str += "\tuint b = batch%"; + } else { + str += "\tuint b = (batch*"; + str += SztToStr(numTrans); + str += " + (me/"; + str += SztToStr(workGroupSizePerTrans); + str += "))%"; + } + + str += SztToStr(params.fft_N[1]); + str += ";\n\n"; + + if (params.fft_realSpecial) { + str += "\tuint bt = b;\n\n"; + } + } else { + str += "\tuint b = 0;\n\n"; + } + + // Setup memory pointers + if (r2c2r) { + str += OffsetCalc("iOffset", true); + str += OffsetCalc("oOffset", false); + if (!rcSimple) { + str += OffsetCalc("iOffset2", true, true); + } + if (!rcSimple) { + str += OffsetCalc("oOffset2", false, true); + } + + str += "\n\t"; + if (params.fft_placeness == CLFFT_INPLACE) { + if (!params.fft_hasPreCallback) { + if (inInterleaved) { + if (!rcSimple) { + str += "lwbIn2 = (__global "; + str += r2Type; + str += " *)gb + iOffset2;\n\t"; + } + str += "lwbIn = (__global "; + str += r2Type; + str += " *)gb + iOffset;\n\t"; + } else { + if (!rcSimple) { + str += "lwbIn2 = (__global "; + str += rType; + str += " *)gb + iOffset2;\n\t"; + } + str += "lwbIn = (__global "; + str += rType; + str += " *)gb + iOffset;\n\t"; + } + } + + if (!params.fft_hasPostCallback) { + if (!rcSimple) { + str += "lwbOut2 = gb + oOffset2;\n\t"; + } + str += "lwbOut = gb + oOffset;\n"; + } + str += "\n"; + } else { + if (!params.fft_hasPreCallback) { + if (inInterleaved || inReal) { + if (!rcSimple) { + str += "lwbIn2 = gbIn + iOffset2;\n\t"; + } + str += "lwbIn = gbIn + iOffset;\n\t"; + } else { + if (!rcSimple) { + str += "lwbInRe2 = gbInRe + iOffset2;\n\t"; + } + if (!rcSimple) { + str += "lwbInIm2 = gbInIm + iOffset2;\n\t"; + } + str += "lwbInRe = gbInRe + iOffset;\n\t"; + str += "lwbInIm = gbInIm + iOffset;\n\t"; + } + } + + if (!params.fft_hasPostCallback) { + if (outInterleaved || outReal) { + if (!rcSimple) { + str += "lwbOut2 = gbOut + oOffset2;\n\t"; + } + str += "lwbOut = gbOut + oOffset;\n"; + } else { + + if (!rcSimple) { + str += "lwbOutRe2 = gbOutRe + oOffset2;\n\t"; + } + if (!rcSimple) { + str += "lwbOutIm2 = gbOutIm + oOffset2;\n\t"; + } + str += "lwbOutRe = gbOutRe + oOffset;\n\t"; + str += "lwbOutIm = gbOutIm + oOffset;\n"; + } + } + str += "\n"; + } + } else { + if (params.fft_placeness == CLFFT_INPLACE) { + if (blockCompute) + str += OffsetCalcBlock("ioOffset", true); + else + str += OffsetCalc("ioOffset", true); + + str += "\t"; + + // Skip if callback is set + if (!params.fft_hasPreCallback || !params.fft_hasPostCallback) { + if (inInterleaved) { + str += "lwb = gb + ioOffset;\n"; + } else { + str += "lwbRe = gbRe + ioOffset;\n\t"; + str += "lwbIm = gbIm + ioOffset;\n"; + } + } + str += "\n"; + } else { + if (blockCompute) { + str += OffsetCalcBlock("iOffset", true); + str += OffsetCalcBlock("oOffset", false); + } else { + str += OffsetCalc("iOffset", true); + str += OffsetCalc("oOffset", false); + } + + str += "\t"; + + // Skip if precallback is set + if (!(params.fft_hasPreCallback)) { + if (inInterleaved) { + str += "lwbIn = gbIn + iOffset;\n\t"; + } else { + str += "lwbInRe = gbInRe + iOffset;\n\t"; + str += "lwbInIm = gbInIm + iOffset;\n\t"; + } + } + + // Skip if postcallback is set + if (!params.fft_hasPostCallback) { + if (outInterleaved) { + str += "lwbOut = gbOut + oOffset;\n"; + } else { + str += "lwbOutRe = gbOutRe + oOffset;\n\t"; + str += "lwbOutIm = gbOutIm + oOffset;\n"; + } + } + str += "\n"; + } + } + + std::string inOffset; + std::string outOffset; + if (params.fft_placeness == CLFFT_INPLACE && !r2c2r) { + inOffset += "ioOffset"; + outOffset += "ioOffset"; + } else { + inOffset += "iOffset"; + outOffset += "oOffset"; + } + + // Read data into LDS for blocked access + if (blockCompute) { + + size_t loopCount = (length * blockWidth) / blockWGS; + + if ((blockComputeType == BCT_C2C) && params.fft_hasPreCallback) { + str += "\n\t"; + str += r2Type; + str += " retCallback;"; + } + + str += "\n\tfor(uint t=0; t<"; + str += SztToStr(loopCount); + str += "; t++)\n\t{\n"; + + // get offset + std::string bufOffset; + + for (size_t c = 0; c < 2; c++) { + std::string comp = ""; + std::string readBuf = + (params.fft_placeness == CLFFT_INPLACE) ? "lwb" : "lwbIn"; + if (!inInterleaved) + comp = c ? ".y" : ".x"; + if (!inInterleaved) + readBuf = (params.fft_placeness == CLFFT_INPLACE) + ? (c ? "lwbIm" : "lwbRe") + : (c ? "lwbInIm" : "lwbInRe"); + + if ((blockComputeType == BCT_C2C) || (blockComputeType == BCT_C2R)) { + bufOffset.clear(); + bufOffset += "(me%"; + bufOffset += SztToStr(blockWidth); + bufOffset += ") + "; + bufOffset += "(me/"; + bufOffset += SztToStr(blockWidth); + bufOffset += ")*"; + bufOffset += SztToStr(params.fft_inStride[0]); + bufOffset += " + t*"; + bufOffset += + SztToStr(params.fft_inStride[0] * blockWGS / blockWidth); + + if ((blockComputeType == BCT_C2C) && params.fft_hasPreCallback) { + if (c == 0) { + str += "\t\tretCallback = "; + str += params.fft_preCallback.funcname; + str += "("; + + if (inInterleaved) { + str += (params.fft_placeness == CLFFT_INPLACE) ? "gb, " + : "gbIn, "; + } else { + str += (params.fft_placeness == CLFFT_INPLACE) + ? "gbRe, gbIm, " + : "gbInRe, gbInIm, "; + } + + str += inOffset; + str += " + "; + str += bufOffset; + str += ", pre_userdata"; + str += (params.fft_preCallback.localMemSize > 0) + ? str += ", localmem);\n" + : ");\n"; + } + + str += "\t\tR0"; + str += comp; + str += " = retCallback"; + str += comp; + str += ";\n"; + } else { + str += "\t\tR0"; + str += comp; + str += " = "; + str += readBuf; + str += "["; + str += bufOffset; + str += "];\n"; + } + } else { + str += "\t\tR0"; + str += comp; + str += " = "; + str += readBuf; + str += "[me + t*"; + str += SztToStr(blockWGS); + str += "];\n"; + } + + if (inInterleaved) + break; + } + + if ((blockComputeType == BCT_C2C) || (blockComputeType == BCT_C2R)) { + str += "\t\tlds[t*"; + str += SztToStr(blockWGS / blockWidth); + str += " + "; + str += "(me%"; + str += SztToStr(blockWidth); + str += ")*"; + str += SztToStr(length); + str += " + "; + str += "(me/"; + str += SztToStr(blockWidth); + str += ")] = R0;"; + str += "\n"; + } else { + str += "\t\tlds[t*"; + str += SztToStr(blockWGS); + str += " + me] = R0;"; + str += "\n"; + } + + str += "\t}\n\n"; + str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n\n"; + } + + // Set rw and 'me' per transform + // rw string also contains 'b' + std::string rw, me; + + if (r2c2r && !rcSimple) + rw = "rw, b, "; + else + rw = ((numTrans > 1) || realSpecial) ? "rw, b, " : "1, b, "; + + if (numTrans > 1) { + me += "me%"; + me += SztToStr(workGroupSizePerTrans); + me += ", "; + } else { + me += "me, "; + } + + if (blockCompute) { + me = "me%"; + me += SztToStr(workGroupSizePerTrans); + me += ", "; + } + + // Buffer strings + std::string inBuf, outBuf; + if (r2c2r) { + if (rcSimple) { + if (inInterleaved || inReal) + inBuf = params.fft_hasPreCallback ? "gbIn, " : "lwbIn, "; + else + inBuf = "lwbInRe, lwbInIm, "; + if (outInterleaved || outReal) + outBuf = params.fft_hasPostCallback ? "gbOut" : "lwbOut"; + else + outBuf = "lwbOutRe, lwbOutIm"; + } else { + if (inInterleaved || inReal) { + if (!params.fft_hasPreCallback) { + inBuf = "lwbIn, lwbIn2, "; + } else { + if (params.fft_placeness == CLFFT_INPLACE) { + inBuf = "(__global "; + inBuf += r2c ? rType : r2Type; + inBuf += "*) gb, "; + inBuf += "(__global "; + inBuf += r2c ? rType : r2Type; + inBuf += "*) gb, "; + } else { + inBuf = "gbIn, gbIn, "; + } + } + } else + inBuf = (params.fft_hasPreCallback) + ? "gbInRe, gbInRe, gbInIm, gbInIm, " + : "lwbInRe, lwbInRe2, lwbInIm, lwbInIm2, "; + + if (outInterleaved || outReal) + outBuf = + params.fft_hasPostCallback + ? ((params.fft_placeness == CLFFT_INPLACE) ? "gb, gb" + : "gbOut, gbOut") + : "lwbOut, lwbOut2"; + else + outBuf = params.fft_hasPostCallback + ? "gbOutRe, gbOutRe, gbOutIm, gbOutIm" + : "lwbOutRe, lwbOutRe2, lwbOutIm, lwbOutIm2"; + } + } else { + if (params.fft_placeness == CLFFT_INPLACE) { + if (inInterleaved) { + inBuf = params.fft_hasPreCallback ? "gb, " : "lwb, "; + outBuf = params.fft_hasPostCallback ? "gb" : "lwb"; + } else { + inBuf = + params.fft_hasPreCallback ? "gbRe, gbIm, " : "lwbRe, lwbIm, "; + outBuf = params.fft_hasPostCallback ? "gbRe, gbIm" : "lwbRe, lwbIm"; + } + } else { + if (inInterleaved) + inBuf = params.fft_hasPreCallback ? "gbIn, " : "lwbIn, "; + else + inBuf = params.fft_hasPreCallback ? "gbInRe, gbInIm, " + : "lwbInRe, lwbInIm, "; + if (outInterleaved) + outBuf = params.fft_hasPostCallback ? "gbOut" : "lwbOut"; + else + outBuf = params.fft_hasPostCallback ? "gbOutRe, gbOutIm" + : "lwbOutRe, lwbOutIm"; + } + } + + if (blockCompute) { + str += "\n\tfor(uint t=0; t<"; + str += SztToStr(blockWidth / (blockWGS / workGroupSizePerTrans)); + str += "; t++)\n\t{\n\n"; + + inBuf = "lds, "; + outBuf = "lds"; + + if (params.fft_3StepTwiddle) { + str += "\t\tb = (batch%"; + str += SztToStr(params.fft_N[1] / blockWidth); + str += ")*"; + str += SztToStr(blockWidth); + str += " + t*"; + str += SztToStr(blockWGS / workGroupSizePerTrans); + str += " + (me/"; + str += SztToStr(workGroupSizePerTrans); + str += ");\n\n"; + } + } + + if (realSpecial) { + str += "\n\tfor(uint t=0; t<2; t++)\n\t{\n\n"; + } + + // Call passes + if (numPasses == 1) { + str += "\t"; + str += PassName(0, fwd); + str += "("; + str += rw; + str += me; + + str += (params.fft_hasPreCallback) ? inOffset : "0"; + + if (params.fft_hasPostCallback) { + str += ", "; + str += outOffset; + str += ", "; + } else { + str += ", 0, "; + } + + str += inBuf; + str += outBuf; + str += IterRegs("&"); + + // If callback is set + if (hasCallback) { + // if pre-calback set + if (params.fft_hasPreCallback) { + str += (r2c2r && !rcSimple) ? ", iOffset2, pre_userdata" + : ", pre_userdata"; + } + + // if post-calback set + if (params.fft_hasPostCallback) { + if ((r2c || c2r) && !rcSimple) { + str += ", "; + str += outOffset; + str += "2"; + } + + str += ", post_userdata"; + } + + if (params.fft_preCallback.localMemSize > 0) { + str += ", localmem"; + } + if (params.fft_postCallback.localMemSize > 0) { + // if precallback localmem also requested, send the localmem with + // the right offset + if (params.fft_hasPreCallback && + params.fft_preCallback.localMemSize > 0) { + str += ", ((__local char *)localmem + "; + str += SztToStr(params.fft_preCallback.localMemSize); + str += ")"; + } else { + str += ", localmem"; + } + } + } + + str += ");\n"; + } else { + for (typename std::vector>::const_iterator p = passes.begin(); + p != passes.end(); p++) { + std::string exTab = ""; + if (blockCompute || realSpecial) + exTab = "\t"; + + str += exTab; + str += "\t"; + str += PassName(p->GetPosition(), fwd); + str += "("; + + std::string ldsOff; + if (blockCompute) { + ldsOff += "t*"; + ldsOff += SztToStr(length * (blockWGS / workGroupSizePerTrans)); + ldsOff += " + (me/"; + ldsOff += SztToStr(workGroupSizePerTrans); + ldsOff += ")*"; + ldsOff += SztToStr(length); + } else { + if (numTrans > 1) { + ldsOff += "(me/"; + ldsOff += SztToStr(workGroupSizePerTrans); + ldsOff += ")*"; + ldsOff += SztToStr(length); + } else { + ldsOff += "0"; + } + } + + std::string ldsArgs; + if (halfLds) { + ldsArgs += "lds, lds"; + } else { + if (ldsInterleaved) { + ldsArgs += "lds"; + } else { + ldsArgs += "lds, lds + "; + ldsArgs += SztToStr(length * numTrans); + } + } + + str += rw; + if (params.fft_realSpecial) + str += "t, "; + str += me; + if (p == passes.begin()) // beginning pass + { + if (blockCompute) { + str += ldsOff; + } else { + str += (params.fft_hasPreCallback) ? inOffset : "0"; + } + str += ", "; + str += ldsOff; + str += ", "; + str += inBuf; + str += ldsArgs; + str += IterRegs("&"); + + // if precalback set, append additional arguments + if (!blockCompute && params.fft_hasPreCallback) { + str += (r2c2r && !rcSimple) ? ", iOffset2, pre_userdata" + : ", pre_userdata"; + + if (params.fft_preCallback.localMemSize > 0) { + str += ", localmem"; + } + } + + str += ");\n"; + if (!halfLds) { + str += exTab; + str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + } + } else if ((p + 1) == passes.end()) // ending pass + { + str += ldsOff; + str += ", "; + if (blockCompute) { + str += ldsOff; + } else { + str += (params.fft_hasPostCallback) ? outOffset : "0"; + } + str += ", "; + str += ldsArgs; + str += ", "; + str += outBuf; + + str += IterRegs("&"); + + if (!blockCompute && params.fft_hasPostCallback) { + if ((c2r || r2c) && !rcSimple) { + str += ", "; + str += outOffset; + str += "2"; + } + + str += ", post_userdata"; + + if (params.fft_postCallback.localMemSize > 0) { + // if precallback localmem also requested, send the localmem + // with the right offset + if (params.fft_hasPreCallback && + params.fft_preCallback.localMemSize > 0) { + str += ", ((__local char *)localmem + "; + str += SztToStr(params.fft_preCallback.localMemSize); + str += ")"; + } else { + str += ", localmem"; + } + } + } + str += ");\n"; + + if (!halfLds) { + str += exTab; + str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + } + } else // intermediate pass + { + str += ldsOff; + str += ", "; + str += ldsOff; + str += ", "; + str += ldsArgs; + str += ", "; + str += ldsArgs; + str += IterRegs("&"); + str += ");\n"; + if (!halfLds) { + str += exTab; + str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n"; + } + } + } + } + + if (realSpecial) { + size_t Nt = 1 + length / 2; + str += "\n\t\tif( (bt == 0) || (2*bt == "; + str += SztToStr(params.fft_realSpecial_Nr); + str += ") ) { rw = 0; }\n"; + + str += "\t\tlwbOut += ("; + str += SztToStr(params.fft_realSpecial_Nr); + str += " - 2*bt)*"; + str += SztToStr(Nt); + str += ";\n"; + str += "\t\tb = "; + str += SztToStr(params.fft_realSpecial_Nr); + str += " - b;\n\n"; + } + + if (blockCompute || realSpecial) { + str += "\n\t}\n\n"; + } + + // Write data from LDS for blocked access + if (blockCompute) { + + size_t loopCount = (length * blockWidth) / blockWGS; + + str += "\tbarrier(CLK_LOCAL_MEM_FENCE);\n\n"; + str += "\n\tfor(uint t=0; t<"; + str += SztToStr(loopCount); + str += "; t++)\n\t{\n"; + + if ((blockComputeType == BCT_C2C) || (blockComputeType == BCT_R2C)) { + str += "\t\tR0 = lds[t*"; + str += SztToStr(blockWGS / blockWidth); + str += " + "; + str += "(me%"; + str += SztToStr(blockWidth); + str += ")*"; + str += SztToStr(length); + str += " + "; + str += "(me/"; + str += SztToStr(blockWidth); + str += ")];"; + str += "\n"; + } else { + str += "\t\tR0 = lds[t*"; + str += SztToStr(blockWGS); + str += " + me];"; + str += "\n"; + } + + for (size_t c = 0; c < 2; c++) { + std::string comp = ""; + std::string writeBuf = + (params.fft_placeness == CLFFT_INPLACE) ? "lwb" : "lwbOut"; + if (!outInterleaved) + comp = c ? ".y" : ".x"; + if (!outInterleaved) + writeBuf = (params.fft_placeness == CLFFT_INPLACE) + ? (c ? "lwbIm" : "lwbRe") + : (c ? "lwbOutIm" : "lwbOutRe"); + + if ((blockComputeType == BCT_C2C) || (blockComputeType == BCT_R2C)) { + if (blockComputeType == BCT_R2C && params.fft_hasPostCallback) { + if (outInterleaved) + writeBuf = + (params.fft_placeness == CLFFT_INPLACE) ? "gb" : "gbOut"; + else + writeBuf = (params.fft_placeness == CLFFT_INPLACE) + ? "gbRe, gbIm" + : "gbOutRe, gbOutIm"; + + str += "\t\t"; + str += params.fft_postCallback.funcname; + str += "("; + str += writeBuf; + str += ", ("; + str += outOffset; + str += " + (me%"; + str += SztToStr(blockWidth); + str += ") + "; + str += "(me/"; + str += SztToStr(blockWidth); + str += ")*"; + str += SztToStr(params.fft_outStride[0]); + str += " + t*"; + str += SztToStr(params.fft_outStride[0] * blockWGS / blockWidth); + str += "), post_userdata, R0"; + if (!outInterleaved) + str += ".x, R0.y"; + + if (params.fft_postCallback.localMemSize > 0) { + if (params.fft_hasPreCallback && + params.fft_preCallback.localMemSize > 0) { + str += ", (char *)(localmem + "; + str += SztToStr(params.fft_preCallback.localMemSize); + str += ")"; + } else { + str += ", localmem"; + } + } + str += ");\n"; + + // in the planar case, break from for loop since both real and + // imag components are handled together in post-callback + if (!outInterleaved) + break; + } else { + str += "\t\t"; + str += writeBuf; + str += "[(me%"; + str += SztToStr(blockWidth); + str += ") + "; + str += "(me/"; + str += SztToStr(blockWidth); + str += ")*"; + str += SztToStr(params.fft_outStride[0]); + str += " + t*"; + str += SztToStr(params.fft_outStride[0] * blockWGS / blockWidth); + str += "] = R0"; + str += comp; + str += ";\n"; + } + } else { + str += "\t\t"; + str += writeBuf; + str += "[me + t*"; + str += SztToStr(blockWGS); + str += "] = R0"; + str += comp; + str += ";\n"; + } + + if (outInterleaved) + break; + } + + str += "\t}\n\n"; + } + + str += "}\n\n"; + + if (r2c2r) + break; + } + } +}; +}; // namespace StockhamGenerator + +using namespace StockhamGenerator; + +clfftStatus FFTGeneratedStockhamAction::initParams() { + + // Query the devices in this context for their local memory sizes + // How we generate a kernel depends on the *minimum* LDS size for all + // devices. + // + const FFTEnvelope *pEnvelope = nullptr; + OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); + BUG_CHECK(nullptr != pEnvelope); + + // Remainder: params was properly cleared by its constructor + // clearing it again would destroy datasize and id!! + this->signature.fft_precision = this->plan->precision; + this->signature.fft_placeness = this->plan->placeness; + this->signature.fft_inputLayout = this->plan->inputLayout; + this->signature.fft_MaxWorkGroupSize = + this->plan->envelope.limit_WorkGroupSize; + this->signature.fft_offsetIn = this->plan->offsetIn; + this->signature.fft_offsetOut = this->plan->offsetOut; + + ARG_CHECK(this->plan->length.size() > 0); + ARG_CHECK(this->plan->inStride.size() > 0); + ARG_CHECK(this->plan->outStride.size() > 0); + + ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()) + + bool real_transform = ((this->plan->inputLayout == CLFFT_REAL) || + (this->plan->outputLayout == CLFFT_REAL)); + + if ((CLFFT_INPLACE == this->plan->placeness) && (!real_transform)) { + // If this is an in-place transform the + // input and output layout, dimensions and strides + // *MUST* be the same. // - unsigned long long count = 1; - for (unsigned u = 0; u < this->plan->length.size(); ++u) { - count *= std::max (1, this->plan->length[ u ]); + ARG_CHECK(this->plan->inputLayout == this->plan->outputLayout) + this->signature.fft_outputLayout = this->plan->inputLayout; + for (size_t u = this->plan->inStride.size(); u-- > 0;) { + ARG_CHECK(this->plan->inStride[u] == this->plan->outStride[u]); } - count *= this->plan->batchsize; + } else { + this->signature.fft_outputLayout = this->plan->outputLayout; + } + this->signature.fft_DataDim = this->plan->length.size() + 1; + int i = 0; + for (i = 0; i < (this->signature.fft_DataDim - 1); i++) { + this->signature.fft_N[i] = this->plan->length[i]; + this->signature.fft_inStride[i] = this->plan->inStride[i]; + this->signature.fft_outStride[i] = this->plan->outStride[i]; + } + this->signature.fft_inStride[i] = this->plan->iDist; + this->signature.fft_outStride[i] = this->plan->oDist; - if(this->signature.blockCompute) - { - count = DivRoundingUp (count, this->signature.blockLDS); - count = count * this->signature.blockSIMD; + this->signature.fft_RCsimple = this->plan->RCsimple; - globalWS.push_back( static_cast< size_t >( count ) ); - localWS.push_back( this->signature.blockSIMD ); + this->signature.fft_realSpecial = this->plan->realSpecial; + this->signature.fft_realSpecial_Nr = this->plan->realSpecial_Nr; - return CLFFT_SUCCESS; - } + this->signature.blockCompute = this->plan->blockCompute; + this->signature.blockComputeType = this->plan->blockComputeType; - count = DivRoundingUp (count, this->signature.fft_R); // count of WorkItems - count = DivRoundingUp (count, this->signature.fft_SIMD); // count of WorkGroups + this->signature.fft_twiddleFront = this->plan->twiddleFront; - // for real transforms we only need half the work groups since we do twice the work in 1 work group - if( !(this->signature.fft_RCsimple) && ((this->signature.fft_inputLayout == CLFFT_REAL) || (this->signature.fft_outputLayout == CLFFT_REAL)) ) - count = DivRoundingUp (count, 2); + size_t wgs, nt; +#ifdef PARMETERS_TO_BE_READ + ParamRead pr; + ReadParameterFile(pr); + wgs = pr.workGroupSize; + nt = pr.numTransformsPerWg; +#else + size_t t_wgs, t_nt; + Precision pr = + (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE; + switch (pr) { + case P_SINGLE: { + KernelCoreSpecs kcs; + kcs.GetWGSAndNT(this->signature.fft_N[0], t_wgs, t_nt); + if (this->signature.blockCompute) { + this->signature.blockSIMD = + Kernel::BlockSizes::BlockWorkGroupSize( + this->signature.fft_N[0]); + this->signature.blockLDS = + Kernel::BlockSizes::BlockLdsSize(this->signature.fft_N[0]); + } + } break; + case P_DOUBLE: { + KernelCoreSpecs kcs; + kcs.GetWGSAndNT(this->signature.fft_N[0], t_wgs, t_nt); + if (this->signature.blockCompute) { + this->signature.blockSIMD = + Kernel::BlockSizes::BlockWorkGroupSize( + this->signature.fft_N[0]); + this->signature.blockLDS = + Kernel::BlockSizes::BlockLdsSize(this->signature.fft_N[0]); + } + } break; + } + + if ((t_wgs != 0) && (t_nt != 0) && + (this->plan->envelope.limit_WorkGroupSize >= 256)) { + wgs = t_wgs; + nt = t_nt; + } else + DetermineSizes(this->plan->envelope.limit_WorkGroupSize, + this->signature.fft_N[0], wgs, nt, pr); +#endif + + assert((nt * this->signature.fft_N[0]) >= wgs); + assert((nt * this->signature.fft_N[0]) % wgs == 0); + + this->signature.fft_R = (nt * this->signature.fft_N[0]) / wgs; + this->signature.fft_SIMD = wgs; + + // Set pre-callback if specified + if (this->plan->hasPreCallback) { + this->signature.fft_hasPreCallback = true; + this->signature.fft_preCallback = this->plan->preCallback; + } + + // Set post-callback if specified + if (this->plan->hasPostCallback) { + this->signature.fft_hasPostCallback = true; + this->signature.fft_postCallback = this->plan->postCallbackParam; + } + this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; + + if (this->plan->large1D != 0) { + ARG_CHECK(this->signature.fft_N[0] != 0) + ARG_CHECK((this->plan->large1D % this->signature.fft_N[0]) == 0) + this->signature.fft_3StepTwiddle = true; + if (!(this->plan->realSpecial)) + ARG_CHECK(this->plan->large1D == + (this->signature.fft_N[1] * this->signature.fft_N[0])); + } + + this->signature.fft_fwdScale = this->plan->forwardScale; + this->signature.fft_backScale = this->plan->backwardScale; + + return CLFFT_SUCCESS; +} - count = std::max (count, 1) * this->signature.fft_SIMD; - // .. count of WorkItems, rounded up to next multiple of fft_SIMD. +clfftStatus +FFTGeneratedStockhamAction::getWorkSizes(std::vector &globalWS, + std::vector &localWS) { + // How many complex numbers in the input mutl-dimensional array? + // + unsigned long long count = 1; + for (unsigned long & u : this->plan->length) { + count *= std::max(1, u); + } + count *= this->plan->batchsize; - // 1 dimension work group size - globalWS.push_back( static_cast< size_t >( count ) ); + if (this->signature.blockCompute) { + count = DivRoundingUp(count, this->signature.blockLDS); + count = count * this->signature.blockSIMD; - localWS.push_back( this->signature.fft_SIMD ); + globalWS.push_back(static_cast(count)); + localWS.push_back(this->signature.blockSIMD); + + return CLFFT_SUCCESS; + } - return CLFFT_SUCCESS; + count = DivRoundingUp( + count, this->signature.fft_R); // count of WorkItems + count = DivRoundingUp( + count, this->signature.fft_SIMD); // count of WorkGroups + + // for real transforms we only need half the work groups since we do twice the + // work in 1 work group + if (!(this->signature.fft_RCsimple) && + ((this->signature.fft_inputLayout == CLFFT_REAL) || + (this->signature.fft_outputLayout == CLFFT_REAL))) + count = DivRoundingUp(count, 2); + + count = std::max(count, 1) * this->signature.fft_SIMD; + // .. count of WorkItems, rounded up to next multiple of fft_SIMD. + + // 1 dimension work group size + globalWS.push_back(static_cast(count)); + + localWS.push_back(this->signature.fft_SIMD); + + return CLFFT_SUCCESS; } -clfftStatus FFTPlan::GetMax1DLengthStockham (size_t * longest) const -{ - // TODO The caller has already acquired the lock on *this - // However, we shouldn't depend on it. - - // Query the devices in this context for their local memory sizes - // How large a kernel we can generate depends on the *minimum* LDS - // size for all devices. - // - const FFTEnvelope * pEnvelope = NULL; - OPENCL_V(this->GetEnvelope (& pEnvelope), _T("GetEnvelope failed")); - BUG_CHECK (NULL != pEnvelope); - - ARG_CHECK (NULL != longest) - size_t LdsperElement = this->ElementSize(); - size_t result = pEnvelope->limit_LocalMemSize / - (1 * LdsperElement); - result = FloorPo2 (result); - *longest = result; - return CLFFT_SUCCESS; +clfftStatus FFTPlan::GetMax1DLengthStockham(size_t *longest) const { + // TODO The caller has already acquired the lock on *this + // However, we shouldn't depend on it. + + // Query the devices in this context for their local memory sizes + // How large a kernel we can generate depends on the *minimum* LDS + // size for all devices. + // + const FFTEnvelope *pEnvelope = nullptr; + OPENCL_V(this->GetEnvelope(&pEnvelope), _T("GetEnvelope failed")); + BUG_CHECK(nullptr != pEnvelope); + + ARG_CHECK(nullptr != longest) + size_t LdsperElement = this->ElementSize(); + size_t result = pEnvelope->limit_LocalMemSize / (1 * LdsperElement); + result = FloorPo2(result); + *longest = result; + return CLFFT_SUCCESS; } -clfftStatus FFTGeneratedStockhamAction::generateKernel(FFTRepo& fftRepo, const cl_command_queue commQueueFFT ) -{ - cl_int status = CL_SUCCESS; - cl_device_id Device = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL); - OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) ); - - cl_context QueueContext = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL); - OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) ); - - std::string programCode; - Precision pr = (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE; - switch(pr) - { - case P_SINGLE: - { - Kernel kernel(this->signature); - kernel.GenerateKernel(programCode, Device); - } break; - case P_DOUBLE: - { - Kernel kernel(this->signature); - kernel.GenerateKernel(programCode, Device); - } break; - } - - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by main FFT kernel - if ((this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) || - (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0)) - { - bool validLDSSize = false; - size_t requestedCallbackLDS = 0; - - if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) - requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; - if (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0) - requestedCallbackLDS += this->signature.fft_postCallback.localMemSize; - - if (this->plan->blockCompute) - { - validLDSSize = ((this->signature.blockLDS * this->plan->ElementSize()) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; - } - else - { - size_t length = this->signature.fft_N[0]; - size_t workGroupSize = this->signature.fft_SIMD; - size_t numTrans = (workGroupSize * this->signature.fft_R) / length; - - //TODO - Need to abstract this out. Repeating the same compute as in GenerateKernel. - // Set half lds only for power-of-2 problem sizes & interleaved data - bool halfLds = ( (this->signature.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) && - (this->signature.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED) ) ? true : false; - halfLds = halfLds ? ((length & (length-1)) ? false : true) : false; - - // Set half lds for real transforms - halfLds = ( (this->signature.fft_inputLayout == CLFFT_REAL) && - (this->signature.fft_outputLayout == CLFFT_REAL) ) ? true : halfLds; - - size_t ldsSize = halfLds ? length*numTrans : 2*length*numTrans; - size_t elementSize = ((this->signature.fft_precision == CLFFT_DOUBLE) || (this->signature.fft_precision == CLFFT_DOUBLE_FAST)) ? sizeof(double) : sizeof(float); - - validLDSSize = ((ldsSize * elementSize) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; - } - - if(!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } +clfftStatus FFTGeneratedStockhamAction::generateKernel( + FFTRepo &fftRepo, const cl_command_queue commQueueFFT) { + cl_int status = CL_SUCCESS; + cl_device_id Device = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, + sizeof(cl_device_id), &Device, nullptr); + OPENCL_V(status, _T( "clGetCommandQueueInfo failed" )); + + cl_context QueueContext = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, + sizeof(cl_context), &QueueContext, nullptr); + OPENCL_V(status, _T( "clGetCommandQueueInfo failed" )); + + std::string programCode; + Precision pr = + (this->signature.fft_precision == CLFFT_SINGLE) ? P_SINGLE : P_DOUBLE; + switch (pr) { + case P_SINGLE: { + Kernel kernel(this->signature); + kernel.GenerateKernel(programCode, Device); + } break; + case P_DOUBLE: { + Kernel kernel(this->signature); + kernel.GenerateKernel(programCode, Device); + } break; + } + + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by main FFT kernel + if ((this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) || + (this->signature.fft_hasPostCallback && + this->signature.fft_postCallback.localMemSize > 0)) { + bool validLDSSize = false; + size_t requestedCallbackLDS = 0; + + if (this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) + requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; + if (this->signature.fft_hasPostCallback && + this->signature.fft_postCallback.localMemSize > 0) + requestedCallbackLDS += this->signature.fft_postCallback.localMemSize; + + if (this->plan->blockCompute) { + validLDSSize = + ((this->signature.blockLDS * this->plan->ElementSize()) + + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; + } else { + size_t length = this->signature.fft_N[0]; + size_t workGroupSize = this->signature.fft_SIMD; + size_t numTrans = (workGroupSize * this->signature.fft_R) / length; + + // TODO - Need to abstract this out. Repeating the same compute as in + // GenerateKernel. + // Set half lds only for power-of-2 problem sizes & interleaved data + bool halfLds = + ((this->signature.fft_inputLayout == CLFFT_COMPLEX_INTERLEAVED) && + (this->signature.fft_outputLayout == CLFFT_COMPLEX_INTERLEAVED)) + ? true + : false; + halfLds = halfLds ? ((length & (length - 1)) ? false : true) : false; + + // Set half lds for real transforms + halfLds = ((this->signature.fft_inputLayout == CLFFT_REAL) && + (this->signature.fft_outputLayout == CLFFT_REAL)) + ? true + : halfLds; + + size_t ldsSize = halfLds ? length * numTrans : 2 * length * numTrans; + size_t elementSize = + ((this->signature.fft_precision == CLFFT_DOUBLE) || + (this->signature.fft_precision == CLFFT_DOUBLE_FAST)) + ? sizeof(double) + : sizeof(float); + + validLDSSize = ((ldsSize * elementSize) + requestedCallbackLDS) < + this->plan->envelope.limit_LocalMemSize; + } + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } #ifdef KERNEL_INTERJECT - ReadKernelFromFile(programCode); + ReadKernelFromFile(programCode); #endif - OPENCL_V( fftRepo.setProgramCode( this->getGenerator(), this->getSignatureData(), programCode, Device, QueueContext ), _T( "fftRepo.setclString() failed!" ) ); - OPENCL_V( fftRepo.setProgramEntryPoints( this->getGenerator(), this->getSignatureData(), "fft_fwd", "fft_back", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) ); + OPENCL_V(fftRepo.setProgramCode(this->getGenerator(), + this->getSignatureData(), programCode, Device, + QueueContext), + _T( "fftRepo.setclString() failed!" )); + OPENCL_V(fftRepo.setProgramEntryPoints(this->getGenerator(), + this->getSignatureData(), "fft_fwd", + "fft_back", Device, QueueContext), + _T( "fftRepo.setProgramEntryPoint() failed!" )); - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } diff --git a/src/library/generator.stockham.h b/src/library/generator.stockham.h index df5a37cd..cda32333 100644 --- a/src/library/generator.stockham.h +++ b/src/library/generator.stockham.h @@ -19,877 +19,849 @@ #endif #pragma once -#if !defined( AMD_CLFFT_generator_stockham_H ) +#if !defined(AMD_CLFFT_generator_stockham_H) #define AMD_CLFFT_generator_stockham_H -#include +#include "plan.h" #include "private.h" #include "repo.h" -#include "plan.h" +#include typedef union { - cl_float f; - cl_uint u; - cl_int i; + cl_float f; + cl_uint u; + cl_int i; } cb_t; -namespace StockhamGenerator +namespace StockhamGenerator { +// Precision +enum Precision { + P_SINGLE, + P_DOUBLE, +}; + +template inline size_t PrecisionWidth() { + switch (PR) { + case P_SINGLE: + return 1; + case P_DOUBLE: + return 2; + default: + assert(false); + return 1; + } +} + +template inline std::string ClPragma() { + switch (PR) { + case P_SINGLE: + return ""; + case P_DOUBLE: + return "\n#ifdef cl_khr_fp64\n" + "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" + "#else\n" + "#pragma OPENCL EXTENSION cl_amd_fp64 : enable\n" + "#endif\n\n"; + default: + assert(false); + return ""; + } +} + +// Convert unsigned integers to string +inline std::string SztToStr(size_t i) { + std::stringstream ss; + ss << i; + return ss.str(); +} + +inline std::string FloatToStr(double f) { + std::stringstream ss; + ss.imbue(std::locale("C")); + ss.precision(16); + ss << std::scientific << f; + return ss.str(); +} + +// Find the smallest power of 2 that is >= n; return its power of 2 factor +// e.g., CeilPo2 (7) returns 3 : (2^3 >= 7) +inline size_t CeilPo2(size_t n) { + size_t v = 1, t = 0; + while (v < n) { + v <<= 1; + t++; + } + + return t; +} + +inline size_t FloorPo2(size_t n) +// return the largest power of 2 that is <= n. +// e.g., FloorPo2 (7) returns 4. +// *** TODO use x86 BSR instruction, using compiler intrinsics. { - // Precision - enum Precision - { - P_SINGLE, - P_DOUBLE, - }; - - template - inline size_t PrecisionWidth() - { - switch(PR) - { - case P_SINGLE: return 1; - case P_DOUBLE: return 2; - default: assert(false); return 1; - } - } - - template - inline std::string ClPragma() - { - switch(PR) - { - case P_SINGLE: return ""; - case P_DOUBLE: return "\n#ifdef cl_khr_fp64\n" - "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" - "#else\n" - "#pragma OPENCL EXTENSION cl_amd_fp64 : enable\n" - "#endif\n\n"; - default: assert(false); return ""; - } - } - - // Convert unsigned integers to string - inline std::string SztToStr(size_t i) - { - std::stringstream ss; - ss << i; - return ss.str(); - } - - inline std::string FloatToStr(double f) - { - std::stringstream ss; - ss.imbue(std::locale("C")); - ss.precision(16); - ss << std::scientific << f; - return ss.str(); - } - - - // Find the smallest power of 2 that is >= n; return its power of 2 factor - // e.g., CeilPo2 (7) returns 3 : (2^3 >= 7) - inline size_t CeilPo2 (size_t n) - { - size_t v = 1, t = 0; - while(v < n) - { - v <<= 1; - t++; - } - - return t; - } - - inline size_t FloorPo2 (size_t n) - // return the largest power of 2 that is <= n. - // e.g., FloorPo2 (7) returns 4. - // *** TODO use x86 BSR instruction, using compiler intrinsics. - { - size_t tmp; - while (0 != (tmp = n & (n-1))) - n = tmp; - return n; - } - - typedef std::pair stringpair; - inline stringpair ComplexMul(const char *type, const char * a, const char * b, bool forward = true) - { - stringpair result; - result.first = "("; - result.first += type; - result.first += ") (("; - result.first += a; - result.first += ".x * "; - result.first += b; - result.first += (forward ? ".x - " : ".x + "); - result.first += a; - result.first += ".y * "; - result.first += b; - result.first += ".y),"; - result.second = "("; - result.second += a; - result.second += ".y * "; - result.second += b; - result.second += (forward ? ".x + " : ".x - "); - result.second += a; - result.second += ".x * "; - result.second += b; - result.second += ".y))"; - return result; - } - - - // Register data base types - template - inline std::string RegBaseType(size_t count) - { - switch(PR) - { - case P_SINGLE: - switch(count) - { - case 1: return "float"; - case 2: return "float2"; - case 4: return "float4"; - default: assert(false); return ""; - } - break; - case P_DOUBLE: - switch(count) - { - case 1: return "double"; - case 2: return "double2"; - case 4: return "double4"; - default: assert(false); return ""; - } - break; - default: - assert(false); return ""; - } - } - - template - inline std::string FloatSuffix() - { - // Suffix for constants - std::string sfx; - switch(PR) - { - case P_SINGLE: sfx = "f"; break; - case P_DOUBLE: sfx = ""; break; - default: assert(false); - } - - return sfx; - } - - inline std::string ButterflyName(size_t radix, size_t count, bool fwd) - { - std::string str; - if(fwd) str += "Fwd"; - else str += "Inv"; - str += "Rad"; str += SztToStr(radix); - str += "B"; str += SztToStr(count); - return str; - } - - inline std::string PassName(size_t pos, bool fwd) - { - std::string str; - if(fwd) str += "Fwd"; - else str += "Inv"; - str += "Pass"; str += SztToStr(pos); - return str; - } - - inline std::string TwTableName() - { - return "twiddles"; - } - - inline std::string TwTableLargeName() - { - return "twiddle_dee"; - } - - inline std::string TwTableLargeFunc() - { - return "TW3step"; - } - - // Twiddle factors table for large N - // used in 3-step algorithm - class TwiddleTableLarge - { - size_t N; // length - size_t X, Y; - size_t tableSize; - double *wc, *ws; // cosine, sine arrays - - public: - TwiddleTableLarge(size_t length) : N(length) - { - X = size_t(1) << ARBITRARY::TWIDDLE_DEE; - Y = DivRoundingUp (CeilPo2(N), ARBITRARY::TWIDDLE_DEE); - tableSize = X * Y; - - // Allocate memory for the tables - wc = new double[tableSize]; - ws = new double[tableSize]; - } - - ~TwiddleTableLarge() - { - // Free - delete[] wc; - delete[] ws; - } - - template - void GenerateTwiddleTable(std::string &twStr) - { - const double TWO_PI = -6.283185307179586476925286766559; - - // Generate the table - size_t nt = 0; - double phi = TWO_PI / double (N); - for (size_t iY = 0; iY < Y; ++iY) - { - size_t i = size_t(1) << (iY * ARBITRARY::TWIDDLE_DEE); - for (size_t iX = 0; iX < X; ++iX) - { - size_t j = i * iX; - - double c = cos(phi * (double)j); - double s = sin(phi * (double)j); - - //if (fabs(c) < 1.0E-12) c = 0.0; - //if (fabs(s) < 1.0E-12) s = 0.0; - - wc[nt] = c; - ws[nt++] = s; - } - } - - std::string sfx = FloatSuffix(); - - // Stringize the table - std::stringstream ss; - ss.imbue(std::locale("C")); - ss.precision(34); - ss << std::scientific; - nt = 0; - - ss << "\n __constant "; - ss << RegBaseType(2); - ss << " " << TwTableLargeName(); - ss << "[" << Y << "][" << X << "] = {\n"; - for (size_t iY = 0; iY < Y; ++iY) - { - ss << "{ "; - for (size_t iX = 0; iX < X; ++iX) - { - ss << "("; ss << RegBaseType(2); ss << ")("; - ss << wc[nt] << sfx << ", "; - ss << ws[nt++] << sfx << "),\n"; - } - ss << " },\n"; - } - ss << "};\n\n"; - - // Twiddle calc function - ss << "__attribute__((always_inline)) "; - ss << RegBaseType(2); - ss << "\n" << TwTableLargeFunc() << "(size_t u)\n{\n"; - - ss << "\t" "size_t j = u & " << unsigned(X-1) << ";\n"; - ss << "\t" ; ss << RegBaseType(2); ss << " result = "; - ss << TwTableLargeName(); - ss << "[0][j];\n"; - - for (size_t iY = 1; iY < Y; ++iY) - { - std::string phasor = TwTableLargeName(); - phasor += "["; - phasor += SztToStr(iY); - phasor += "][j]"; - - stringpair product = ComplexMul((RegBaseType(2)).c_str(), "result", phasor.c_str()); - - ss << "\t" "u >>= " << unsigned (ARBITRARY::TWIDDLE_DEE) << ";\n"; - ss << "\t" "j = u & " << unsigned(X-1) << ";\n"; - ss << "\t" "result = " << product.first << "\n"; - ss << "\t" "\t" << product.second <<";\n"; - } - ss << "\t" "return result;\n}\n\n"; - - twStr += ss.str(); - } - }; - - // FFT butterfly - template - class Butterfly - { - size_t radix; // Base radix - size_t count; // Number of basic butterflies, valid values: 1,2,4 - bool fwd; // FFT direction - bool cReg; // registers are complex numbers, .x (real), .y(imag) - - size_t BitReverse (size_t n, size_t N) const - { - return (N < 2) ? n : (BitReverse (n >> 1, N >> 1) | ((n & 1) != 0 ? (N >> 1) : 0)); - } - - void GenerateButterflyStr(std::string &bflyStr) const - { - std::string regType = cReg ? RegBaseType(2) : RegBaseType(count); - - // Function attribute - bflyStr += "__attribute__((always_inline)) void \n"; - - // Function name - bflyStr += ButterflyName(radix, count, fwd); - - // Function Arguments - bflyStr += "("; - for(size_t i=0;;i++) - { - if(cReg) - { - bflyStr += regType; bflyStr += " *R"; - if(radix & (radix-1)) bflyStr += SztToStr(i); - else bflyStr += SztToStr(BitReverse(i,radix)); - } - else - { - bflyStr += regType; bflyStr += " *R"; bflyStr += SztToStr(i); bflyStr += ", "; // real arguments - bflyStr += regType; bflyStr += " *I"; bflyStr += SztToStr(i); // imaginary arguments - } - - if(i == radix-1) - { - bflyStr += ")"; - break; - } - else - { - bflyStr += ", "; - } - } - - bflyStr += "\n{\n\n"; - - - // Temporary variables - // Allocate temporary variables if we are not using complex registers (cReg = 0) or if cReg is true, then - // allocate temporary variables only for non power-of-2 radices - if (!( (radix == 7 && cReg) || (radix == 11 && cReg) || (radix == 13 && cReg) )) - { - if( (radix & (radix-1)) || (!cReg) ) - { - bflyStr += "\t"; - if(cReg) - bflyStr += RegBaseType(1); - else - bflyStr += regType; - - for(size_t i=0;;i++) - { - bflyStr += " TR"; bflyStr += SztToStr(i); bflyStr += ","; // real arguments - bflyStr += " TI"; bflyStr += SztToStr(i); // imaginary arguments - - if(i == radix-1) - { - bflyStr += ";"; - break; - } - else - { - bflyStr += ","; - } - } - } - else - { - bflyStr += "\t"; - bflyStr += RegBaseType(2); - bflyStr += " T;"; - } - } - - - bflyStr += "\n\n\t"; - - // Butterfly for different radices - switch(radix) - { - case 2: - { - if(cReg) - { - bflyStr += - "(*R1) = (*R0) - (*R1);\n\t" - "(*R0) = 2.0f * (*R0) - (*R1);\n\t"; - } - else - { - bflyStr += - "TR0 = (*R0) + (*R1);\n\t" - "TI0 = (*I0) + (*I1);\n\t" - "TR1 = (*R0) - (*R1);\n\t" - "TI1 = (*I0) - (*I1);\n\t"; - } - - } break; - case 3: - { - if(fwd) - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R1).x + (*R2).x;\n\t" - "TR1 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) + C3QB*((*R1).y - (*R2).y);\n\t" - "TR2 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) - C3QB*((*R1).y - (*R2).y);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R1).y + (*R2).y;\n\t" - "TI1 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) - C3QB*((*R1).x - (*R2).x);\n\t" - "TI2 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) + C3QB*((*R1).x - (*R2).x);\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R1 + *R2;\n\t" - "TR1 = (*R0 - C3QA*(*R1 + *R2)) + C3QB*(*I1 - *I2);\n\t" - "TR2 = (*R0 - C3QA*(*R1 + *R2)) - C3QB*(*I1 - *I2);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I1 + *I2;\n\t" - "TI1 = (*I0 - C3QA*(*I1 + *I2)) - C3QB*(*R1 - *R2);\n\t" - "TI2 = (*I0 - C3QA*(*I1 + *I2)) + C3QB*(*R1 - *R2);\n\t"; - } - } - else - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R1).x + (*R2).x;\n\t" - "TR1 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) - C3QB*((*R1).y - (*R2).y);\n\t" - "TR2 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) + C3QB*((*R1).y - (*R2).y);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R1).y + (*R2).y;\n\t" - "TI1 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) + C3QB*((*R1).x - (*R2).x);\n\t" - "TI2 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) - C3QB*((*R1).x - (*R2).x);\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R1 + *R2;\n\t" - "TR1 = (*R0 - C3QA*(*R1 + *R2)) - C3QB*(*I1 - *I2);\n\t" - "TR2 = (*R0 - C3QA*(*R1 + *R2)) + C3QB*(*I1 - *I2);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I1 + *I2;\n\t" - "TI1 = (*I0 - C3QA*(*I1 + *I2)) + C3QB*(*R1 - *R2);\n\t" - "TI2 = (*I0 - C3QA*(*I1 + *I2)) - C3QB*(*R1 - *R2);\n\t"; - } - } - } break; - case 4: - { - if(fwd) - { - if(cReg) - { - bflyStr += - "(*R1) = (*R0) - (*R1);\n\t" - "(*R0) = 2.0f * (*R0) - (*R1);\n\t" - "(*R3) = (*R2) - (*R3);\n\t" - "(*R2) = 2.0f * (*R2) - (*R3);\n\t" - "\n\t" - "(*R2) = (*R0) - (*R2);\n\t" - "(*R0) = 2.0f * (*R0) - (*R2);\n\t" - "(*R3) = (*R1) + (fvect2)(-(*R3).y, (*R3).x);\n\t" - "(*R1) = 2.0f * (*R1) - (*R3);\n\t"; - } - else - { - bflyStr += - "TR0 = (*R0) + (*R2) + (*R1) + (*R3);\n\t" - "TR1 = (*R0) - (*R2) + (*I1) - (*I3);\n\t" - "TR2 = (*R0) + (*R2) - (*R1) - (*R3);\n\t" - "TR3 = (*R0) - (*R2) - (*I1) + (*I3);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*I0) + (*I2) + (*I1) + (*I3);\n\t" - "TI1 = (*I0) - (*I2) - (*R1) + (*R3);\n\t" - "TI2 = (*I0) + (*I2) - (*I1) - (*I3);\n\t" - "TI3 = (*I0) - (*I2) + (*R1) - (*R3);\n\t"; - } - } - else - { - if(cReg) - { - bflyStr += - "(*R1) = (*R0) - (*R1);\n\t" - "(*R0) = 2.0f * (*R0) - (*R1);\n\t" - "(*R3) = (*R2) - (*R3);\n\t" - "(*R2) = 2.0f * (*R2) - (*R3);\n\t" - "\n\t" - "(*R2) = (*R0) - (*R2);\n\t" - "(*R0) = 2.0f * (*R0) - (*R2);\n\t" - "(*R3) = (*R1) + (fvect2)((*R3).y, -(*R3).x);\n\t" - "(*R1) = 2.0f * (*R1) - (*R3);\n\t"; - } - else - { - bflyStr += - "TR0 = (*R0) + (*R2) + (*R1) + (*R3);\n\t" - "TR1 = (*R0) - (*R2) - (*I1) + (*I3);\n\t" - "TR2 = (*R0) + (*R2) - (*R1) - (*R3);\n\t" - "TR3 = (*R0) - (*R2) + (*I1) - (*I3);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*I0) + (*I2) + (*I1) + (*I3);\n\t" - "TI1 = (*I0) - (*I2) + (*R1) - (*R3);\n\t" - "TI2 = (*I0) + (*I2) - (*I1) - (*I3);\n\t" - "TI3 = (*I0) - (*I2) - (*R1) + (*R3);\n\t"; - } - } - } break; - case 5: - { - if(fwd) - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R1).x + (*R2).x + (*R3).x + (*R4).x;\n\t" - "TR1 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) + C5QB*((*R1).y - (*R4).y) + C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) + ((*R4).x - (*R3).x));\n\t" - "TR4 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) - C5QB*((*R1).y - (*R4).y) - C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) + ((*R4).x - (*R3).x));\n\t" - "TR2 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) - C5QB*((*R2).y - (*R3).y) + C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) + ((*R3).x - (*R4).x));\n\t" - "TR3 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) + C5QB*((*R2).y - (*R3).y) - C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) + ((*R3).x - (*R4).x));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R1).y + (*R2).y + (*R3).y + (*R4).y;\n\t" - "TI1 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) - C5QB*((*R1).x - (*R4).x) - C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) + ((*R4).y - (*R3).y));\n\t" - "TI4 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) + C5QB*((*R1).x - (*R4).x) + C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) + ((*R4).y - (*R3).y));\n\t" - "TI2 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) + C5QB*((*R2).x - (*R3).x) - C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) + ((*R3).y - (*R4).y));\n\t" - "TI3 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) - C5QB*((*R2).x - (*R3).x) + C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) + ((*R3).y - (*R4).y));\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R1 + *R2 + *R3 + *R4;\n\t" - "TR1 = (*R0 - C5QC*(*R2 + *R3)) + C5QB*(*I1 - *I4) + C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" - "TR4 = (*R0 - C5QC*(*R2 + *R3)) - C5QB*(*I1 - *I4) - C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" - "TR2 = (*R0 - C5QC*(*R1 + *R4)) - C5QB*(*I2 - *I3) + C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t" - "TR3 = (*R0 - C5QC*(*R1 + *R4)) + C5QB*(*I2 - *I3) - C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I1 + *I2 + *I3 + *I4;\n\t" - "TI1 = (*I0 - C5QC*(*I2 + *I3)) - C5QB*(*R1 - *R4) - C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" - "TI4 = (*I0 - C5QC*(*I2 + *I3)) + C5QB*(*R1 - *R4) + C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" - "TI2 = (*I0 - C5QC*(*I1 + *I4)) + C5QB*(*R2 - *R3) - C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t" - "TI3 = (*I0 - C5QC*(*I1 + *I4)) - C5QB*(*R2 - *R3) + C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t"; - } - } - else - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R1).x + (*R2).x + (*R3).x + (*R4).x;\n\t" - "TR1 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) - C5QB*((*R1).y - (*R4).y) - C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) + ((*R4).x - (*R3).x));\n\t" - "TR4 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) + C5QB*((*R1).y - (*R4).y) + C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) + ((*R4).x - (*R3).x));\n\t" - "TR2 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) + C5QB*((*R2).y - (*R3).y) - C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) + ((*R3).x - (*R4).x));\n\t" - "TR3 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) - C5QB*((*R2).y - (*R3).y) + C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) + ((*R3).x - (*R4).x));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R1).y + (*R2).y + (*R3).y + (*R4).y;\n\t" - "TI1 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) + C5QB*((*R1).x - (*R4).x) + C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) + ((*R4).y - (*R3).y));\n\t" - "TI4 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) - C5QB*((*R1).x - (*R4).x) - C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) + ((*R4).y - (*R3).y));\n\t" - "TI2 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) - C5QB*((*R2).x - (*R3).x) + C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) + ((*R3).y - (*R4).y));\n\t" - "TI3 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) + C5QB*((*R2).x - (*R3).x) - C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) + ((*R3).y - (*R4).y));\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R1 + *R2 + *R3 + *R4;\n\t" - "TR1 = (*R0 - C5QC*(*R2 + *R3)) - C5QB*(*I1 - *I4) - C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" - "TR4 = (*R0 - C5QC*(*R2 + *R3)) + C5QB*(*I1 - *I4) + C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" - "TR2 = (*R0 - C5QC*(*R1 + *R4)) + C5QB*(*I2 - *I3) - C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t" - "TR3 = (*R0 - C5QC*(*R1 + *R4)) - C5QB*(*I2 - *I3) + C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I1 + *I2 + *I3 + *I4;\n\t" - "TI1 = (*I0 - C5QC*(*I2 + *I3)) + C5QB*(*R1 - *R4) + C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" - "TI4 = (*I0 - C5QC*(*I2 + *I3)) - C5QB*(*R1 - *R4) - C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" - "TI2 = (*I0 - C5QC*(*I1 + *I4)) - C5QB*(*R2 - *R3) + C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t" - "TI3 = (*I0 - C5QC*(*I1 + *I4)) + C5QB*(*R2 - *R3) - C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t"; - } - } - } break; - case 6: - { - if(fwd) - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R2).x + (*R4).x;\n\t" - "TR2 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) + C3QB*((*R2).y - (*R4).y);\n\t" - "TR4 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) - C3QB*((*R2).y - (*R4).y);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R2).y + (*R4).y;\n\t" - "TI2 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) - C3QB*((*R2).x - (*R4).x);\n\t" - "TI4 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) + C3QB*((*R2).x - (*R4).x);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = (*R1).x + (*R3).x + (*R5).x;\n\t" - "TR3 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) + C3QB*((*R3).y - (*R5).y);\n\t" - "TR5 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) - C3QB*((*R3).y - (*R5).y);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = (*R1).y + (*R3).y + (*R5).y;\n\t" - "TI3 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) - C3QB*((*R3).x - (*R5).x);\n\t" - "TI5 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) + C3QB*((*R3).x - (*R5).x);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).x = TR0 + TR1;\n\t" - "(*R1).x = TR2 + ( C3QA*TR3 + C3QB*TI3);\n\t" - "(*R2).x = TR4 + (-C3QA*TR5 + C3QB*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).y = TI0 + TI1;\n\t" - "(*R1).y = TI2 + (-C3QB*TR3 + C3QA*TI3);\n\t" - "(*R2).y = TI4 + (-C3QB*TR5 - C3QA*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R3).x = TR0 - TR1;\n\t" - "(*R4).x = TR2 - ( C3QA*TR3 + C3QB*TI3);\n\t" - "(*R5).x = TR4 - (-C3QA*TR5 + C3QB*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R3).y = TI0 - TI1;\n\t" - "(*R4).y = TI2 - (-C3QB*TR3 + C3QA*TI3);\n\t" - "(*R5).y = TI4 - (-C3QB*TR5 - C3QA*TI5);\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R2 + *R4;\n\t" - "TR2 = (*R0 - C3QA*(*R2 + *R4)) + C3QB*(*I2 - *I4);\n\t" - "TR4 = (*R0 - C3QA*(*R2 + *R4)) - C3QB*(*I2 - *I4);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I2 + *I4;\n\t" - "TI2 = (*I0 - C3QA*(*I2 + *I4)) - C3QB*(*R2 - *R4);\n\t" - "TI4 = (*I0 - C3QA*(*I2 + *I4)) + C3QB*(*R2 - *R4);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = *R1 + *R3 + *R5;\n\t" - "TR3 = (*R1 - C3QA*(*R3 + *R5)) + C3QB*(*I3 - *I5);\n\t" - "TR5 = (*R1 - C3QA*(*R3 + *R5)) - C3QB*(*I3 - *I5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = *I1 + *I3 + *I5;\n\t" - "TI3 = (*I1 - C3QA*(*I3 + *I5)) - C3QB*(*R3 - *R5);\n\t" - "TI5 = (*I1 - C3QA*(*I3 + *I5)) + C3QB*(*R3 - *R5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0) = TR0 + TR1;\n\t" - "(*R1) = TR2 + ( C3QA*TR3 + C3QB*TI3);\n\t" - "(*R2) = TR4 + (-C3QA*TR5 + C3QB*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*I0) = TI0 + TI1;\n\t" - "(*I1) = TI2 + (-C3QB*TR3 + C3QA*TI3);\n\t" - "(*I2) = TI4 + (-C3QB*TR5 - C3QA*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R3) = TR0 - TR1;\n\t" - "(*R4) = TR2 - ( C3QA*TR3 + C3QB*TI3);\n\t" - "(*R5) = TR4 - (-C3QA*TR5 + C3QB*TI5);\n\t"; + size_t tmp; + while (0 != (tmp = n & (n - 1))) + n = tmp; + return n; +} + +typedef std::pair stringpair; +inline stringpair ComplexMul(const char *type, const char *a, const char *b, + bool forward = true) { + stringpair result; + result.first = "("; + result.first += type; + result.first += ") (("; + result.first += a; + result.first += ".x * "; + result.first += b; + result.first += (forward ? ".x - " : ".x + "); + result.first += a; + result.first += ".y * "; + result.first += b; + result.first += ".y),"; + result.second = "("; + result.second += a; + result.second += ".y * "; + result.second += b; + result.second += (forward ? ".x + " : ".x - "); + result.second += a; + result.second += ".x * "; + result.second += b; + result.second += ".y))"; + return result; +} + +// Register data base types +template inline std::string RegBaseType(size_t count) { + switch (PR) { + case P_SINGLE: + switch (count) { + case 1: + return "float"; + case 2: + return "float2"; + case 4: + return "float4"; + default: + assert(false); + return ""; + } + break; + case P_DOUBLE: + switch (count) { + case 1: + return "double"; + case 2: + return "double2"; + case 4: + return "double4"; + default: + assert(false); + return ""; + } + break; + default: + assert(false); + return ""; + } +} + +template inline std::string FloatSuffix() { + // Suffix for constants + std::string sfx; + switch (PR) { + case P_SINGLE: + sfx = "f"; + break; + case P_DOUBLE: + sfx = ""; + break; + default: + assert(false); + } + + return sfx; +} + +inline std::string ButterflyName(size_t radix, size_t count, bool fwd) { + std::string str; + if (fwd) + str += "Fwd"; + else + str += "Inv"; + str += "Rad"; + str += SztToStr(radix); + str += "B"; + str += SztToStr(count); + return str; +} + +inline std::string PassName(size_t pos, bool fwd) { + std::string str; + if (fwd) + str += "Fwd"; + else + str += "Inv"; + str += "Pass"; + str += SztToStr(pos); + return str; +} + +inline std::string TwTableName() { return "twiddles"; } + +inline std::string TwTableLargeName() { return "twiddle_dee"; } + +inline std::string TwTableLargeFunc() { return "TW3step"; } + +// Twiddle factors table for large N +// used in 3-step algorithm +class TwiddleTableLarge { + size_t N; // length + size_t X, Y; + size_t tableSize; + double *wc, *ws; // cosine, sine arrays + +public: + TwiddleTableLarge(size_t length) : N(length) { + X = size_t(1) << ARBITRARY::TWIDDLE_DEE; + Y = DivRoundingUp(CeilPo2(N), ARBITRARY::TWIDDLE_DEE); + tableSize = X * Y; + + // Allocate memory for the tables + wc = new double[tableSize]; + ws = new double[tableSize]; + } + + ~TwiddleTableLarge() { + // Free + delete[] wc; + delete[] ws; + } + + template void GenerateTwiddleTable(std::string &twStr) { + const double TWO_PI = -6.283185307179586476925286766559; + + // Generate the table + size_t nt = 0; + double phi = TWO_PI / double(N); + for (size_t iY = 0; iY < Y; ++iY) { + size_t i = size_t(1) << (iY * ARBITRARY::TWIDDLE_DEE); + for (size_t iX = 0; iX < X; ++iX) { + size_t j = i * iX; + + double c = cos(phi * (double)j); + double s = sin(phi * (double)j); + + // if (fabs(c) < 1.0E-12) c = 0.0; + // if (fabs(s) < 1.0E-12) s = 0.0; + + wc[nt] = c; + ws[nt++] = s; + } + } + + std::string sfx = FloatSuffix(); + + // Stringize the table + std::stringstream ss; + ss.imbue(std::locale("C")); + ss.precision(34); + ss << std::scientific; + nt = 0; + + ss << "\n __constant "; + ss << RegBaseType(2); + ss << " " << TwTableLargeName(); + ss << "[" << Y << "][" << X << "] = {\n"; + for (size_t iY = 0; iY < Y; ++iY) { + ss << "{ "; + for (size_t iX = 0; iX < X; ++iX) { + ss << "("; + ss << RegBaseType(2); + ss << ")("; + ss << wc[nt] << sfx << ", "; + ss << ws[nt++] << sfx << "),\n"; + } + ss << " },\n"; + } + ss << "};\n\n"; + + // Twiddle calc function + ss << "__attribute__((always_inline)) "; + ss << RegBaseType(2); + ss << "\n" << TwTableLargeFunc() << "(size_t u)\n{\n"; + + ss << "\t" + "size_t j = u & " + << unsigned(X - 1) << ";\n"; + ss << "\t"; + ss << RegBaseType(2); + ss << " result = "; + ss << TwTableLargeName(); + ss << "[0][j];\n"; + + for (size_t iY = 1; iY < Y; ++iY) { + std::string phasor = TwTableLargeName(); + phasor += "["; + phasor += SztToStr(iY); + phasor += "][j]"; + + stringpair product = + ComplexMul((RegBaseType(2)).c_str(), "result", phasor.c_str()); + + ss << "\t" + "u >>= " + << unsigned(ARBITRARY::TWIDDLE_DEE) << ";\n"; + ss << "\t" + "j = u & " + << unsigned(X - 1) << ";\n"; + ss << "\t" + "result = " + << product.first << "\n"; + ss << "\t" + "\t" + << product.second << ";\n"; + } + ss << "\t" + "return result;\n}\n\n"; + + twStr += ss.str(); + } +}; + +// FFT butterfly +template class Butterfly { + size_t radix; // Base radix + size_t count; // Number of basic butterflies, valid values: 1,2,4 + bool fwd; // FFT direction + bool cReg; // registers are complex numbers, .x (real), .y(imag) + + size_t BitReverse(size_t n, size_t N) const { + return (N < 2) + ? n + : (BitReverse(n >> 1, N >> 1) | ((n & 1) != 0 ? (N >> 1) : 0)); + } + + void GenerateButterflyStr(std::string &bflyStr) const { + std::string regType = cReg ? RegBaseType(2) : RegBaseType(count); + + // Function attribute + bflyStr += "__attribute__((always_inline)) void \n"; + + // Function name + bflyStr += ButterflyName(radix, count, fwd); + + // Function Arguments + bflyStr += "("; + for (size_t i = 0;; i++) { + if (cReg) { + bflyStr += regType; + bflyStr += " *R"; + if (radix & (radix - 1)) + bflyStr += SztToStr(i); + else + bflyStr += SztToStr(BitReverse(i, radix)); + } else { + bflyStr += regType; + bflyStr += " *R"; + bflyStr += SztToStr(i); + bflyStr += ", "; // real arguments + bflyStr += regType; + bflyStr += " *I"; + bflyStr += SztToStr(i); // imaginary arguments + } + + if (i == radix - 1) { + bflyStr += ")"; + break; + } else { + bflyStr += ", "; + } + } + + bflyStr += "\n{\n\n"; + + // Temporary variables + // Allocate temporary variables if we are not using complex registers (cReg + // = 0) or if cReg is true, then allocate temporary variables only for non + // power-of-2 radices + if (!((radix == 7 && cReg) || (radix == 11 && cReg) || + (radix == 13 && cReg))) { + if ((radix & (radix - 1)) || (!cReg)) { + bflyStr += "\t"; + if (cReg) + bflyStr += RegBaseType(1); + else + bflyStr += regType; + + for (size_t i = 0;; i++) { + bflyStr += " TR"; + bflyStr += SztToStr(i); + bflyStr += ","; // real arguments + bflyStr += " TI"; + bflyStr += SztToStr(i); // imaginary arguments + + if (i == radix - 1) { + bflyStr += ";"; + break; + } else { + bflyStr += ","; + } + } + } else { + bflyStr += "\t"; + bflyStr += RegBaseType(2); + bflyStr += " T;"; + } + } + + bflyStr += "\n\n\t"; + + // Butterfly for different radices + switch (radix) { + case 2: { + if (cReg) { + bflyStr += "(*R1) = (*R0) - (*R1);\n\t" + "(*R0) = 2.0f * (*R0) - (*R1);\n\t"; + } else { + bflyStr += "TR0 = (*R0) + (*R1);\n\t" + "TI0 = (*I0) + (*I1);\n\t" + "TR1 = (*R0) - (*R1);\n\t" + "TI1 = (*I0) - (*I1);\n\t"; + } + + } break; + case 3: { + if (fwd) { + if (cReg) { + bflyStr += "TR0 = (*R0).x + (*R1).x + (*R2).x;\n\t" + "TR1 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) + " + "C3QB*((*R1).y - (*R2).y);\n\t" + "TR2 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) - " + "C3QB*((*R1).y - (*R2).y);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*R0).y + (*R1).y + (*R2).y;\n\t" + "TI1 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) - " + "C3QB*((*R1).x - (*R2).x);\n\t" + "TI2 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) + " + "C3QB*((*R1).x - (*R2).x);\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R1 + *R2;\n\t" + "TR1 = (*R0 - C3QA*(*R1 + *R2)) + C3QB*(*I1 - *I2);\n\t" + "TR2 = (*R0 - C3QA*(*R1 + *R2)) - C3QB*(*I1 - *I2);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I1 + *I2;\n\t" + "TI1 = (*I0 - C3QA*(*I1 + *I2)) - C3QB*(*R1 - *R2);\n\t" + "TI2 = (*I0 - C3QA*(*I1 + *I2)) + C3QB*(*R1 - *R2);\n\t"; + } + } else { + if (cReg) { + bflyStr += "TR0 = (*R0).x + (*R1).x + (*R2).x;\n\t" + "TR1 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) - " + "C3QB*((*R1).y - (*R2).y);\n\t" + "TR2 = ((*R0).x - C3QA*((*R1).x + (*R2).x)) + " + "C3QB*((*R1).y - (*R2).y);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*R0).y + (*R1).y + (*R2).y;\n\t" + "TI1 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) + " + "C3QB*((*R1).x - (*R2).x);\n\t" + "TI2 = ((*R0).y - C3QA*((*R1).y + (*R2).y)) - " + "C3QB*((*R1).x - (*R2).x);\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R1 + *R2;\n\t" + "TR1 = (*R0 - C3QA*(*R1 + *R2)) - C3QB*(*I1 - *I2);\n\t" + "TR2 = (*R0 - C3QA*(*R1 + *R2)) + C3QB*(*I1 - *I2);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I1 + *I2;\n\t" + "TI1 = (*I0 - C3QA*(*I1 + *I2)) + C3QB*(*R1 - *R2);\n\t" + "TI2 = (*I0 - C3QA*(*I1 + *I2)) - C3QB*(*R1 - *R2);\n\t"; + } + } + } break; + case 4: { + if (fwd) { + if (cReg) { + bflyStr += "(*R1) = (*R0) - (*R1);\n\t" + "(*R0) = 2.0f * (*R0) - (*R1);\n\t" + "(*R3) = (*R2) - (*R3);\n\t" + "(*R2) = 2.0f * (*R2) - (*R3);\n\t" + "\n\t" + "(*R2) = (*R0) - (*R2);\n\t" + "(*R0) = 2.0f * (*R0) - (*R2);\n\t" + "(*R3) = (*R1) + (fvect2)(-(*R3).y, (*R3).x);\n\t" + "(*R1) = 2.0f * (*R1) - (*R3);\n\t"; + } else { + bflyStr += "TR0 = (*R0) + (*R2) + (*R1) + (*R3);\n\t" + "TR1 = (*R0) - (*R2) + (*I1) - (*I3);\n\t" + "TR2 = (*R0) + (*R2) - (*R1) - (*R3);\n\t" + "TR3 = (*R0) - (*R2) - (*I1) + (*I3);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*I0) + (*I2) + (*I1) + (*I3);\n\t" + "TI1 = (*I0) - (*I2) - (*R1) + (*R3);\n\t" + "TI2 = (*I0) + (*I2) - (*I1) - (*I3);\n\t" + "TI3 = (*I0) - (*I2) + (*R1) - (*R3);\n\t"; + } + } else { + if (cReg) { + bflyStr += "(*R1) = (*R0) - (*R1);\n\t" + "(*R0) = 2.0f * (*R0) - (*R1);\n\t" + "(*R3) = (*R2) - (*R3);\n\t" + "(*R2) = 2.0f * (*R2) - (*R3);\n\t" + "\n\t" + "(*R2) = (*R0) - (*R2);\n\t" + "(*R0) = 2.0f * (*R0) - (*R2);\n\t" + "(*R3) = (*R1) + (fvect2)((*R3).y, -(*R3).x);\n\t" + "(*R1) = 2.0f * (*R1) - (*R3);\n\t"; + } else { + bflyStr += "TR0 = (*R0) + (*R2) + (*R1) + (*R3);\n\t" + "TR1 = (*R0) - (*R2) - (*I1) + (*I3);\n\t" + "TR2 = (*R0) + (*R2) - (*R1) - (*R3);\n\t" + "TR3 = (*R0) - (*R2) + (*I1) - (*I3);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*I0) + (*I2) + (*I1) + (*I3);\n\t" + "TI1 = (*I0) - (*I2) + (*R1) - (*R3);\n\t" + "TI2 = (*I0) + (*I2) - (*I1) - (*I3);\n\t" + "TI3 = (*I0) - (*I2) - (*R1) + (*R3);\n\t"; + } + } + } break; + case 5: { + if (fwd) { + if (cReg) { + bflyStr += + "TR0 = (*R0).x + (*R1).x + (*R2).x + (*R3).x + (*R4).x;\n\t" + "TR1 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) + C5QB*((*R1).y - " + "(*R4).y) + C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) " + "+ ((*R4).x - (*R3).x));\n\t" + "TR4 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) - C5QB*((*R1).y - " + "(*R4).y) - C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) " + "+ ((*R4).x - (*R3).x));\n\t" + "TR2 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) - C5QB*((*R2).y - " + "(*R3).y) + C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) " + "+ ((*R3).x - (*R4).x));\n\t" + "TR3 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) + C5QB*((*R2).y - " + "(*R3).y) - C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) " + "+ ((*R3).x - (*R4).x));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TI0 = (*R0).y + (*R1).y + (*R2).y + (*R3).y + (*R4).y;\n\t" + "TI1 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) - C5QB*((*R1).x - " + "(*R4).x) - C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) " + "+ ((*R4).y - (*R3).y));\n\t" + "TI4 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) + C5QB*((*R1).x - " + "(*R4).x) + C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) " + "+ ((*R4).y - (*R3).y));\n\t" + "TI2 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) + C5QB*((*R2).x - " + "(*R3).x) - C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) " + "+ ((*R3).y - (*R4).y));\n\t" + "TI3 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) - C5QB*((*R2).x - " + "(*R3).x) + C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) " + "+ ((*R3).y - (*R4).y));\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R1 + *R2 + *R3 + *R4;\n\t" + "TR1 = (*R0 - C5QC*(*R2 + *R3)) + C5QB*(*I1 - *I4) + " + "C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" + "TR4 = (*R0 - C5QC*(*R2 + *R3)) - C5QB*(*I1 - *I4) - " + "C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" + "TR2 = (*R0 - C5QC*(*R1 + *R4)) - C5QB*(*I2 - *I3) + " + "C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t" + "TR3 = (*R0 - C5QC*(*R1 + *R4)) + C5QB*(*I2 - *I3) - " + "C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I1 + *I2 + *I3 + *I4;\n\t" + "TI1 = (*I0 - C5QC*(*I2 + *I3)) - C5QB*(*R1 - *R4) - " + "C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" + "TI4 = (*I0 - C5QC*(*I2 + *I3)) + C5QB*(*R1 - *R4) + " + "C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" + "TI2 = (*I0 - C5QC*(*I1 + *I4)) + C5QB*(*R2 - *R3) - " + "C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t" + "TI3 = (*I0 - C5QC*(*I1 + *I4)) - C5QB*(*R2 - *R3) + " + "C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t"; + } + } else { + if (cReg) { + bflyStr += + "TR0 = (*R0).x + (*R1).x + (*R2).x + (*R3).x + (*R4).x;\n\t" + "TR1 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) - C5QB*((*R1).y - " + "(*R4).y) - C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) " + "+ ((*R4).x - (*R3).x));\n\t" + "TR4 = ((*R0).x - C5QC*((*R2).x + (*R3).x)) + C5QB*((*R1).y - " + "(*R4).y) + C5QD*((*R2).y - (*R3).y) + C5QA*(((*R1).x - (*R2).x) " + "+ ((*R4).x - (*R3).x));\n\t" + "TR2 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) + C5QB*((*R2).y - " + "(*R3).y) - C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) " + "+ ((*R3).x - (*R4).x));\n\t" + "TR3 = ((*R0).x - C5QC*((*R1).x + (*R4).x)) - C5QB*((*R2).y - " + "(*R3).y) + C5QD*((*R1).y - (*R4).y) + C5QA*(((*R2).x - (*R1).x) " + "+ ((*R3).x - (*R4).x));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TI0 = (*R0).y + (*R1).y + (*R2).y + (*R3).y + (*R4).y;\n\t" + "TI1 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) + C5QB*((*R1).x - " + "(*R4).x) + C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) " + "+ ((*R4).y - (*R3).y));\n\t" + "TI4 = ((*R0).y - C5QC*((*R2).y + (*R3).y)) - C5QB*((*R1).x - " + "(*R4).x) - C5QD*((*R2).x - (*R3).x) + C5QA*(((*R1).y - (*R2).y) " + "+ ((*R4).y - (*R3).y));\n\t" + "TI2 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) - C5QB*((*R2).x - " + "(*R3).x) + C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) " + "+ ((*R3).y - (*R4).y));\n\t" + "TI3 = ((*R0).y - C5QC*((*R1).y + (*R4).y)) + C5QB*((*R2).x - " + "(*R3).x) - C5QD*((*R1).x - (*R4).x) + C5QA*(((*R2).y - (*R1).y) " + "+ ((*R3).y - (*R4).y));\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R1 + *R2 + *R3 + *R4;\n\t" + "TR1 = (*R0 - C5QC*(*R2 + *R3)) - C5QB*(*I1 - *I4) - " + "C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" + "TR4 = (*R0 - C5QC*(*R2 + *R3)) + C5QB*(*I1 - *I4) + " + "C5QD*(*I2 - *I3) + C5QA*((*R1 - *R2) + (*R4 - *R3));\n\t" + "TR2 = (*R0 - C5QC*(*R1 + *R4)) + C5QB*(*I2 - *I3) - " + "C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t" + "TR3 = (*R0 - C5QC*(*R1 + *R4)) - C5QB*(*I2 - *I3) + " + "C5QD*(*I1 - *I4) + C5QA*((*R2 - *R1) + (*R3 - *R4));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I1 + *I2 + *I3 + *I4;\n\t" + "TI1 = (*I0 - C5QC*(*I2 + *I3)) + C5QB*(*R1 - *R4) + " + "C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" + "TI4 = (*I0 - C5QC*(*I2 + *I3)) - C5QB*(*R1 - *R4) - " + "C5QD*(*R2 - *R3) + C5QA*((*I1 - *I2) + (*I4 - *I3));\n\t" + "TI2 = (*I0 - C5QC*(*I1 + *I4)) - C5QB*(*R2 - *R3) + " + "C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t" + "TI3 = (*I0 - C5QC*(*I1 + *I4)) + C5QB*(*R2 - *R3) - " + "C5QD*(*R1 - *R4) + C5QA*((*I2 - *I1) + (*I3 - *I4));\n\t"; + } + } + } break; + case 6: { + if (fwd) { + if (cReg) { + bflyStr += "TR0 = (*R0).x + (*R2).x + (*R4).x;\n\t" + "TR2 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) + " + "C3QB*((*R2).y - (*R4).y);\n\t" + "TR4 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) - " + "C3QB*((*R2).y - (*R4).y);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*R0).y + (*R2).y + (*R4).y;\n\t" + "TI2 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) - " + "C3QB*((*R2).x - (*R4).x);\n\t" + "TI4 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) + " + "C3QB*((*R2).x - (*R4).x);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TR1 = (*R1).x + (*R3).x + (*R5).x;\n\t" + "TR3 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) + " + "C3QB*((*R3).y - (*R5).y);\n\t" + "TR5 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) - " + "C3QB*((*R3).y - (*R5).y);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI1 = (*R1).y + (*R3).y + (*R5).y;\n\t" + "TI3 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) - " + "C3QB*((*R3).x - (*R5).x);\n\t" + "TI5 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) + " + "C3QB*((*R3).x - (*R5).x);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0).x = TR0 + TR1;\n\t" + "(*R1).x = TR2 + ( C3QA*TR3 + C3QB*TI3);\n\t" + "(*R2).x = TR4 + (-C3QA*TR5 + C3QB*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0).y = TI0 + TI1;\n\t" + "(*R1).y = TI2 + (-C3QB*TR3 + C3QA*TI3);\n\t" + "(*R2).y = TI4 + (-C3QB*TR5 - C3QA*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R3).x = TR0 - TR1;\n\t" + "(*R4).x = TR2 - ( C3QA*TR3 + C3QB*TI3);\n\t" + "(*R5).x = TR4 - (-C3QA*TR5 + C3QB*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R3).y = TI0 - TI1;\n\t" + "(*R4).y = TI2 - (-C3QB*TR3 + C3QA*TI3);\n\t" + "(*R5).y = TI4 - (-C3QB*TR5 - C3QA*TI5);\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R2 + *R4;\n\t" + "TR2 = (*R0 - C3QA*(*R2 + *R4)) + C3QB*(*I2 - *I4);\n\t" + "TR4 = (*R0 - C3QA*(*R2 + *R4)) - C3QB*(*I2 - *I4);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I2 + *I4;\n\t" + "TI2 = (*I0 - C3QA*(*I2 + *I4)) - C3QB*(*R2 - *R4);\n\t" + "TI4 = (*I0 - C3QA*(*I2 + *I4)) + C3QB*(*R2 - *R4);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TR1 = *R1 + *R3 + *R5;\n\t" + "TR3 = (*R1 - C3QA*(*R3 + *R5)) + C3QB*(*I3 - *I5);\n\t" + "TR5 = (*R1 - C3QA*(*R3 + *R5)) - C3QB*(*I3 - *I5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI1 = *I1 + *I3 + *I5;\n\t" + "TI3 = (*I1 - C3QA*(*I3 + *I5)) - C3QB*(*R3 - *R5);\n\t" + "TI5 = (*I1 - C3QA*(*I3 + *I5)) + C3QB*(*R3 - *R5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0) = TR0 + TR1;\n\t" + "(*R1) = TR2 + ( C3QA*TR3 + C3QB*TI3);\n\t" + "(*R2) = TR4 + (-C3QA*TR5 + C3QB*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I0) = TI0 + TI1;\n\t" + "(*I1) = TI2 + (-C3QB*TR3 + C3QA*TI3);\n\t" + "(*I2) = TI4 + (-C3QB*TR5 - C3QA*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R3) = TR0 - TR1;\n\t" + "(*R4) = TR2 - ( C3QA*TR3 + C3QB*TI3);\n\t" + "(*R5) = TR4 - (-C3QA*TR5 + C3QB*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I3) = TI0 - TI1;\n\t" + "(*I4) = TI2 - (-C3QB*TR3 + C3QA*TI3);\n\t" + "(*I5) = TI4 - (-C3QB*TR5 - C3QA*TI5);\n\t"; + } + } else { + if (cReg) { + bflyStr += "TR0 = (*R0).x + (*R2).x + (*R4).x;\n\t" + "TR2 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) - " + "C3QB*((*R2).y - (*R4).y);\n\t" + "TR4 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) + " + "C3QB*((*R2).y - (*R4).y);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*R0).y + (*R2).y + (*R4).y;\n\t" + "TI2 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) + " + "C3QB*((*R2).x - (*R4).x);\n\t" + "TI4 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) - " + "C3QB*((*R2).x - (*R4).x);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TR1 = (*R1).x + (*R3).x + (*R5).x;\n\t" + "TR3 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) - " + "C3QB*((*R3).y - (*R5).y);\n\t" + "TR5 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) + " + "C3QB*((*R3).y - (*R5).y);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI1 = (*R1).y + (*R3).y + (*R5).y;\n\t" + "TI3 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) + " + "C3QB*((*R3).x - (*R5).x);\n\t" + "TI5 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) - " + "C3QB*((*R3).x - (*R5).x);\n\t"; + + bflyStr += "\n\t"; - bflyStr += "\n\t"; + bflyStr += "(*R0).x = TR0 + TR1;\n\t" + "(*R1).x = TR2 + ( C3QA*TR3 - C3QB*TI3);\n\t" + "(*R2).x = TR4 + (-C3QA*TR5 - C3QB*TI5);\n\t"; - bflyStr += - "(*I3) = TI0 - TI1;\n\t" - "(*I4) = TI2 - (-C3QB*TR3 + C3QA*TI3);\n\t" - "(*I5) = TI4 - (-C3QB*TR5 - C3QA*TI5);\n\t"; - } - } - else - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R2).x + (*R4).x;\n\t" - "TR2 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) - C3QB*((*R2).y - (*R4).y);\n\t" - "TR4 = ((*R0).x - C3QA*((*R2).x + (*R4).x)) + C3QB*((*R2).y - (*R4).y);\n\t"; + bflyStr += "\n\t"; - bflyStr += "\n\t"; + bflyStr += "(*R0).y = TI0 + TI1;\n\t" + "(*R1).y = TI2 + ( C3QB*TR3 + C3QA*TI3);\n\t" + "(*R2).y = TI4 + ( C3QB*TR5 - C3QA*TI5);\n\t"; - bflyStr += - "TI0 = (*R0).y + (*R2).y + (*R4).y;\n\t" - "TI2 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) + C3QB*((*R2).x - (*R4).x);\n\t" - "TI4 = ((*R0).y - C3QA*((*R2).y + (*R4).y)) - C3QB*((*R2).x - (*R4).x);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = (*R1).x + (*R3).x + (*R5).x;\n\t" - "TR3 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) - C3QB*((*R3).y - (*R5).y);\n\t" - "TR5 = ((*R1).x - C3QA*((*R3).x + (*R5).x)) + C3QB*((*R3).y - (*R5).y);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = (*R1).y + (*R3).y + (*R5).y;\n\t" - "TI3 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) + C3QB*((*R3).x - (*R5).x);\n\t" - "TI5 = ((*R1).y - C3QA*((*R3).y + (*R5).y)) - C3QB*((*R3).x - (*R5).x);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).x = TR0 + TR1;\n\t" - "(*R1).x = TR2 + ( C3QA*TR3 - C3QB*TI3);\n\t" - "(*R2).x = TR4 + (-C3QA*TR5 - C3QB*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).y = TI0 + TI1;\n\t" - "(*R1).y = TI2 + ( C3QB*TR3 + C3QA*TI3);\n\t" - "(*R2).y = TI4 + ( C3QB*TR5 - C3QA*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R3).x = TR0 - TR1;\n\t" - "(*R4).x = TR2 - ( C3QA*TR3 - C3QB*TI3);\n\t" - "(*R5).x = TR4 - (-C3QA*TR5 - C3QB*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R3).y = TI0 - TI1;\n\t" - "(*R4).y = TI2 - ( C3QB*TR3 + C3QA*TI3);\n\t" - "(*R5).y = TI4 - ( C3QB*TR5 - C3QA*TI5);\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R2 + *R4;\n\t" - "TR2 = (*R0 - C3QA*(*R2 + *R4)) - C3QB*(*I2 - *I4);\n\t" - "TR4 = (*R0 - C3QA*(*R2 + *R4)) + C3QB*(*I2 - *I4);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I2 + *I4;\n\t" - "TI2 = (*I0 - C3QA*(*I2 + *I4)) + C3QB*(*R2 - *R4);\n\t" - "TI4 = (*I0 - C3QA*(*I2 + *I4)) - C3QB*(*R2 - *R4);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = *R1 + *R3 + *R5;\n\t" - "TR3 = (*R1 - C3QA*(*R3 + *R5)) - C3QB*(*I3 - *I5);\n\t" - "TR5 = (*R1 - C3QA*(*R3 + *R5)) + C3QB*(*I3 - *I5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = *I1 + *I3 + *I5;\n\t" - "TI3 = (*I1 - C3QA*(*I3 + *I5)) + C3QB*(*R3 - *R5);\n\t" - "TI5 = (*I1 - C3QA*(*I3 + *I5)) - C3QB*(*R3 - *R5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0) = TR0 + TR1;\n\t" - "(*R1) = TR2 + ( C3QA*TR3 - C3QB*TI3);\n\t" - "(*R2) = TR4 + (-C3QA*TR5 - C3QB*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*I0) = TI0 + TI1;\n\t" - "(*I1) = TI2 + ( C3QB*TR3 + C3QA*TI3);\n\t" - "(*I2) = TI4 + ( C3QB*TR5 - C3QA*TI5);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R3) = TR0 - TR1;\n\t" - "(*R4) = TR2 - ( C3QA*TR3 - C3QB*TI3);\n\t" - "(*R5) = TR4 - (-C3QA*TR5 - C3QB*TI5);\n\t"; + bflyStr += "\n\t"; - bflyStr += "\n\t"; + bflyStr += "(*R3).x = TR0 - TR1;\n\t" + "(*R4).x = TR2 - ( C3QA*TR3 - C3QB*TI3);\n\t" + "(*R5).x = TR4 - (-C3QA*TR5 - C3QB*TI5);\n\t"; - bflyStr += - "(*I3) = TI0 - TI1;\n\t" - "(*I4) = TI2 - ( C3QB*TR3 + C3QA*TI3);\n\t" - "(*I5) = TI4 - ( C3QB*TR5 - C3QA*TI5);\n\t"; - } - } - } break; - case 7: - { - static const char *C7SFR = "\ + bflyStr += "\n\t"; + + bflyStr += "(*R3).y = TI0 - TI1;\n\t" + "(*R4).y = TI2 - ( C3QB*TR3 + C3QA*TI3);\n\t" + "(*R5).y = TI4 - ( C3QB*TR5 - C3QA*TI5);\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R2 + *R4;\n\t" + "TR2 = (*R0 - C3QA*(*R2 + *R4)) - C3QB*(*I2 - *I4);\n\t" + "TR4 = (*R0 - C3QA*(*R2 + *R4)) + C3QB*(*I2 - *I4);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I2 + *I4;\n\t" + "TI2 = (*I0 - C3QA*(*I2 + *I4)) + C3QB*(*R2 - *R4);\n\t" + "TI4 = (*I0 - C3QA*(*I2 + *I4)) - C3QB*(*R2 - *R4);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TR1 = *R1 + *R3 + *R5;\n\t" + "TR3 = (*R1 - C3QA*(*R3 + *R5)) - C3QB*(*I3 - *I5);\n\t" + "TR5 = (*R1 - C3QA*(*R3 + *R5)) + C3QB*(*I3 - *I5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI1 = *I1 + *I3 + *I5;\n\t" + "TI3 = (*I1 - C3QA*(*I3 + *I5)) + C3QB*(*R3 - *R5);\n\t" + "TI5 = (*I1 - C3QA*(*I3 + *I5)) - C3QB*(*R3 - *R5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0) = TR0 + TR1;\n\t" + "(*R1) = TR2 + ( C3QA*TR3 - C3QB*TI3);\n\t" + "(*R2) = TR4 + (-C3QA*TR5 - C3QB*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I0) = TI0 + TI1;\n\t" + "(*I1) = TI2 + ( C3QB*TR3 + C3QA*TI3);\n\t" + "(*I2) = TI4 + ( C3QB*TR5 - C3QA*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R3) = TR0 - TR1;\n\t" + "(*R4) = TR2 - ( C3QA*TR3 - C3QB*TI3);\n\t" + "(*R5) = TR4 - (-C3QA*TR5 - C3QB*TI5);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I3) = TI0 - TI1;\n\t" + "(*I4) = TI2 - ( C3QB*TR3 + C3QA*TI3);\n\t" + "(*I5) = TI4 - ( C3QB*TR5 - C3QA*TI5);\n\t"; + } + } + } break; + case 7: { + static const char *C7SFR = "\ /*FFT7 Forward Real */ \n\ \n\ pr0 = *R1 + *R6; \n\ @@ -988,7 +960,7 @@ namespace StockhamGenerator TI6 = pi7 + qr6; \n\ "; - static const char *C7SBR = "\ + static const char *C7SBR = "\ /*FFT7 Backward Real */ \n\ \n\ pr0 = *R1 + *R6; \n\ @@ -1087,7 +1059,7 @@ namespace StockhamGenerator TI6 = pi7 + qr6; \n\ "; - static const char *C7SFC = "\ + static const char *C7SFC = "\ /*FFT7 Forward Complex */ \n\ \n\ p0 = *R1 + *R6; \n\ @@ -1148,7 +1120,7 @@ namespace StockhamGenerator (*R6).y = p7.y + q6.x; \n\ "; - static const char *C7SBC = "\ + static const char *C7SBC = "\ /*FFT7 Backward Complex */ \n\ \n\ p0 = *R1 + *R6; \n\ @@ -1209,448 +1181,560 @@ namespace StockhamGenerator (*R6).y = p7.y + q6.x; \n\ "; - - - if (!cReg) { - for (size_t i = 0; i < 10; i++) - bflyStr += regType + " pr" + SztToStr(i) + ", pi" + SztToStr(i) + ";\n\t"; - for (size_t i = 0; i < 9; i++) - bflyStr += regType + " qr" + SztToStr(i) + ", qi" + SztToStr(i) + ";\n\t"; - - if (fwd) - bflyStr += C7SFR; - else - bflyStr += C7SBR; - } else { - for (size_t i = 0; i < 10; i++) - bflyStr += regType + " p" + SztToStr(i) + ";\n\t"; - for (size_t i = 0; i < 9; i++) - bflyStr += regType + " q" + SztToStr(i) + ";\n\t"; - if (fwd) - bflyStr += C7SFC; - else - bflyStr += C7SBC; - } - } - break; - - case 8: - { - if(fwd) - { - if(cReg) - { - bflyStr += - "(*R1) = (*R0) - (*R1);\n\t" - "(*R0) = 2.0f * (*R0) - (*R1);\n\t" - "(*R3) = (*R2) - (*R3);\n\t" - "(*R2) = 2.0f * (*R2) - (*R3);\n\t" - "(*R5) = (*R4) - (*R5);\n\t" - "(*R4) = 2.0f * (*R4) - (*R5);\n\t" - "(*R7) = (*R6) - (*R7);\n\t" - "(*R6) = 2.0f * (*R6) - (*R7);\n\t" - "\n\t" - "(*R2) = (*R0) - (*R2);\n\t" - "(*R0) = 2.0f * (*R0) - (*R2);\n\t" - "(*R3) = (*R1) + (fvect2)(-(*R3).y, (*R3).x);\n\t" - "(*R1) = 2.0f * (*R1) - (*R3);\n\t" - "(*R6) = (*R4) - (*R6);\n\t" - "(*R4) = 2.0f * (*R4) - (*R6);\n\t" - "(*R7) = (*R5) + (fvect2)(-(*R7).y, (*R7).x);\n\t" - "(*R5) = 2.0f * (*R5) - (*R7);\n\t" - "\n\t" - "(*R4) = (*R0) - (*R4);\n\t" - "(*R0) = 2.0f * (*R0) - (*R4);\n\t" - "(*R5) = ((*R1) - C8Q * (*R5)) - C8Q * (fvect2)((*R5).y, -(*R5).x);\n\t" - "(*R1) = 2.0f * (*R1) - (*R5);\n\t" - "(*R6) = (*R2) + (fvect2)(-(*R6).y, (*R6).x);\n\t" - "(*R2) = 2.0f * (*R2) - (*R6);\n\t" - "(*R7) = ((*R3) + C8Q * (*R7)) - C8Q * (fvect2)((*R7).y, -(*R7).x);\n\t" - "(*R3) = 2.0f * (*R3) - (*R7);\n\t"; - } - else - { - bflyStr += - "TR0 = (*R0) + (*R4) + (*R2) + (*R6) + (*R1) + (*R3) + (*R5) + (*R7) ;\n\t" - "TR1 = (*R0) - (*R4) + (*I2) - (*I6) + C8Q*(*R1) + C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) - C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t" - "TR2 = (*R0) + (*R4) - (*R2) - (*R6) + (*I1) - (*I3) + (*I5) - (*I7);\n\t" - "TR3 = (*R0) - (*R4) - (*I2) + (*I6) - C8Q*(*R1) + C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) - C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" - "TR4 = (*R0) + (*R4) + (*R2) + (*R6) - (*R1) - (*R3) - (*R5) - (*R7) ;\n\t" - "TR5 = (*R0) - (*R4) + (*I2) - (*I6) - C8Q*(*R1) - C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) + C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t" - "TR6 = (*R0) + (*R4) - (*R2) - (*R6) - (*I1) + (*I3) - (*I5) + (*I7);\n\t" - "TR7 = (*R0) - (*R4) - (*I2) + (*I6) + C8Q*(*R1) - C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) + C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*I0) + (*I4) + (*I2) + (*I6) + (*I1) + (*I3) + (*I5) + (*I7);\n\t" - "TI1 = (*I0) - (*I4) - (*R2) + (*R6) - C8Q*(*R1) + C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) - C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t" - "TI2 = (*I0) + (*I4) - (*I2) - (*I6) - (*R1) + (*R3) - (*R5) + (*R7) ;\n\t" - "TI3 = (*I0) - (*I4) + (*R2) - (*R6) - C8Q*(*R1) - C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) + C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t" - "TI4 = (*I0) + (*I4) + (*I2) + (*I6) - (*I1) - (*I3) - (*I5) - (*I7);\n\t" - "TI5 = (*I0) - (*I4) - (*R2) + (*R6) + C8Q*(*R1) - C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) + C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" - "TI6 = (*I0) + (*I4) - (*I2) - (*I6) + (*R1) - (*R3) + (*R5) - (*R7) ;\n\t" - "TI7 = (*I0) - (*I4) + (*R2) - (*R6) + C8Q*(*R1) + C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) - C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t"; - } - } - else - { - if(cReg) - { - bflyStr += - "(*R1) = (*R0) - (*R1);\n\t" - "(*R0) = 2.0f * (*R0) - (*R1);\n\t" - "(*R3) = (*R2) - (*R3);\n\t" - "(*R2) = 2.0f * (*R2) - (*R3);\n\t" - "(*R5) = (*R4) - (*R5);\n\t" - "(*R4) = 2.0f * (*R4) - (*R5);\n\t" - "(*R7) = (*R6) - (*R7);\n\t" - "(*R6) = 2.0f * (*R6) - (*R7);\n\t" - "\n\t" - "(*R2) = (*R0) - (*R2);\n\t" - "(*R0) = 2.0f * (*R0) - (*R2);\n\t" - "(*R3) = (*R1) + (fvect2)((*R3).y, -(*R3).x);\n\t" - "(*R1) = 2.0f * (*R1) - (*R3);\n\t" - "(*R6) = (*R4) - (*R6);\n\t" - "(*R4) = 2.0f * (*R4) - (*R6);\n\t" - "(*R7) = (*R5) + (fvect2)((*R7).y, -(*R7).x);\n\t" - "(*R5) = 2.0f * (*R5) - (*R7);\n\t" - "\n\t" - "(*R4) = (*R0) - (*R4);\n\t" - "(*R0) = 2.0f * (*R0) - (*R4);\n\t" - "(*R5) = ((*R1) - C8Q * (*R5)) + C8Q * (fvect2)((*R5).y, -(*R5).x);\n\t" - "(*R1) = 2.0f * (*R1) - (*R5);\n\t" - "(*R6) = (*R2) + (fvect2)((*R6).y, -(*R6).x);\n\t" - "(*R2) = 2.0f * (*R2) - (*R6);\n\t" - "(*R7) = ((*R3) + C8Q * (*R7)) + C8Q * (fvect2)((*R7).y, -(*R7).x);\n\t" - "(*R3) = 2.0f * (*R3) - (*R7);\n\t"; - } - else - { - bflyStr += - "TR0 = (*R0) + (*R4) + (*R2) + (*R6) + (*R1) + (*R3) + (*R5) + (*R7) ;\n\t" - "TR1 = (*R0) - (*R4) - (*I2) + (*I6) + C8Q*(*R1) - C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) + C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t" - "TR2 = (*R0) + (*R4) - (*R2) - (*R6) - (*I1) + (*I3) - (*I5) + (*I7);\n\t" - "TR3 = (*R0) - (*R4) + (*I2) - (*I6) - C8Q*(*R1) - C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) + C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t" - "TR4 = (*R0) + (*R4) + (*R2) + (*R6) - (*R1) - (*R3) - (*R5) - (*R7) ;\n\t" - "TR5 = (*R0) - (*R4) - (*I2) + (*I6) - C8Q*(*R1) + C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) - C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" - "TR6 = (*R0) + (*R4) - (*R2) - (*R6) + (*I1) - (*I3) + (*I5) - (*I7);\n\t" - "TR7 = (*R0) - (*R4) + (*I2) - (*I6) + C8Q*(*R1) + C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) - C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*I0) + (*I4) + (*I2) + (*I6) + (*I1) + (*I3) + (*I5) + (*I7);\n\t" - "TI1 = (*I0) - (*I4) + (*R2) - (*R6) + C8Q*(*R1) + C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) - C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t" - "TI2 = (*I0) + (*I4) - (*I2) - (*I6) + (*R1) - (*R3) + (*R5) - (*R7) ;\n\t" - "TI3 = (*I0) - (*I4) - (*R2) + (*R6) + C8Q*(*R1) - C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) + C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" - "TI4 = (*I0) + (*I4) + (*I2) + (*I6) - (*I1) - (*I3) - (*I5) - (*I7);\n\t" - "TI5 = (*I0) - (*I4) + (*R2) - (*R6) - C8Q*(*R1) - C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) + C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t" - "TI6 = (*I0) + (*I4) - (*I2) - (*I6) - (*R1) + (*R3) - (*R5) + (*R7) ;\n\t" - "TI7 = (*I0) - (*I4) - (*R2) + (*R6) - C8Q*(*R1) + C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) - C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t"; - } - } - } break; - case 10: - { - if(fwd) - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R2).x + (*R4).x + (*R6).x + (*R8).x;\n\t" - "TR2 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) + C5QB*((*R2).y - (*R8).y) + C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) + ((*R8).x - (*R6).x));\n\t" - "TR8 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) - C5QB*((*R2).y - (*R8).y) - C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) + ((*R8).x - (*R6).x));\n\t" - "TR4 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) - C5QB*((*R4).y - (*R6).y) + C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) + ((*R6).x - (*R8).x));\n\t" - "TR6 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) + C5QB*((*R4).y - (*R6).y) - C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) + ((*R6).x - (*R8).x));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R2).y + (*R4).y + (*R6).y + (*R8).y;\n\t" - "TI2 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) - C5QB*((*R2).x - (*R8).x) - C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) + ((*R8).y - (*R6).y));\n\t" - "TI8 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) + C5QB*((*R2).x - (*R8).x) + C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) + ((*R8).y - (*R6).y));\n\t" - "TI4 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) + C5QB*((*R4).x - (*R6).x) - C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) + ((*R6).y - (*R8).y));\n\t" - "TI6 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) - C5QB*((*R4).x - (*R6).x) + C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) + ((*R6).y - (*R8).y));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = (*R1).x + (*R3).x + (*R5).x + (*R7).x + (*R9).x;\n\t" - "TR3 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) + C5QB*((*R3).y - (*R9).y) + C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) + ((*R9).x - (*R7).x));\n\t" - "TR9 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) - C5QB*((*R3).y - (*R9).y) - C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) + ((*R9).x - (*R7).x));\n\t" - "TR5 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) - C5QB*((*R5).y - (*R7).y) + C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) + ((*R7).x - (*R9).x));\n\t" - "TR7 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) + C5QB*((*R5).y - (*R7).y) - C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) + ((*R7).x - (*R9).x));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = (*R1).y + (*R3).y + (*R5).y + (*R7).y + (*R9).y;\n\t" - "TI3 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) - C5QB*((*R3).x - (*R9).x) - C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) + ((*R9).y - (*R7).y));\n\t" - "TI9 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) + C5QB*((*R3).x - (*R9).x) + C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) + ((*R9).y - (*R7).y));\n\t" - "TI5 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) + C5QB*((*R5).x - (*R7).x) - C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) + ((*R7).y - (*R9).y));\n\t" - "TI7 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) - C5QB*((*R5).x - (*R7).x) + C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) + ((*R7).y - (*R9).y));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).x = TR0 + TR1;\n\t" - "(*R1).x = TR2 + ( C5QE*TR3 + C5QD*TI3);\n\t" - "(*R2).x = TR4 + ( C5QA*TR5 + C5QB*TI5);\n\t" - "(*R3).x = TR6 + (-C5QA*TR7 + C5QB*TI7);\n\t" - "(*R4).x = TR8 + (-C5QE*TR9 + C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).y = TI0 + TI1;\n\t" - "(*R1).y = TI2 + (-C5QD*TR3 + C5QE*TI3);\n\t" - "(*R2).y = TI4 + (-C5QB*TR5 + C5QA*TI5);\n\t" - "(*R3).y = TI6 + (-C5QB*TR7 - C5QA*TI7);\n\t" - "(*R4).y = TI8 + (-C5QD*TR9 - C5QE*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R5).x = TR0 - TR1;\n\t" - "(*R6).x = TR2 - ( C5QE*TR3 + C5QD*TI3);\n\t" - "(*R7).x = TR4 - ( C5QA*TR5 + C5QB*TI5);\n\t" - "(*R8).x = TR6 - (-C5QA*TR7 + C5QB*TI7);\n\t" - "(*R9).x = TR8 - (-C5QE*TR9 + C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R5).y = TI0 - TI1;\n\t" - "(*R6).y = TI2 - (-C5QD*TR3 + C5QE*TI3);\n\t" - "(*R7).y = TI4 - (-C5QB*TR5 + C5QA*TI5);\n\t" - "(*R8).y = TI6 - (-C5QB*TR7 - C5QA*TI7);\n\t" - "(*R9).y = TI8 - (-C5QD*TR9 - C5QE*TI9);\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R2 + *R4 + *R6 + *R8;\n\t" - "TR2 = (*R0 - C5QC*(*R4 + *R6)) + C5QB*(*I2 - *I8) + C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" - "TR8 = (*R0 - C5QC*(*R4 + *R6)) - C5QB*(*I2 - *I8) - C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" - "TR4 = (*R0 - C5QC*(*R2 + *R8)) - C5QB*(*I4 - *I6) + C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t" - "TR6 = (*R0 - C5QC*(*R2 + *R8)) + C5QB*(*I4 - *I6) - C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I2 + *I4 + *I6 + *I8;\n\t" - "TI2 = (*I0 - C5QC*(*I4 + *I6)) - C5QB*(*R2 - *R8) - C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" - "TI8 = (*I0 - C5QC*(*I4 + *I6)) + C5QB*(*R2 - *R8) + C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" - "TI4 = (*I0 - C5QC*(*I2 + *I8)) + C5QB*(*R4 - *R6) - C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t" - "TI6 = (*I0 - C5QC*(*I2 + *I8)) - C5QB*(*R4 - *R6) + C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = *R1 + *R3 + *R5 + *R7 + *R9;\n\t" - "TR3 = (*R1 - C5QC*(*R5 + *R7)) + C5QB*(*I3 - *I9) + C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" - "TR9 = (*R1 - C5QC*(*R5 + *R7)) - C5QB*(*I3 - *I9) - C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" - "TR5 = (*R1 - C5QC*(*R3 + *R9)) - C5QB*(*I5 - *I7) + C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t" - "TR7 = (*R1 - C5QC*(*R3 + *R9)) + C5QB*(*I5 - *I7) - C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = *I1 + *I3 + *I5 + *I7 + *I9;\n\t" - "TI3 = (*I1 - C5QC*(*I5 + *I7)) - C5QB*(*R3 - *R9) - C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" - "TI9 = (*I1 - C5QC*(*I5 + *I7)) + C5QB*(*R3 - *R9) + C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" - "TI5 = (*I1 - C5QC*(*I3 + *I9)) + C5QB*(*R5 - *R7) - C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t" - "TI7 = (*I1 - C5QC*(*I3 + *I9)) - C5QB*(*R5 - *R7) + C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0) = TR0 + TR1;\n\t" - "(*R1) = TR2 + ( C5QE*TR3 + C5QD*TI3);\n\t" - "(*R2) = TR4 + ( C5QA*TR5 + C5QB*TI5);\n\t" - "(*R3) = TR6 + (-C5QA*TR7 + C5QB*TI7);\n\t" - "(*R4) = TR8 + (-C5QE*TR9 + C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*I0) = TI0 + TI1;\n\t" - "(*I1) = TI2 + (-C5QD*TR3 + C5QE*TI3);\n\t" - "(*I2) = TI4 + (-C5QB*TR5 + C5QA*TI5);\n\t" - "(*I3) = TI6 + (-C5QB*TR7 - C5QA*TI7);\n\t" - "(*I4) = TI8 + (-C5QD*TR9 - C5QE*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R5) = TR0 - TR1;\n\t" - "(*R6) = TR2 - ( C5QE*TR3 + C5QD*TI3);\n\t" - "(*R7) = TR4 - ( C5QA*TR5 + C5QB*TI5);\n\t" - "(*R8) = TR6 - (-C5QA*TR7 + C5QB*TI7);\n\t" - "(*R9) = TR8 - (-C5QE*TR9 + C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*I5) = TI0 - TI1;\n\t" - "(*I6) = TI2 - (-C5QD*TR3 + C5QE*TI3);\n\t" - "(*I7) = TI4 - (-C5QB*TR5 + C5QA*TI5);\n\t" - "(*I8) = TI6 - (-C5QB*TR7 - C5QA*TI7);\n\t" - "(*I9) = TI8 - (-C5QD*TR9 - C5QE*TI9);\n\t"; - } - } - else - { - if(cReg) - { - bflyStr += - "TR0 = (*R0).x + (*R2).x + (*R4).x + (*R6).x + (*R8).x;\n\t" - "TR2 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) - C5QB*((*R2).y - (*R8).y) - C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) + ((*R8).x - (*R6).x));\n\t" - "TR8 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) + C5QB*((*R2).y - (*R8).y) + C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) + ((*R8).x - (*R6).x));\n\t" - "TR4 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) + C5QB*((*R4).y - (*R6).y) - C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) + ((*R6).x - (*R8).x));\n\t" - "TR6 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) - C5QB*((*R4).y - (*R6).y) + C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) + ((*R6).x - (*R8).x));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = (*R0).y + (*R2).y + (*R4).y + (*R6).y + (*R8).y;\n\t" - "TI2 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) + C5QB*((*R2).x - (*R8).x) + C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) + ((*R8).y - (*R6).y));\n\t" - "TI8 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) - C5QB*((*R2).x - (*R8).x) - C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) + ((*R8).y - (*R6).y));\n\t" - "TI4 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) - C5QB*((*R4).x - (*R6).x) + C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) + ((*R6).y - (*R8).y));\n\t" - "TI6 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) + C5QB*((*R4).x - (*R6).x) - C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) + ((*R6).y - (*R8).y));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = (*R1).x + (*R3).x + (*R5).x + (*R7).x + (*R9).x;\n\t" - "TR3 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) - C5QB*((*R3).y - (*R9).y) - C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) + ((*R9).x - (*R7).x));\n\t" - "TR9 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) + C5QB*((*R3).y - (*R9).y) + C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) + ((*R9).x - (*R7).x));\n\t" - "TR5 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) + C5QB*((*R5).y - (*R7).y) - C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) + ((*R7).x - (*R9).x));\n\t" - "TR7 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) - C5QB*((*R5).y - (*R7).y) + C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) + ((*R7).x - (*R9).x));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = (*R1).y + (*R3).y + (*R5).y + (*R7).y + (*R9).y;\n\t" - "TI3 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) + C5QB*((*R3).x - (*R9).x) + C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) + ((*R9).y - (*R7).y));\n\t" - "TI9 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) - C5QB*((*R3).x - (*R9).x) - C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) + ((*R9).y - (*R7).y));\n\t" - "TI5 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) - C5QB*((*R5).x - (*R7).x) + C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) + ((*R7).y - (*R9).y));\n\t" - "TI7 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) + C5QB*((*R5).x - (*R7).x) - C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) + ((*R7).y - (*R9).y));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).x = TR0 + TR1;\n\t" - "(*R1).x = TR2 + ( C5QE*TR3 - C5QD*TI3);\n\t" - "(*R2).x = TR4 + ( C5QA*TR5 - C5QB*TI5);\n\t" - "(*R3).x = TR6 + (-C5QA*TR7 - C5QB*TI7);\n\t" - "(*R4).x = TR8 + (-C5QE*TR9 - C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0).y = TI0 + TI1;\n\t" - "(*R1).y = TI2 + ( C5QD*TR3 + C5QE*TI3);\n\t" - "(*R2).y = TI4 + ( C5QB*TR5 + C5QA*TI5);\n\t" - "(*R3).y = TI6 + ( C5QB*TR7 - C5QA*TI7);\n\t" - "(*R4).y = TI8 + ( C5QD*TR9 - C5QE*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R5).x = TR0 - TR1;\n\t" - "(*R6).x = TR2 - ( C5QE*TR3 - C5QD*TI3);\n\t" - "(*R7).x = TR4 - ( C5QA*TR5 - C5QB*TI5);\n\t" - "(*R8).x = TR6 - (-C5QA*TR7 - C5QB*TI7);\n\t" - "(*R9).x = TR8 - (-C5QE*TR9 - C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R5).y = TI0 - TI1;\n\t" - "(*R6).y = TI2 - ( C5QD*TR3 + C5QE*TI3);\n\t" - "(*R7).y = TI4 - ( C5QB*TR5 + C5QA*TI5);\n\t" - "(*R8).y = TI6 - ( C5QB*TR7 - C5QA*TI7);\n\t" - "(*R9).y = TI8 - ( C5QD*TR9 - C5QE*TI9);\n\t"; - } - else - { - bflyStr += - "TR0 = *R0 + *R2 + *R4 + *R6 + *R8;\n\t" - "TR2 = (*R0 - C5QC*(*R4 + *R6)) - C5QB*(*I2 - *I8) - C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" - "TR8 = (*R0 - C5QC*(*R4 + *R6)) + C5QB*(*I2 - *I8) + C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" - "TR4 = (*R0 - C5QC*(*R2 + *R8)) + C5QB*(*I4 - *I6) - C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t" - "TR6 = (*R0 - C5QC*(*R2 + *R8)) - C5QB*(*I4 - *I6) + C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI0 = *I0 + *I2 + *I4 + *I6 + *I8;\n\t" - "TI2 = (*I0 - C5QC*(*I4 + *I6)) + C5QB*(*R2 - *R8) + C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" - "TI8 = (*I0 - C5QC*(*I4 + *I6)) - C5QB*(*R2 - *R8) - C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" - "TI4 = (*I0 - C5QC*(*I2 + *I8)) - C5QB*(*R4 - *R6) + C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t" - "TI6 = (*I0 - C5QC*(*I2 + *I8)) + C5QB*(*R4 - *R6) - C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TR1 = *R1 + *R3 + *R5 + *R7 + *R9;\n\t" - "TR3 = (*R1 - C5QC*(*R5 + *R7)) - C5QB*(*I3 - *I9) - C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" - "TR9 = (*R1 - C5QC*(*R5 + *R7)) + C5QB*(*I3 - *I9) + C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" - "TR5 = (*R1 - C5QC*(*R3 + *R9)) + C5QB*(*I5 - *I7) - C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t" - "TR7 = (*R1 - C5QC*(*R3 + *R9)) - C5QB*(*I5 - *I7) + C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "TI1 = *I1 + *I3 + *I5 + *I7 + *I9;\n\t" - "TI3 = (*I1 - C5QC*(*I5 + *I7)) + C5QB*(*R3 - *R9) + C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" - "TI9 = (*I1 - C5QC*(*I5 + *I7)) - C5QB*(*R3 - *R9) - C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" - "TI5 = (*I1 - C5QC*(*I3 + *I9)) - C5QB*(*R5 - *R7) + C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t" - "TI7 = (*I1 - C5QC*(*I3 + *I9)) + C5QB*(*R5 - *R7) - C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R0) = TR0 + TR1;\n\t" - "(*R1) = TR2 + ( C5QE*TR3 - C5QD*TI3);\n\t" - "(*R2) = TR4 + ( C5QA*TR5 - C5QB*TI5);\n\t" - "(*R3) = TR6 + (-C5QA*TR7 - C5QB*TI7);\n\t" - "(*R4) = TR8 + (-C5QE*TR9 - C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*I0) = TI0 + TI1;\n\t" - "(*I1) = TI2 + ( C5QD*TR3 + C5QE*TI3);\n\t" - "(*I2) = TI4 + ( C5QB*TR5 + C5QA*TI5);\n\t" - "(*I3) = TI6 + ( C5QB*TR7 - C5QA*TI7);\n\t" - "(*I4) = TI8 + ( C5QD*TR9 - C5QE*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*R5) = TR0 - TR1;\n\t" - "(*R6) = TR2 - ( C5QE*TR3 - C5QD*TI3);\n\t" - "(*R7) = TR4 - ( C5QA*TR5 - C5QB*TI5);\n\t" - "(*R8) = TR6 - (-C5QA*TR7 - C5QB*TI7);\n\t" - "(*R9) = TR8 - (-C5QE*TR9 - C5QD*TI9);\n\t"; - - bflyStr += "\n\t"; - - bflyStr += - "(*I5) = TI0 - TI1;\n\t" - "(*I6) = TI2 - ( C5QD*TR3 + C5QE*TI3);\n\t" - "(*I7) = TI4 - ( C5QB*TR5 + C5QA*TI5);\n\t" - "(*I8) = TI6 - ( C5QB*TR7 - C5QA*TI7);\n\t" - "(*I9) = TI8 - ( C5QD*TR9 - C5QE*TI9);\n\t"; - } - } - } break; - case 11: - { - static const char *radix11str = " \ + if (!cReg) { + for (size_t i = 0; i < 10; i++) + bflyStr += + regType + " pr" + SztToStr(i) + ", pi" + SztToStr(i) + ";\n\t"; + for (size_t i = 0; i < 9; i++) + bflyStr += + regType + " qr" + SztToStr(i) + ", qi" + SztToStr(i) + ";\n\t"; + + if (fwd) + bflyStr += C7SFR; + else + bflyStr += C7SBR; + } else { + for (size_t i = 0; i < 10; i++) + bflyStr += regType + " p" + SztToStr(i) + ";\n\t"; + for (size_t i = 0; i < 9; i++) + bflyStr += regType + " q" + SztToStr(i) + ";\n\t"; + if (fwd) + bflyStr += C7SFC; + else + bflyStr += C7SBC; + } + } break; + + case 8: { + if (fwd) { + if (cReg) { + bflyStr += "(*R1) = (*R0) - (*R1);\n\t" + "(*R0) = 2.0f * (*R0) - (*R1);\n\t" + "(*R3) = (*R2) - (*R3);\n\t" + "(*R2) = 2.0f * (*R2) - (*R3);\n\t" + "(*R5) = (*R4) - (*R5);\n\t" + "(*R4) = 2.0f * (*R4) - (*R5);\n\t" + "(*R7) = (*R6) - (*R7);\n\t" + "(*R6) = 2.0f * (*R6) - (*R7);\n\t" + "\n\t" + "(*R2) = (*R0) - (*R2);\n\t" + "(*R0) = 2.0f * (*R0) - (*R2);\n\t" + "(*R3) = (*R1) + (fvect2)(-(*R3).y, (*R3).x);\n\t" + "(*R1) = 2.0f * (*R1) - (*R3);\n\t" + "(*R6) = (*R4) - (*R6);\n\t" + "(*R4) = 2.0f * (*R4) - (*R6);\n\t" + "(*R7) = (*R5) + (fvect2)(-(*R7).y, (*R7).x);\n\t" + "(*R5) = 2.0f * (*R5) - (*R7);\n\t" + "\n\t" + "(*R4) = (*R0) - (*R4);\n\t" + "(*R0) = 2.0f * (*R0) - (*R4);\n\t" + "(*R5) = ((*R1) - C8Q * (*R5)) - C8Q * (fvect2)((*R5).y, " + "-(*R5).x);\n\t" + "(*R1) = 2.0f * (*R1) - (*R5);\n\t" + "(*R6) = (*R2) + (fvect2)(-(*R6).y, (*R6).x);\n\t" + "(*R2) = 2.0f * (*R2) - (*R6);\n\t" + "(*R7) = ((*R3) + C8Q * (*R7)) - C8Q * (fvect2)((*R7).y, " + "-(*R7).x);\n\t" + "(*R3) = 2.0f * (*R3) - (*R7);\n\t"; + } else { + bflyStr += "TR0 = (*R0) + (*R4) + (*R2) + (*R6) + (*R1) " + " + (*R3) + (*R5) + " + "(*R7) ;\n\t" + "TR1 = (*R0) - (*R4) + (*I2) - (*I6) + C8Q*(*R1) + " + "C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) - " + "C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t" + "TR2 = (*R0) + (*R4) - (*R2) - (*R6) + " + "(*I1) - (*I3) + (*I5) " + " - (*I7);\n\t" + "TR3 = (*R0) - (*R4) - (*I2) + (*I6) - C8Q*(*R1) + " + "C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) - " + "C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" + "TR4 = (*R0) + (*R4) + (*R2) + (*R6) - (*R1) " + " - (*R3) - (*R5) - " + "(*R7) ;\n\t" + "TR5 = (*R0) - (*R4) + (*I2) - (*I6) - C8Q*(*R1) - " + "C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) + " + "C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t" + "TR6 = (*R0) + (*R4) - (*R2) - (*R6) - " + "(*I1) + (*I3) - (*I5) " + " + (*I7);\n\t" + "TR7 = (*R0) - (*R4) - (*I2) + (*I6) + C8Q*(*R1) - " + "C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) + " + "C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*I0) + (*I4) + (*I2) + (*I6) + " + "(*I1) + (*I3) + (*I5) " + " + (*I7);\n\t" + "TI1 = (*I0) - (*I4) - (*R2) + (*R6) - C8Q*(*R1) + " + "C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) - " + "C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t" + "TI2 = (*I0) + (*I4) - (*I2) - (*I6) - (*R1) " + " + (*R3) - (*R5) + " + "(*R7) ;\n\t" + "TI3 = (*I0) - (*I4) + (*R2) - (*R6) - C8Q*(*R1) - " + "C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) + " + "C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t" + "TI4 = (*I0) + (*I4) + (*I2) + (*I6) - " + "(*I1) - (*I3) - (*I5) " + " - (*I7);\n\t" + "TI5 = (*I0) - (*I4) - (*R2) + (*R6) + C8Q*(*R1) - " + "C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) + " + "C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" + "TI6 = (*I0) + (*I4) - (*I2) - (*I6) + (*R1) " + " - (*R3) + (*R5) - " + "(*R7) ;\n\t" + "TI7 = (*I0) - (*I4) + (*R2) - (*R6) + C8Q*(*R1) + " + "C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) - " + "C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t"; + } + } else { + if (cReg) { + bflyStr += "(*R1) = (*R0) - (*R1);\n\t" + "(*R0) = 2.0f * (*R0) - (*R1);\n\t" + "(*R3) = (*R2) - (*R3);\n\t" + "(*R2) = 2.0f * (*R2) - (*R3);\n\t" + "(*R5) = (*R4) - (*R5);\n\t" + "(*R4) = 2.0f * (*R4) - (*R5);\n\t" + "(*R7) = (*R6) - (*R7);\n\t" + "(*R6) = 2.0f * (*R6) - (*R7);\n\t" + "\n\t" + "(*R2) = (*R0) - (*R2);\n\t" + "(*R0) = 2.0f * (*R0) - (*R2);\n\t" + "(*R3) = (*R1) + (fvect2)((*R3).y, -(*R3).x);\n\t" + "(*R1) = 2.0f * (*R1) - (*R3);\n\t" + "(*R6) = (*R4) - (*R6);\n\t" + "(*R4) = 2.0f * (*R4) - (*R6);\n\t" + "(*R7) = (*R5) + (fvect2)((*R7).y, -(*R7).x);\n\t" + "(*R5) = 2.0f * (*R5) - (*R7);\n\t" + "\n\t" + "(*R4) = (*R0) - (*R4);\n\t" + "(*R0) = 2.0f * (*R0) - (*R4);\n\t" + "(*R5) = ((*R1) - C8Q * (*R5)) + C8Q * (fvect2)((*R5).y, " + "-(*R5).x);\n\t" + "(*R1) = 2.0f * (*R1) - (*R5);\n\t" + "(*R6) = (*R2) + (fvect2)((*R6).y, -(*R6).x);\n\t" + "(*R2) = 2.0f * (*R2) - (*R6);\n\t" + "(*R7) = ((*R3) + C8Q * (*R7)) + C8Q * (fvect2)((*R7).y, " + "-(*R7).x);\n\t" + "(*R3) = 2.0f * (*R3) - (*R7);\n\t"; + } else { + bflyStr += "TR0 = (*R0) + (*R4) + (*R2) + (*R6) + (*R1) " + " + (*R3) + (*R5) + " + "(*R7) ;\n\t" + "TR1 = (*R0) - (*R4) - (*I2) + (*I6) + C8Q*(*R1) - " + "C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) + " + "C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t" + "TR2 = (*R0) + (*R4) - (*R2) - (*R6) - " + "(*I1) + (*I3) - (*I5) " + " + (*I7);\n\t" + "TR3 = (*R0) - (*R4) + (*I2) - (*I6) - C8Q*(*R1) - " + "C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) + " + "C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t" + "TR4 = (*R0) + (*R4) + (*R2) + (*R6) - (*R1) " + " - (*R3) - (*R5) - " + "(*R7) ;\n\t" + "TR5 = (*R0) - (*R4) - (*I2) + (*I6) - C8Q*(*R1) + " + "C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) - " + "C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" + "TR6 = (*R0) + (*R4) - (*R2) - (*R6) + " + "(*I1) - (*I3) + (*I5) " + " - (*I7);\n\t" + "TR7 = (*R0) - (*R4) + (*I2) - (*I6) + C8Q*(*R1) + " + "C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) - " + "C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = (*I0) + (*I4) + (*I2) + (*I6) + " + "(*I1) + (*I3) + (*I5) " + " + (*I7);\n\t" + "TI1 = (*I0) - (*I4) + (*R2) - (*R6) + C8Q*(*R1) + " + "C8Q*(*I1) + C8Q*(*R3) - C8Q*(*I3) - C8Q*(*R5) - " + "C8Q*(*I5) - C8Q*(*R7) + C8Q*(*I7);\n\t" + "TI2 = (*I0) + (*I4) - (*I2) - (*I6) + (*R1) " + " - (*R3) + (*R5) - " + "(*R7) ;\n\t" + "TI3 = (*I0) - (*I4) - (*R2) + (*R6) + C8Q*(*R1) - " + "C8Q*(*I1) + C8Q*(*R3) + C8Q*(*I3) - C8Q*(*R5) + " + "C8Q*(*I5) - C8Q*(*R7) - C8Q*(*I7);\n\t" + "TI4 = (*I0) + (*I4) + (*I2) + (*I6) - " + "(*I1) - (*I3) - (*I5) " + " - (*I7);\n\t" + "TI5 = (*I0) - (*I4) + (*R2) - (*R6) - C8Q*(*R1) - " + "C8Q*(*I1) - C8Q*(*R3) + C8Q*(*I3) + C8Q*(*R5) + " + "C8Q*(*I5) + C8Q*(*R7) - C8Q*(*I7);\n\t" + "TI6 = (*I0) + (*I4) - (*I2) - (*I6) - (*R1) " + " + (*R3) - (*R5) + " + "(*R7) ;\n\t" + "TI7 = (*I0) - (*I4) - (*R2) + (*R6) - C8Q*(*R1) + " + "C8Q*(*I1) - C8Q*(*R3) - C8Q*(*I3) + C8Q*(*R5) - " + "C8Q*(*I5) + C8Q*(*R7) + C8Q*(*I7);\n\t"; + } + } + } break; + case 10: { + if (fwd) { + if (cReg) { + bflyStr += + "TR0 = (*R0).x + (*R2).x + (*R4).x + (*R6).x + (*R8).x;\n\t" + "TR2 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) + C5QB*((*R2).y - " + "(*R8).y) + C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) " + "+ ((*R8).x - (*R6).x));\n\t" + "TR8 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) - C5QB*((*R2).y - " + "(*R8).y) - C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) " + "+ ((*R8).x - (*R6).x));\n\t" + "TR4 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) - C5QB*((*R4).y - " + "(*R6).y) + C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) " + "+ ((*R6).x - (*R8).x));\n\t" + "TR6 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) + C5QB*((*R4).y - " + "(*R6).y) - C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) " + "+ ((*R6).x - (*R8).x));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TI0 = (*R0).y + (*R2).y + (*R4).y + (*R6).y + (*R8).y;\n\t" + "TI2 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) - C5QB*((*R2).x - " + "(*R8).x) - C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) " + "+ ((*R8).y - (*R6).y));\n\t" + "TI8 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) + C5QB*((*R2).x - " + "(*R8).x) + C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) " + "+ ((*R8).y - (*R6).y));\n\t" + "TI4 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) + C5QB*((*R4).x - " + "(*R6).x) - C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) " + "+ ((*R6).y - (*R8).y));\n\t" + "TI6 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) - C5QB*((*R4).x - " + "(*R6).x) + C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) " + "+ ((*R6).y - (*R8).y));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TR1 = (*R1).x + (*R3).x + (*R5).x + (*R7).x + (*R9).x;\n\t" + "TR3 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) + C5QB*((*R3).y - " + "(*R9).y) + C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) " + "+ ((*R9).x - (*R7).x));\n\t" + "TR9 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) - C5QB*((*R3).y - " + "(*R9).y) - C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) " + "+ ((*R9).x - (*R7).x));\n\t" + "TR5 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) - C5QB*((*R5).y - " + "(*R7).y) + C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) " + "+ ((*R7).x - (*R9).x));\n\t" + "TR7 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) + C5QB*((*R5).y - " + "(*R7).y) - C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) " + "+ ((*R7).x - (*R9).x));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TI1 = (*R1).y + (*R3).y + (*R5).y + (*R7).y + (*R9).y;\n\t" + "TI3 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) - C5QB*((*R3).x - " + "(*R9).x) - C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) " + "+ ((*R9).y - (*R7).y));\n\t" + "TI9 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) + C5QB*((*R3).x - " + "(*R9).x) + C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) " + "+ ((*R9).y - (*R7).y));\n\t" + "TI5 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) + C5QB*((*R5).x - " + "(*R7).x) - C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) " + "+ ((*R7).y - (*R9).y));\n\t" + "TI7 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) - C5QB*((*R5).x - " + "(*R7).x) + C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) " + "+ ((*R7).y - (*R9).y));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0).x = TR0 + TR1;\n\t" + "(*R1).x = TR2 + ( C5QE*TR3 + C5QD*TI3);\n\t" + "(*R2).x = TR4 + ( C5QA*TR5 + C5QB*TI5);\n\t" + "(*R3).x = TR6 + (-C5QA*TR7 + C5QB*TI7);\n\t" + "(*R4).x = TR8 + (-C5QE*TR9 + C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0).y = TI0 + TI1;\n\t" + "(*R1).y = TI2 + (-C5QD*TR3 + C5QE*TI3);\n\t" + "(*R2).y = TI4 + (-C5QB*TR5 + C5QA*TI5);\n\t" + "(*R3).y = TI6 + (-C5QB*TR7 - C5QA*TI7);\n\t" + "(*R4).y = TI8 + (-C5QD*TR9 - C5QE*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R5).x = TR0 - TR1;\n\t" + "(*R6).x = TR2 - ( C5QE*TR3 + C5QD*TI3);\n\t" + "(*R7).x = TR4 - ( C5QA*TR5 + C5QB*TI5);\n\t" + "(*R8).x = TR6 - (-C5QA*TR7 + C5QB*TI7);\n\t" + "(*R9).x = TR8 - (-C5QE*TR9 + C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R5).y = TI0 - TI1;\n\t" + "(*R6).y = TI2 - (-C5QD*TR3 + C5QE*TI3);\n\t" + "(*R7).y = TI4 - (-C5QB*TR5 + C5QA*TI5);\n\t" + "(*R8).y = TI6 - (-C5QB*TR7 - C5QA*TI7);\n\t" + "(*R9).y = TI8 - (-C5QD*TR9 - C5QE*TI9);\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R2 + *R4 + *R6 + *R8;\n\t" + "TR2 = (*R0 - C5QC*(*R4 + *R6)) + C5QB*(*I2 - *I8) + " + "C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" + "TR8 = (*R0 - C5QC*(*R4 + *R6)) - C5QB*(*I2 - *I8) - " + "C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" + "TR4 = (*R0 - C5QC*(*R2 + *R8)) - C5QB*(*I4 - *I6) + " + "C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t" + "TR6 = (*R0 - C5QC*(*R2 + *R8)) + C5QB*(*I4 - *I6) - " + "C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I2 + *I4 + *I6 + *I8;\n\t" + "TI2 = (*I0 - C5QC*(*I4 + *I6)) - C5QB*(*R2 - *R8) - " + "C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" + "TI8 = (*I0 - C5QC*(*I4 + *I6)) + C5QB*(*R2 - *R8) + " + "C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" + "TI4 = (*I0 - C5QC*(*I2 + *I8)) + C5QB*(*R4 - *R6) - " + "C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t" + "TI6 = (*I0 - C5QC*(*I2 + *I8)) - C5QB*(*R4 - *R6) + " + "C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TR1 = *R1 + *R3 + *R5 + *R7 + *R9;\n\t" + "TR3 = (*R1 - C5QC*(*R5 + *R7)) + C5QB*(*I3 - *I9) + " + "C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" + "TR9 = (*R1 - C5QC*(*R5 + *R7)) - C5QB*(*I3 - *I9) - " + "C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" + "TR5 = (*R1 - C5QC*(*R3 + *R9)) - C5QB*(*I5 - *I7) + " + "C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t" + "TR7 = (*R1 - C5QC*(*R3 + *R9)) + C5QB*(*I5 - *I7) - " + "C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI1 = *I1 + *I3 + *I5 + *I7 + *I9;\n\t" + "TI3 = (*I1 - C5QC*(*I5 + *I7)) - C5QB*(*R3 - *R9) - " + "C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" + "TI9 = (*I1 - C5QC*(*I5 + *I7)) + C5QB*(*R3 - *R9) + " + "C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" + "TI5 = (*I1 - C5QC*(*I3 + *I9)) + C5QB*(*R5 - *R7) - " + "C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t" + "TI7 = (*I1 - C5QC*(*I3 + *I9)) - C5QB*(*R5 - *R7) + " + "C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0) = TR0 + TR1;\n\t" + "(*R1) = TR2 + ( C5QE*TR3 + C5QD*TI3);\n\t" + "(*R2) = TR4 + ( C5QA*TR5 + C5QB*TI5);\n\t" + "(*R3) = TR6 + (-C5QA*TR7 + C5QB*TI7);\n\t" + "(*R4) = TR8 + (-C5QE*TR9 + C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I0) = TI0 + TI1;\n\t" + "(*I1) = TI2 + (-C5QD*TR3 + C5QE*TI3);\n\t" + "(*I2) = TI4 + (-C5QB*TR5 + C5QA*TI5);\n\t" + "(*I3) = TI6 + (-C5QB*TR7 - C5QA*TI7);\n\t" + "(*I4) = TI8 + (-C5QD*TR9 - C5QE*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R5) = TR0 - TR1;\n\t" + "(*R6) = TR2 - ( C5QE*TR3 + C5QD*TI3);\n\t" + "(*R7) = TR4 - ( C5QA*TR5 + C5QB*TI5);\n\t" + "(*R8) = TR6 - (-C5QA*TR7 + C5QB*TI7);\n\t" + "(*R9) = TR8 - (-C5QE*TR9 + C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I5) = TI0 - TI1;\n\t" + "(*I6) = TI2 - (-C5QD*TR3 + C5QE*TI3);\n\t" + "(*I7) = TI4 - (-C5QB*TR5 + C5QA*TI5);\n\t" + "(*I8) = TI6 - (-C5QB*TR7 - C5QA*TI7);\n\t" + "(*I9) = TI8 - (-C5QD*TR9 - C5QE*TI9);\n\t"; + } + } else { + if (cReg) { + bflyStr += + "TR0 = (*R0).x + (*R2).x + (*R4).x + (*R6).x + (*R8).x;\n\t" + "TR2 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) - C5QB*((*R2).y - " + "(*R8).y) - C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) " + "+ ((*R8).x - (*R6).x));\n\t" + "TR8 = ((*R0).x - C5QC*((*R4).x + (*R6).x)) + C5QB*((*R2).y - " + "(*R8).y) + C5QD*((*R4).y - (*R6).y) + C5QA*(((*R2).x - (*R4).x) " + "+ ((*R8).x - (*R6).x));\n\t" + "TR4 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) + C5QB*((*R4).y - " + "(*R6).y) - C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) " + "+ ((*R6).x - (*R8).x));\n\t" + "TR6 = ((*R0).x - C5QC*((*R2).x + (*R8).x)) - C5QB*((*R4).y - " + "(*R6).y) + C5QD*((*R2).y - (*R8).y) + C5QA*(((*R4).x - (*R2).x) " + "+ ((*R6).x - (*R8).x));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TI0 = (*R0).y + (*R2).y + (*R4).y + (*R6).y + (*R8).y;\n\t" + "TI2 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) + C5QB*((*R2).x - " + "(*R8).x) + C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) " + "+ ((*R8).y - (*R6).y));\n\t" + "TI8 = ((*R0).y - C5QC*((*R4).y + (*R6).y)) - C5QB*((*R2).x - " + "(*R8).x) - C5QD*((*R4).x - (*R6).x) + C5QA*(((*R2).y - (*R4).y) " + "+ ((*R8).y - (*R6).y));\n\t" + "TI4 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) - C5QB*((*R4).x - " + "(*R6).x) + C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) " + "+ ((*R6).y - (*R8).y));\n\t" + "TI6 = ((*R0).y - C5QC*((*R2).y + (*R8).y)) + C5QB*((*R4).x - " + "(*R6).x) - C5QD*((*R2).x - (*R8).x) + C5QA*(((*R4).y - (*R2).y) " + "+ ((*R6).y - (*R8).y));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TR1 = (*R1).x + (*R3).x + (*R5).x + (*R7).x + (*R9).x;\n\t" + "TR3 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) - C5QB*((*R3).y - " + "(*R9).y) - C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) " + "+ ((*R9).x - (*R7).x));\n\t" + "TR9 = ((*R1).x - C5QC*((*R5).x + (*R7).x)) + C5QB*((*R3).y - " + "(*R9).y) + C5QD*((*R5).y - (*R7).y) + C5QA*(((*R3).x - (*R5).x) " + "+ ((*R9).x - (*R7).x));\n\t" + "TR5 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) + C5QB*((*R5).y - " + "(*R7).y) - C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) " + "+ ((*R7).x - (*R9).x));\n\t" + "TR7 = ((*R1).x - C5QC*((*R3).x + (*R9).x)) - C5QB*((*R5).y - " + "(*R7).y) + C5QD*((*R3).y - (*R9).y) + C5QA*(((*R5).x - (*R3).x) " + "+ ((*R7).x - (*R9).x));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += + "TI1 = (*R1).y + (*R3).y + (*R5).y + (*R7).y + (*R9).y;\n\t" + "TI3 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) + C5QB*((*R3).x - " + "(*R9).x) + C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) " + "+ ((*R9).y - (*R7).y));\n\t" + "TI9 = ((*R1).y - C5QC*((*R5).y + (*R7).y)) - C5QB*((*R3).x - " + "(*R9).x) - C5QD*((*R5).x - (*R7).x) + C5QA*(((*R3).y - (*R5).y) " + "+ ((*R9).y - (*R7).y));\n\t" + "TI5 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) - C5QB*((*R5).x - " + "(*R7).x) + C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) " + "+ ((*R7).y - (*R9).y));\n\t" + "TI7 = ((*R1).y - C5QC*((*R3).y + (*R9).y)) + C5QB*((*R5).x - " + "(*R7).x) - C5QD*((*R3).x - (*R9).x) + C5QA*(((*R5).y - (*R3).y) " + "+ ((*R7).y - (*R9).y));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0).x = TR0 + TR1;\n\t" + "(*R1).x = TR2 + ( C5QE*TR3 - C5QD*TI3);\n\t" + "(*R2).x = TR4 + ( C5QA*TR5 - C5QB*TI5);\n\t" + "(*R3).x = TR6 + (-C5QA*TR7 - C5QB*TI7);\n\t" + "(*R4).x = TR8 + (-C5QE*TR9 - C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0).y = TI0 + TI1;\n\t" + "(*R1).y = TI2 + ( C5QD*TR3 + C5QE*TI3);\n\t" + "(*R2).y = TI4 + ( C5QB*TR5 + C5QA*TI5);\n\t" + "(*R3).y = TI6 + ( C5QB*TR7 - C5QA*TI7);\n\t" + "(*R4).y = TI8 + ( C5QD*TR9 - C5QE*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R5).x = TR0 - TR1;\n\t" + "(*R6).x = TR2 - ( C5QE*TR3 - C5QD*TI3);\n\t" + "(*R7).x = TR4 - ( C5QA*TR5 - C5QB*TI5);\n\t" + "(*R8).x = TR6 - (-C5QA*TR7 - C5QB*TI7);\n\t" + "(*R9).x = TR8 - (-C5QE*TR9 - C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R5).y = TI0 - TI1;\n\t" + "(*R6).y = TI2 - ( C5QD*TR3 + C5QE*TI3);\n\t" + "(*R7).y = TI4 - ( C5QB*TR5 + C5QA*TI5);\n\t" + "(*R8).y = TI6 - ( C5QB*TR7 - C5QA*TI7);\n\t" + "(*R9).y = TI8 - ( C5QD*TR9 - C5QE*TI9);\n\t"; + } else { + bflyStr += "TR0 = *R0 + *R2 + *R4 + *R6 + *R8;\n\t" + "TR2 = (*R0 - C5QC*(*R4 + *R6)) - C5QB*(*I2 - *I8) - " + "C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" + "TR8 = (*R0 - C5QC*(*R4 + *R6)) + C5QB*(*I2 - *I8) + " + "C5QD*(*I4 - *I6) + C5QA*((*R2 - *R4) + (*R8 - *R6));\n\t" + "TR4 = (*R0 - C5QC*(*R2 + *R8)) + C5QB*(*I4 - *I6) - " + "C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t" + "TR6 = (*R0 - C5QC*(*R2 + *R8)) - C5QB*(*I4 - *I6) + " + "C5QD*(*I2 - *I8) + C5QA*((*R4 - *R2) + (*R6 - *R8));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI0 = *I0 + *I2 + *I4 + *I6 + *I8;\n\t" + "TI2 = (*I0 - C5QC*(*I4 + *I6)) + C5QB*(*R2 - *R8) + " + "C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" + "TI8 = (*I0 - C5QC*(*I4 + *I6)) - C5QB*(*R2 - *R8) - " + "C5QD*(*R4 - *R6) + C5QA*((*I2 - *I4) + (*I8 - *I6));\n\t" + "TI4 = (*I0 - C5QC*(*I2 + *I8)) - C5QB*(*R4 - *R6) + " + "C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t" + "TI6 = (*I0 - C5QC*(*I2 + *I8)) + C5QB*(*R4 - *R6) - " + "C5QD*(*R2 - *R8) + C5QA*((*I4 - *I2) + (*I6 - *I8));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TR1 = *R1 + *R3 + *R5 + *R7 + *R9;\n\t" + "TR3 = (*R1 - C5QC*(*R5 + *R7)) - C5QB*(*I3 - *I9) - " + "C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" + "TR9 = (*R1 - C5QC*(*R5 + *R7)) + C5QB*(*I3 - *I9) + " + "C5QD*(*I5 - *I7) + C5QA*((*R3 - *R5) + (*R9 - *R7));\n\t" + "TR5 = (*R1 - C5QC*(*R3 + *R9)) + C5QB*(*I5 - *I7) - " + "C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t" + "TR7 = (*R1 - C5QC*(*R3 + *R9)) - C5QB*(*I5 - *I7) + " + "C5QD*(*I3 - *I9) + C5QA*((*R5 - *R3) + (*R7 - *R9));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "TI1 = *I1 + *I3 + *I5 + *I7 + *I9;\n\t" + "TI3 = (*I1 - C5QC*(*I5 + *I7)) + C5QB*(*R3 - *R9) + " + "C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" + "TI9 = (*I1 - C5QC*(*I5 + *I7)) - C5QB*(*R3 - *R9) - " + "C5QD*(*R5 - *R7) + C5QA*((*I3 - *I5) + (*I9 - *I7));\n\t" + "TI5 = (*I1 - C5QC*(*I3 + *I9)) - C5QB*(*R5 - *R7) + " + "C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t" + "TI7 = (*I1 - C5QC*(*I3 + *I9)) + C5QB*(*R5 - *R7) - " + "C5QD*(*R3 - *R9) + C5QA*((*I5 - *I3) + (*I7 - *I9));\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R0) = TR0 + TR1;\n\t" + "(*R1) = TR2 + ( C5QE*TR3 - C5QD*TI3);\n\t" + "(*R2) = TR4 + ( C5QA*TR5 - C5QB*TI5);\n\t" + "(*R3) = TR6 + (-C5QA*TR7 - C5QB*TI7);\n\t" + "(*R4) = TR8 + (-C5QE*TR9 - C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I0) = TI0 + TI1;\n\t" + "(*I1) = TI2 + ( C5QD*TR3 + C5QE*TI3);\n\t" + "(*I2) = TI4 + ( C5QB*TR5 + C5QA*TI5);\n\t" + "(*I3) = TI6 + ( C5QB*TR7 - C5QA*TI7);\n\t" + "(*I4) = TI8 + ( C5QD*TR9 - C5QE*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*R5) = TR0 - TR1;\n\t" + "(*R6) = TR2 - ( C5QE*TR3 - C5QD*TI3);\n\t" + "(*R7) = TR4 - ( C5QA*TR5 - C5QB*TI5);\n\t" + "(*R8) = TR6 - (-C5QA*TR7 - C5QB*TI7);\n\t" + "(*R9) = TR8 - (-C5QE*TR9 - C5QD*TI9);\n\t"; + + bflyStr += "\n\t"; + + bflyStr += "(*I5) = TI0 - TI1;\n\t" + "(*I6) = TI2 - ( C5QD*TR3 + C5QE*TI3);\n\t" + "(*I7) = TI4 - ( C5QB*TR5 + C5QA*TI5);\n\t" + "(*I8) = TI6 - ( C5QB*TR7 - C5QA*TI7);\n\t" + "(*I9) = TI8 - ( C5QD*TR9 - C5QE*TI9);\n\t"; + } + } + } break; + case 11: { + static const char *radix11str = " \ fptype p0, p1, p2, p3, p4, p5, p6, p7, p8, p9; \n\ p0 = ((*R1).x - (*R10).x)*dir; \n\ p1 = (*R1).x + (*R10).x; \n\ @@ -1804,22 +1888,18 @@ namespace StockhamGenerator (*R10).x = z1 - w14* b11_0; \n\ (*R10).y = z7 - w1* b11_0; \n"; - if (fwd) - { - bflyStr += "fptype dir = -1;\n\n"; - } - else - { - bflyStr += "fptype dir = 1;\n\n"; - } + if (fwd) { + bflyStr += "fptype dir = -1;\n\n"; + } else { + bflyStr += "fptype dir = 1;\n\n"; + } - bflyStr += radix11str; + bflyStr += radix11str; - } break; - case 13: - { + } break; + case 13: { - static const char *radix13str = " \ + static const char *radix13str = " \ fptype p0, p1, p2, p3, p4, p5, p6, p7, p8, p9;\n\ p0 = (*R7).x - (*R2).x;\n\ p1 = (*R7).x + (*R2).x;\n\ @@ -2024,78 +2104,85 @@ namespace StockhamGenerator (*R12).x = e6 - f2 * dir * b13_9 ;\n\ (*R12).y = e12 + f12 * dir * b13_9 ;\n"; - if (fwd) - { - bflyStr += "fptype dir = -1;\n\n"; - } - else - { - bflyStr += "fptype dir = 1;\n\n"; - } - - bflyStr += radix13str; - - } break; - - default: - assert(false); - } - - bflyStr += "\n\t"; - - // Assign results - if( (radix & (radix-1)) || (!cReg) ) - { - if( (radix != 10) && (radix != 6) ) - { - for(size_t i=0; i 0) - GenerateButterflyStr(bflyStr); - } - }; - + if (fwd) { + bflyStr += "fptype dir = -1;\n\n"; + } else { + bflyStr += "fptype dir = 1;\n\n"; + } + + bflyStr += radix13str; + + } break; + + default: + assert(false); + } + + bflyStr += "\n\t"; + + // Assign results + if ((radix & (radix - 1)) || (!cReg)) { + if ((radix != 10) && (radix != 6)) { + for (size_t i = 0; i < radix; i++) { + if (cReg) { + if ((radix != 7) && (radix != 11) && (radix != 13)) { + bflyStr += "((*R"; + bflyStr += SztToStr(i); + bflyStr += ").x) = TR"; + bflyStr += SztToStr(i); + bflyStr += "; "; + bflyStr += "((*R"; + bflyStr += SztToStr(i); + bflyStr += ").y) = TI"; + bflyStr += SztToStr(i); + bflyStr += ";\n\t"; + } + } else { + bflyStr += "(*R"; + bflyStr += SztToStr(i); + bflyStr += ") = TR"; + bflyStr += SztToStr(i); + bflyStr += "; "; + bflyStr += "(*I"; + bflyStr += SztToStr(i); + bflyStr += ") = TI"; + bflyStr += SztToStr(i); + bflyStr += ";\n\t"; + } + } + } + } else { + for (size_t i = 0; i < radix; i++) { + size_t j = BitReverse(i, radix); + + if (i < j) { + bflyStr += "T = (*R"; + bflyStr += SztToStr(i); + bflyStr += "); (*R"; + bflyStr += SztToStr(i); + bflyStr += ") = (*R"; + bflyStr += SztToStr(j); + bflyStr += "); (*R"; + bflyStr += SztToStr(j); + bflyStr += ") = T;\n\t"; + } + } + } + + bflyStr += "\n}\n"; + } + +public: + Butterfly(size_t radixVal, size_t countVal, bool fwdVal, bool cRegVal) + : radix(radixVal), count(countVal), fwd(fwdVal), cReg(cRegVal) {} + + void GenerateButterfly(std::string &bflyStr) const { + assert(count <= 4); + if (count > 0) + GenerateButterflyStr(bflyStr); + } }; -#endif +}; // namespace StockhamGenerator +#endif diff --git a/src/library/generator.transpose.cpp b/src/library/generator.transpose.cpp index f7e37484..06701cab 100644 --- a/src/library/generator.transpose.cpp +++ b/src/library/generator.transpose.cpp @@ -1,3506 +1,4576 @@ /* ************************************************************************ -* Copyright 2016 Advanced Micro Devices, Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ************************************************************************/ - + * Copyright 2016 Advanced Micro Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ************************************************************************/ /* -This file contains the implementation of inplace transpose kernel string generation. -This includes both square and non square, twiddle and non twiddle, as well as the kernels -that swap lines following permutation algorithm. +This file contains the implementation of inplace transpose kernel string +generation. This includes both square and non square, twiddle and non twiddle, +as well as the kernels that swap lines following permutation algorithm. */ -#include #include "generator.transpose.h" +#include -namespace clfft_transpose_generator -{ -// generating string for calculating offset within sqaure transpose kernels (genTransposeKernelBatched) -void OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyParams& params, bool input) -{ - const size_t *stride = input ? params.fft_inStride : params.fft_outStride; - std::string offset = input ? "iOffset" : "oOffset"; - - - std::string offsetInOut = input ? "offsetIn" : "offsetOut"; - clKernWrite( transKernel, 3 ) << "size_t " << offset << " = " << offsetInOut << " ;" << std::endl; - clKernWrite(transKernel, 3) << "g_index = get_group_id(0);" << std::endl; - - for (size_t i = params.fft_DataDim - 2; i > 0; i--) - { - clKernWrite(transKernel, 3) << offset << " += (g_index/numGroupsY_" << i << ")*" << stride[i + 1] << ";" << std::endl; - clKernWrite(transKernel, 3) << "g_index = g_index % numGroupsY_" << i << ";" << std::endl; - } - - clKernWrite(transKernel, 3) << std::endl; +namespace clfft_transpose_generator { +// generating string for calculating offset within sqaure transpose kernels +// (genTransposeKernelBatched) +void OffsetCalc(std::stringstream &transKernel, + const FFTKernelGenKeyParams ¶ms, bool input) { + const size_t *stride = input ? params.fft_inStride : params.fft_outStride; + std::string offset = input ? "iOffset" : "oOffset"; + + std::string offsetInOut = input ? "offsetIn" : "offsetOut"; + clKernWrite(transKernel, 3) + << "size_t " << offset << " = " << offsetInOut << " ;" << std::endl; + clKernWrite(transKernel, 3) << "g_index = get_group_id(0);" << std::endl; + + for (size_t i = params.fft_DataDim - 2; i > 0; i--) { + clKernWrite(transKernel, 3) << offset << " += (g_index/numGroupsY_" << i + << ")*" << stride[i + 1] << ";" << std::endl; + clKernWrite(transKernel, 3) + << "g_index = g_index % numGroupsY_" << i << ";" << std::endl; + } + + clKernWrite(transKernel, 3) << std::endl; } -// generating string for calculating offset within sqaure transpose kernels (genTransposeKernelLeadingDimensionBatched) -void OffsetCalcLeadingDimensionBatched(std::stringstream& transKernel, const FFTKernelGenKeyParams& params) -{ - const size_t *stride = params.fft_inStride; - std::string offset = "iOffset"; +// generating string for calculating offset within sqaure transpose kernels +// (genTransposeKernelLeadingDimensionBatched) +void OffsetCalcLeadingDimensionBatched(std::stringstream &transKernel, + const FFTKernelGenKeyParams ¶ms) { + const size_t *stride = params.fft_inStride; + std::string offset = "iOffset"; + + clKernWrite(transKernel, 3) + << "size_t " << offset << " = offsetIn;" << std::endl; + clKernWrite(transKernel, 3) << "g_index = get_group_id(0);" << std::endl; + + for (size_t i = params.fft_DataDim - 2; i > 0; i--) { + clKernWrite(transKernel, 3) << offset << " += (g_index/numGroupsY_" << i + << ")*" << stride[i + 1] << ";" << std::endl; + clKernWrite(transKernel, 3) + << "g_index = g_index % numGroupsY_" << i << ";" << std::endl; + } + + clKernWrite(transKernel, 3) << std::endl; +} - - clKernWrite(transKernel, 3) << "size_t " << offset << " = offsetIn;" << std::endl; - clKernWrite(transKernel, 3) << "g_index = get_group_id(0);" << std::endl; +// generating string for calculating offset within swap kernels (genSwapKernel) +void Swap_OffsetCalc(std::stringstream &transKernel, + const FFTKernelGenKeyParams ¶ms) { + const size_t *stride = params.fft_inStride; + std::string offset = "iOffset"; + + clKernWrite(transKernel, 3) + << "size_t " << offset << " = offsetOut;" << std::endl; + + for (size_t i = params.fft_DataDim - 2; i > 0; i--) { + clKernWrite(transKernel, 3) << offset << " += (g_index/numGroupsY_" << i + << ")*" << stride[i + 1] << ";" << std::endl; + clKernWrite(transKernel, 3) + << "g_index = g_index % numGroupsY_" << i << ";" << std::endl; + } + + clKernWrite(transKernel, 3) << std::endl; +} - for (size_t i = params.fft_DataDim - 2; i > 0; i--) - { - clKernWrite(transKernel, 3) << offset << " += (g_index/numGroupsY_" << i << ")*" << stride[i + 1] << ";" << std::endl; - clKernWrite(transKernel, 3) << "g_index = g_index % numGroupsY_" << i << ";" << std::endl; - } +// Small snippet of code that multiplies the twiddle factors into the +// butterfiles. It is only emitted if the plan tells the generator that it +// wants the twiddle factors generated inside of the transpose +clfftStatus genTwiddleMath(const FFTKernelGenKeyParams ¶ms, + std::stringstream &transKernel, + const std::string &dtComplex, bool fwd) { + + clKernWrite(transKernel, 9) << std::endl; + + clKernWrite(transKernel, 9) + << dtComplex + << " Wm = TW3step( (t_gx_p*32 + lidx) * (t_gy_p*32 + lidy + loop*8) );" + << std::endl; + clKernWrite(transKernel, 9) + << dtComplex + << " Wt = TW3step( (t_gy_p*32 + lidx) * (t_gx_p*32 + lidy + loop*8) );" + << std::endl; + + clKernWrite(transKernel, 9) << dtComplex << " Tm, Tt;" << std::endl; + + if (fwd) { + clKernWrite(transKernel, 9) + << "Tm.x = ( Wm.x * tmpm.x ) - ( Wm.y * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tm.y = ( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.x = ( Wt.x * tmpt.x ) - ( Wt.y * tmpt.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.y = ( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "Tm.x = ( Wm.x * tmpm.x ) + ( Wm.y * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tm.y = -( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.x = ( Wt.x * tmpt.x ) + ( Wt.y * tmpt.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.y = -( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; + } + + clKernWrite(transKernel, 9) << "tmpm.x = Tm.x;" << std::endl; + clKernWrite(transKernel, 9) << "tmpm.y = Tm.y;" << std::endl; + clKernWrite(transKernel, 9) << "tmpt.x = Tt.x;" << std::endl; + clKernWrite(transKernel, 9) << "tmpt.y = Tt.y;" << std::endl; + + clKernWrite(transKernel, 9) << std::endl; + + return CLFFT_SUCCESS; +} - clKernWrite(transKernel, 3) << std::endl; +// Small snippet of code that multiplies the twiddle factors into the +// butterfiles. It is only emitted if the plan tells the generator that it +// wants the twiddle factors generated inside of the transpose +clfftStatus +genTwiddleMathLeadingDimensionBatched(const FFTKernelGenKeyParams ¶ms, + std::stringstream &transKernel, + const std::string &dtComplex, bool fwd) { + + clKernWrite(transKernel, 9) << std::endl; + if (params.fft_N[0] > params.fft_N[1]) { + clKernWrite(transKernel, 9) + << dtComplex << " Wm = TW3step( (" << params.fft_N[1] + << " * square_matrix_index + t_gx_p*32 + lidx) * (t_gy_p*32 + lidy + " + "loop*8) );" + << std::endl; + clKernWrite(transKernel, 9) + << dtComplex << " Wt = TW3step( (" << params.fft_N[1] + << " * square_matrix_index + t_gy_p*32 + lidx) * (t_gx_p*32 + lidy + " + "loop*8) );" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << dtComplex << " Wm = TW3step( (t_gx_p*32 + lidx) * (" + << params.fft_N[0] + << " * square_matrix_index + t_gy_p*32 + lidy + loop*8) );" + << std::endl; + clKernWrite(transKernel, 9) + << dtComplex << " Wt = TW3step( (t_gy_p*32 + lidx) * (" + << params.fft_N[0] + << " * square_matrix_index + t_gx_p*32 + lidy + loop*8) );" + << std::endl; + } + clKernWrite(transKernel, 9) << dtComplex << " Tm, Tt;" << std::endl; + + if (fwd) { + clKernWrite(transKernel, 9) + << "Tm.x = ( Wm.x * tmpm.x ) - ( Wm.y * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tm.y = ( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.x = ( Wt.x * tmpt.x ) - ( Wt.y * tmpt.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.y = ( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "Tm.x = ( Wm.x * tmpm.x ) + ( Wm.y * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tm.y = -( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.x = ( Wt.x * tmpt.x ) + ( Wt.y * tmpt.y );" << std::endl; + clKernWrite(transKernel, 9) + << "Tt.y = -( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; + } + + clKernWrite(transKernel, 9) << "tmpm.x = Tm.x;" << std::endl; + clKernWrite(transKernel, 9) << "tmpm.y = Tm.y;" << std::endl; + clKernWrite(transKernel, 9) << "tmpt.x = Tt.x;" << std::endl; + clKernWrite(transKernel, 9) << "tmpt.y = Tt.y;" << std::endl; + + clKernWrite(transKernel, 9) << std::endl; + + return CLFFT_SUCCESS; } -// generating string for calculating offset within swap kernels (genSwapKernel) -void Swap_OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyParams& params) -{ - const size_t *stride = params.fft_inStride; - std::string offset = "iOffset"; +clfftStatus genTransposePrototype( + const FFTGeneratedTransposeSquareAction::Signature ¶ms, + const size_t &lwSize, const std::string &dtPlanar, + const std::string &dtComplex, const std::string &funcName, + std::stringstream &transKernel, std::string &dtInput, + std::string &dtOutput) { + + // Declare and define the function + clKernWrite(transKernel, 0) << "__attribute__(( reqd_work_group_size( " + << lwSize << ", 1, 1 ) ))" << std::endl; + clKernWrite(transKernel, 0) << "kernel void" << std::endl; + + clKernWrite(transKernel, 0) << funcName << "( "; + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + dtInput = dtComplex; + dtOutput = dtComplex; + clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << "global " << dtInput << "* restrict inputA_R" + << ", global " << dtInput << "* restrict inputA_I"; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + dtInput = dtPlanar; + dtOutput = dtPlanar; + + clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_placeness == CLFFT_OUTOFPLACE) + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + dtInput = dtComplex; + dtOutput = dtComplex; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict outputA"; + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict outputA_R" + << ", global " << dtOutput << "* restrict outputA_I"; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + dtInput = dtPlanar; + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict outputA"; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } - - clKernWrite(transKernel, 3) << "size_t " << offset << " = offsetOut;" << std::endl; + if (params.fft_hasPreCallback) { + assert(!params.fft_hasPostCallback); - for (size_t i = params.fft_DataDim - 2; i > 0; i--) - { - clKernWrite(transKernel, 3) << offset << " += (g_index/numGroupsY_" << i << ")*" << stride[i + 1] << ";" << std::endl; - clKernWrite(transKernel, 3) << "g_index = g_index % numGroupsY_" << i << ";" << std::endl; - } + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) + << ", __global void* pre_userdata, __local void* localmem"; + } else { + clKernWrite(transKernel, 0) << ", __global void* pre_userdata"; + } + } + if (params.fft_hasPostCallback) { + assert(!params.fft_hasPreCallback); + + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) + << ", __global void* post_userdata, __local void* localmem"; + } else { + clKernWrite(transKernel, 0) << ", __global void* post_userdata"; + } + } - clKernWrite(transKernel, 3) << std::endl; -} + clKernWrite(transKernel, 0) << ", const int offsetIn, const int offsetOut "; -// Small snippet of code that multiplies the twiddle factors into the butterfiles. It is only emitted if the plan tells -// the generator that it wants the twiddle factors generated inside of the transpose -clfftStatus genTwiddleMath(const FFTKernelGenKeyParams& params, std::stringstream& transKernel, const std::string& dtComplex, bool fwd) -{ - - clKernWrite(transKernel, 9) << std::endl; - - clKernWrite(transKernel, 9) << dtComplex << " Wm = TW3step( (t_gx_p*32 + lidx) * (t_gy_p*32 + lidy + loop*8) );" << std::endl; - clKernWrite(transKernel, 9) << dtComplex << " Wt = TW3step( (t_gy_p*32 + lidx) * (t_gx_p*32 + lidy + loop*8) );" << std::endl; - - clKernWrite(transKernel, 9) << dtComplex << " Tm, Tt;" << std::endl; - - if (fwd) - { - clKernWrite(transKernel, 9) << "Tm.x = ( Wm.x * tmpm.x ) - ( Wm.y * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tm.y = ( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.x = ( Wt.x * tmpt.x ) - ( Wt.y * tmpt.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.y = ( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "Tm.x = ( Wm.x * tmpm.x ) + ( Wm.y * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tm.y = -( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.x = ( Wt.x * tmpt.x ) + ( Wt.y * tmpt.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.y = -( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; - } - - clKernWrite(transKernel, 9) << "tmpm.x = Tm.x;" << std::endl; - clKernWrite(transKernel, 9) << "tmpm.y = Tm.y;" << std::endl; - clKernWrite(transKernel, 9) << "tmpt.x = Tt.x;" << std::endl; - clKernWrite(transKernel, 9) << "tmpt.y = Tt.y;" << std::endl; - - clKernWrite(transKernel, 9) << std::endl; - - return CLFFT_SUCCESS; + // Close the method signature + clKernWrite(transKernel, 0) << " )\n{" << std::endl; + return CLFFT_SUCCESS; } -// Small snippet of code that multiplies the twiddle factors into the butterfiles. It is only emitted if the plan tells -// the generator that it wants the twiddle factors generated inside of the transpose -clfftStatus genTwiddleMathLeadingDimensionBatched(const FFTKernelGenKeyParams& params, std::stringstream& transKernel, const std::string& dtComplex, bool fwd) -{ - - clKernWrite(transKernel, 9) << std::endl; - if (params.fft_N[0] > params.fft_N[1]) - { - clKernWrite(transKernel, 9) << dtComplex << " Wm = TW3step( (" << params.fft_N[1] << " * square_matrix_index + t_gx_p*32 + lidx) * (t_gy_p*32 + lidy + loop*8) );" << std::endl; - clKernWrite(transKernel, 9) << dtComplex << " Wt = TW3step( (" << params.fft_N[1] << " * square_matrix_index + t_gy_p*32 + lidx) * (t_gx_p*32 + lidy + loop*8) );" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << dtComplex << " Wm = TW3step( (t_gx_p*32 + lidx) * (" << params.fft_N[0] << " * square_matrix_index + t_gy_p*32 + lidy + loop*8) );" << std::endl; - clKernWrite(transKernel, 9) << dtComplex << " Wt = TW3step( (t_gy_p*32 + lidx) * (" << params.fft_N[0] << " * square_matrix_index + t_gx_p*32 + lidy + loop*8) );" << std::endl; - } - clKernWrite(transKernel, 9) << dtComplex << " Tm, Tt;" << std::endl; - - if (fwd) - { - clKernWrite(transKernel, 9) << "Tm.x = ( Wm.x * tmpm.x ) - ( Wm.y * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tm.y = ( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.x = ( Wt.x * tmpt.x ) - ( Wt.y * tmpt.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.y = ( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "Tm.x = ( Wm.x * tmpm.x ) + ( Wm.y * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tm.y = -( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.x = ( Wt.x * tmpt.x ) + ( Wt.y * tmpt.y );" << std::endl; - clKernWrite(transKernel, 9) << "Tt.y = -( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl; - } - - clKernWrite(transKernel, 9) << "tmpm.x = Tm.x;" << std::endl; - clKernWrite(transKernel, 9) << "tmpm.y = Tm.y;" << std::endl; - clKernWrite(transKernel, 9) << "tmpt.x = Tt.x;" << std::endl; - clKernWrite(transKernel, 9) << "tmpt.y = Tt.y;" << std::endl; - - clKernWrite(transKernel, 9) << std::endl; - - return CLFFT_SUCCESS; -} +clfftStatus genTransposePrototypeLeadingDimensionBatched( + const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + const size_t &lwSize, const std::string &dtPlanar, + const std::string &dtComplex, const std::string &funcName, + std::stringstream &transKernel, std::string &dtInput, + std::string &dtOutput) { + + // Declare and define the function + clKernWrite(transKernel, 0) << "__attribute__(( reqd_work_group_size( " + << lwSize << ", 1, 1 ) ))" << std::endl; + clKernWrite(transKernel, 0) << "kernel void" << std::endl; + + clKernWrite(transKernel, 0) << funcName << "( "; + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + dtInput = dtComplex; + dtOutput = dtComplex; + clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << "global " << dtInput << "* restrict inputA_R" + << ", global " << dtInput << "* restrict inputA_I"; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + dtInput = dtPlanar; + dtOutput = dtPlanar; + + clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_hasPreCallback) { + assert(!params.fft_hasPostCallback); + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) + << ", __global void* pre_userdata, __local void* localmem"; + } else { + clKernWrite(transKernel, 0) << ", __global void* pre_userdata"; + } + } + if (params.fft_hasPostCallback) { + assert(!params.fft_hasPreCallback); + + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) + << ", __global void* post_userdata, __local void* localmem"; + } else { + clKernWrite(transKernel, 0) << ", __global void* post_userdata"; + } + } -clfftStatus genTransposePrototype(const FFTGeneratedTransposeSquareAction::Signature & params, const size_t& lwSize, const std::string& dtPlanar, const std::string& dtComplex, - const std::string &funcName, std::stringstream& transKernel, std::string& dtInput, std::string& dtOutput) -{ - - // Declare and define the function - clKernWrite(transKernel, 0) << "__attribute__(( reqd_work_group_size( " << lwSize << ", 1, 1 ) ))" << std::endl; - clKernWrite(transKernel, 0) << "kernel void" << std::endl; - - clKernWrite(transKernel, 0) << funcName << "( "; - - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - dtInput = dtComplex; - dtOutput = dtComplex; - clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA_R" << ", global " << dtInput << "* restrict inputA_I"; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - dtInput = dtPlanar; - dtOutput = dtPlanar; - - clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - if (params.fft_placeness == CLFFT_OUTOFPLACE) - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - dtInput = dtComplex; - dtOutput = dtComplex; - clKernWrite(transKernel, 0) << ", global " << dtOutput << "* restrict outputA"; - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - clKernWrite(transKernel, 0) << ", global " << dtOutput << "* restrict outputA_R" << ", global " << dtOutput << "* restrict outputA_I"; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - dtInput = dtPlanar; - dtOutput = dtPlanar; - clKernWrite(transKernel, 0) << ", global " << dtOutput << "* restrict outputA"; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - if (params.fft_hasPreCallback) - { - assert(!params.fft_hasPostCallback); - - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", __global void* pre_userdata, __local void* localmem"; - } - else - { - clKernWrite(transKernel, 0) << ", __global void* pre_userdata"; - } - } - if (params.fft_hasPostCallback) - { - assert(!params.fft_hasPreCallback); - - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", __global void* post_userdata, __local void* localmem"; - } - else - { - clKernWrite(transKernel, 0) << ", __global void* post_userdata"; - } - } - - - clKernWrite( transKernel, 0 ) << ", const int offsetIn, const int offsetOut "; - - // Close the method signature - clKernWrite(transKernel, 0) << " )\n{" << std::endl; - return CLFFT_SUCCESS; -} + // Close the method signature -clfftStatus genTransposePrototypeLeadingDimensionBatched(const FFTGeneratedTransposeNonSquareAction::Signature & params, const size_t& lwSize, - const std::string& dtPlanar, const std::string& dtComplex, - const std::string &funcName, std::stringstream& transKernel, - std::string& dtInput, std::string& dtOutput) -{ - - // Declare and define the function - clKernWrite(transKernel, 0) << "__attribute__(( reqd_work_group_size( " << lwSize << ", 1, 1 ) ))" << std::endl; - clKernWrite(transKernel, 0) << "kernel void" << std::endl; - - clKernWrite(transKernel, 0) << funcName << "( "; - - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - dtInput = dtComplex; - dtOutput = dtComplex; - clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA_R" << ", global " << dtInput << "* restrict inputA_I"; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - dtInput = dtPlanar; - dtOutput = dtPlanar; - - clKernWrite(transKernel, 0) << "global " << dtInput << "* restrict inputA"; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - if (params.fft_hasPreCallback) - { - assert(!params.fft_hasPostCallback); - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", __global void* pre_userdata, __local void* localmem"; - } - else - { - clKernWrite(transKernel, 0) << ", __global void* pre_userdata"; - } - } - if (params.fft_hasPostCallback) - { - assert(!params.fft_hasPreCallback); - - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", __global void* post_userdata, __local void* localmem"; - } - else - { - clKernWrite(transKernel, 0) << ", __global void* post_userdata"; - } - } - - - // Close the method signature - - clKernWrite( transKernel, 0 ) << ", const int offsetIn, const int offsetOut "; - - clKernWrite(transKernel, 0) << " )\n{" << std::endl; - return CLFFT_SUCCESS; + clKernWrite(transKernel, 0) << ", const int offsetIn, const int offsetOut "; + + clKernWrite(transKernel, 0) << " )\n{" << std::endl; + return CLFFT_SUCCESS; } -/* -> get_cycles function gets the swapping logic required for given row x col matrix. +/* -> get_cycles function gets the swapping logic required for given row x col +matrix. -> cycle_map[0] holds the total number of cycles required. --> cycles start and end with the same index, hence we can identify individual cycles, -though we tend to store the cycle index contiguously*/ -void get_cycles(size_t *cycle_map, size_t num_reduced_row, size_t num_reduced_col) -{ - int *is_swapped = new int[num_reduced_row * num_reduced_col]; - int i, map_index = 1, num_cycles = 0; - size_t swap_id; - /*initialize swap map*/ - is_swapped[0] = 1; - is_swapped[num_reduced_row * num_reduced_col - 1] = 1; - for (i = 1; i < (num_reduced_row * num_reduced_col - 1); i++) - { - is_swapped[i] = 0; - } - - for (i = 1; i < (num_reduced_row * num_reduced_col - 1); i++) - { - swap_id = i; - while (!is_swapped[swap_id]) - { - is_swapped[swap_id] = 1; - cycle_map[map_index++] = swap_id; - swap_id = (num_reduced_row * swap_id) % (num_reduced_row * num_reduced_col - 1); - if (swap_id == i) - { - cycle_map[map_index++] = swap_id; - num_cycles++; - } - } - } - cycle_map[0] = num_cycles; - delete[] is_swapped; +-> cycles start and end with the same index, hence we can identify individual +cycles, though we tend to store the cycle index contiguously*/ +void get_cycles(size_t *cycle_map, size_t num_reduced_row, + size_t num_reduced_col) { + int *is_swapped = new int[num_reduced_row * num_reduced_col]; + int i, map_index = 1, num_cycles = 0; + size_t swap_id; + /*initialize swap map*/ + is_swapped[0] = 1; + is_swapped[num_reduced_row * num_reduced_col - 1] = 1; + for (i = 1; i < (num_reduced_row * num_reduced_col - 1); i++) { + is_swapped[i] = 0; + } + + for (i = 1; i < (num_reduced_row * num_reduced_col - 1); i++) { + swap_id = i; + while (!is_swapped[swap_id]) { + is_swapped[swap_id] = 1; + cycle_map[map_index++] = swap_id; + swap_id = + (num_reduced_row * swap_id) % (num_reduced_row * num_reduced_col - 1); + if (swap_id == i) { + cycle_map[map_index++] = swap_id; + num_cycles++; + } + } + } + cycle_map[0] = num_cycles; + delete[] is_swapped; } /* calculate the permutation cycles consumed in swap kernels. -each cycle is strored in a vecotor. hopfully there are mutliple independent vectors thus we use a vector of vecotor +each cycle is strored in a vecotor. hopfully there are mutliple independent +vectors thus we use a vector of vecotor */ -void permutation_calculation(size_t m, size_t n, std::vector > &permutationVec) -{ - /* - calculate inplace transpose permutation lists - reference: - https://en.wikipedia.org/wiki/In-place_matrix_transposition - and - http://www.netlib.org/utk/people/JackDongarra/CCDSC-2014/talk35.pdf - row major matrix of size n x m - p(k) = (k*n)mod(m*n-1), if 0 < k < m*n-1 - when k = 0 or m*n-1, it does not require movement - */ - if (m < 1 || n < 1) - return; - - size_t mn_minus_one = m*n - 1; - //maintain a table so check is faster - size_t *table = new size_t[mn_minus_one + 1]();//init to zeros - table[0] = 1; - - for (size_t i = 1; i < mn_minus_one; i++) - { - //first check if i is already stored in somewhere in vector of vectors - bool already_checked = false; - if (table[i] >= 1) - already_checked = true; - if (already_checked == true) - continue; - - //if not checked yet - std::vector vec; - vec.push_back(i); - table[i] += 1; - size_t temp = i; - - while (1) - { - temp = (temp*n); - temp = temp % (mn_minus_one); - if (find(vec.begin(), vec.end(), temp) != vec.end()) - { - //what goes around comes around and it should - break; - } - if (table[temp] >= 1) - { - already_checked = true; - break; - } - vec.push_back(temp); - table[temp] += 1; - } - if (already_checked == true) - continue; - permutationVec.push_back(vec); - } - delete[] table; -} -//swap lines. This kind of kernels are using with combination of square transpose kernels to perform nonsqaure transpose -//this function assumes a 1:2 ratio -clfftStatus genSwapKernel(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, std::string& KernelFuncName, const size_t& lwSize, const size_t reShapeFactor) -{ - strKernel.reserve(4096); - std::stringstream transKernel(std::stringstream::out); - - // These strings represent the various data types we read or write in the kernel, depending on how the plan - // is configured - std::string dtInput; // The type read as input into kernel - std::string dtOutput; // The type written as output from kernel - std::string dtPlanar; // Fundamental type for planar arrays - std::string tmpBuffType; - std::string dtComplex; // Fundamental type for complex arrays - - // NOTE: Enable only for debug - // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl; - - //if (params.fft_inputLayout != params.fft_outputLayout) - // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - switch (params.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - dtPlanar = "float"; - dtComplex = "float2"; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - dtPlanar = "double"; - dtComplex = "double2"; - - // Emit code that enables double precision in the kernel - clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#else" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#endif\n" << std::endl; - - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - break; - } - - // This detects whether the input matrix is rectangle of ratio 1:2 - - if ((params.fft_N[0] != 2 * params.fft_N[1]) && (params.fft_N[1] != 2 * params.fft_N[0])) - { - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - if (params.fft_placeness == CLFFT_OUTOFPLACE) - { - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - size_t smaller_dim = (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; - - size_t input_elm_size_in_bytes; - switch (params.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - input_elm_size_in_bytes = 4; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - input_elm_size_in_bytes = 8; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - input_elm_size_in_bytes *= 2; - break; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - size_t max_elements_loaded = AVAIL_MEM_SIZE / input_elm_size_in_bytes; - size_t num_elements_loaded; - size_t local_work_size_swap, num_grps_pro_row; - - tmpBuffType = "__local"; - if ((max_elements_loaded >> 1) > smaller_dim) - { - local_work_size_swap = (smaller_dim < 256) ? smaller_dim : 256; - num_elements_loaded = smaller_dim; - num_grps_pro_row = 1; - } - else - { - num_grps_pro_row = (smaller_dim << 1) / max_elements_loaded; - num_elements_loaded = max_elements_loaded >> 1; - local_work_size_swap = (num_elements_loaded < 256) ? num_elements_loaded : 256; - } - - //If post-callback is set for the plan - if (params.fft_hasPostCallback) - { - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by swap kernel - if (params.fft_postCallback.localMemSize > 0) - { - bool validLDSSize = false; - - validLDSSize = ((2 * input_elm_size_in_bytes * (num_elements_loaded * 2)) + params.fft_postCallback.localMemSize) < params.limit_LocalMemSize; - - if (!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_postCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - //If pre-callback is set for the plan - if (params.fft_hasPreCallback) - { - //we have already checked available LDS for pre callback - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_preCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - /*Generating the swapping logic*/ - { - size_t num_reduced_row; - size_t num_reduced_col; - - if (params.fft_N[1] == smaller_dim) - { - num_reduced_row = smaller_dim; - num_reduced_col = 2; - } - else - { - num_reduced_row = 2; - num_reduced_col = smaller_dim; - } - - std::string funcName; - - clKernWrite(transKernel, 0) << std::endl; - - size_t *cycle_map = new size_t[num_reduced_row * num_reduced_col * 2]; - /* The memory required by cycle_map cannot exceed 2 times row*col by design*/ - - get_cycles(cycle_map, num_reduced_row, num_reduced_col); - - size_t *cycle_stat = new size_t[cycle_map[0] * 2], stat_idx = 0; - clKernWrite(transKernel, 0) << std::endl; - - clKernWrite(transKernel, 0) << "__constant size_t swap_table[][3] = {" << std::endl; - - size_t inx = 0, start_inx, swap_inx = 0, num_swaps = 0; - for (size_t i = 0; i < cycle_map[0]; i++) - { - start_inx = cycle_map[++inx]; - clKernWrite(transKernel, 0) << "{ " << start_inx << ", " << cycle_map[inx + 1] << ", 0}," << std::endl; - cycle_stat[stat_idx++] = num_swaps; - num_swaps++; - - while (start_inx != cycle_map[++inx]) - { - size_t action_var = (cycle_map[inx + 1] == start_inx) ? 2 : 1; - clKernWrite(transKernel, 0) << "{ " << cycle_map[inx] << ", " << cycle_map[inx + 1] << ", " << action_var << "}," << std::endl; - if (action_var == 2) - cycle_stat[stat_idx++] = num_swaps; - num_swaps++; - } - } - /*Appending swap table for touching corner elements for post call back*/ - size_t last_datablk_idx = num_reduced_row * num_reduced_col - 1; - clKernWrite(transKernel, 0) << "{ 0, 0, 0}," << std::endl; - clKernWrite(transKernel, 0) << "{ " << last_datablk_idx << ", " << last_datablk_idx << ", 0}," << std::endl; - - clKernWrite(transKernel, 0) << "};" << std::endl; - /*cycle_map[0] + 2, + 2 is added for post callback table appending*/ - size_t num_cycles_minus_1 = cycle_map[0] - 1; - - clKernWrite(transKernel, 0) << "__constant size_t cycle_stat[" << cycle_map[0] << "][2] = {" << std::endl; - for (size_t i = 0; i < num_cycles_minus_1; i++) - { - clKernWrite(transKernel, 0) << "{ " << cycle_stat[i * 2] << ", " << cycle_stat[i * 2 + 1] << "}," << std::endl; - } - clKernWrite(transKernel, 0) << "{ " << cycle_stat[num_cycles_minus_1 * 2] << ", " << (cycle_stat[num_cycles_minus_1 * 2 + 1] + 2) << "}," << std::endl; - - clKernWrite(transKernel, 0) << "};" << std::endl; - - clKernWrite(transKernel, 0) << std::endl; - - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 0) << "void swap(global " << dtComplex << "* inputA, " << tmpBuffType << " " << dtComplex << "* Ls, " << tmpBuffType << " " << dtComplex << " * Ld, size_t is, size_t id, size_t pos, size_t end_indx, size_t work_id"; - break; - case CLFFT_COMPLEX_PLANAR: - clKernWrite(transKernel, 0) << "void swap(global " << dtPlanar << "* inputA_R, global " << dtPlanar << "* inputA_I, " << tmpBuffType << " " << dtComplex << "* Ls, " << tmpBuffType << " " << dtComplex << "* Ld, size_t is, size_t id, size_t pos, size_t end_indx, size_t work_id"; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - clKernWrite(transKernel, 0) << "void swap(global " << dtPlanar << "* inputA, " << tmpBuffType << " " << dtPlanar << "* Ls, " << tmpBuffType << " " << dtPlanar << "* Ld, size_t is, size_t id, size_t pos, size_t end_indx, size_t work_id"; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 0) << ", size_t iOffset, __global void* post_userdata"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", __local void* localmem"; - } - } - - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 0) << ", size_t iOffset, __global void* pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", __local void* localmem"; - } - } - - clKernWrite(transKernel, 0) << "){" << std::endl; - - clKernWrite(transKernel, 3) << "for (size_t j = get_local_id(0); j < end_indx; j += " << local_work_size_swap << "){" << std::endl; - - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; - - clKernWrite(transKernel, 9) << "Ls[j] = " << params.fft_preCallback.funcname << "(inputA, ( is *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; - //clKernWrite(transKernel, 9) << "Ls[j] = " << params.fft_preCallback.funcname << "(inputA + iOffset, ( is *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j), pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 9) << "Ld[j] = " << params.fft_preCallback.funcname << "(inputA, ( id *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; - //clKernWrite(transKernel, 9) << "Ld[j] = " << params.fft_preCallback.funcname << "(inputA + iOffset, ( id *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j), pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - - clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j] = " << params.fft_preCallback.funcname << "(inputA, ( id *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; - //clKernWrite(transKernel, 9) << "Ld[j] = " << params.fft_preCallback.funcname << "(inputA + iOffset, ( id *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j), pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; - clKernWrite(transKernel, 9) << "Ls[j] = inputA[is *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j] = inputA[id *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - - clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j] = inputA[id *" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(inputA, (iOffset + id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j), post_userdata, Ls[j]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "inputA[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset] = Ls[j];" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "inputA[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j] = Ls[j];" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; - clKernWrite(transKernel, 9) << "Ls[j] = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, (is * " << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 9) << "Ld[j] = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, (id * " << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 6) << "}" << std::endl; - - clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; - - clKernWrite(transKernel, 9) << "Ld[j] = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, (id * " << smaller_dim << " + " << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 6) << "}" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; - clKernWrite(transKernel, 9) << "Ls[j].x = inputA_R[is*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 9) << "Ls[j].y = inputA_I[is*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j].x = inputA_R[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j].y = inputA_I[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - - clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j].x = inputA_R[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 9) << "Ld[j].y = inputA_I[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j];" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(inputA_R, inputA_I, (iOffset + id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j), post_userdata, Ls[j].x, Ls[j].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "inputA_R[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j] = Ls[j].x;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[id*" << smaller_dim << " + " << num_elements_loaded << " * work_id + j] = Ls[j].y;" << std::endl; - } - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 0) << "}" << std::endl << std::endl; - - funcName = "swap_nonsquare"; - KernelFuncName = funcName; - // Generate kernel API - - /*when swap can be performed in LDS itself then, same prototype of transpose can be used for swap function too*/ - genTransposePrototypeLeadingDimensionBatched(params, local_work_size_swap, dtPlanar, dtComplex, funcName, transKernel, dtInput, dtOutput); - - clKernWrite(transKernel, 3) << "size_t g_index = get_group_id(0);" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t numGroupsY_1 = " << cycle_map[0] * num_grps_pro_row << " ;" << std::endl; - for (size_t i = 2; i < params.fft_DataDim - 1; i++) - { - clKernWrite(transKernel, 3) << "const size_t numGroupsY_" << i << " = numGroupsY_" << i - 1 << " * " << params.fft_N[i] << ";" << std::endl; - } - - delete[] cycle_map; - delete[] cycle_stat; - - Swap_OffsetCalc(transKernel, params); - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - - clKernWrite(transKernel, 3) << "__local " << dtInput << " tmp_tot_mem[" << (num_elements_loaded * 2) << "];" << std::endl; - clKernWrite(transKernel, 3) << tmpBuffType << " " << dtInput << " *te = tmp_tot_mem;" << std::endl; - - clKernWrite(transKernel, 3) << tmpBuffType << " " << dtInput << " *to = (tmp_tot_mem + " << num_elements_loaded << ");" << std::endl; - - //Do not advance offset when postcallback is set as the starting address of global buffer is needed - if (!params.fft_hasPostCallback && !params.fft_hasPreCallback) - clKernWrite(transKernel, 3) << "inputA += iOffset;" << std::endl; // Set A ptr to the start of each slice - break; - case CLFFT_COMPLEX_PLANAR: - - clKernWrite(transKernel, 3) << "__local " << dtComplex << " tmp_tot_mem[" << (num_elements_loaded * 2) << "];" << std::endl; - clKernWrite(transKernel, 3) << tmpBuffType << " " << dtComplex << " *te = tmp_tot_mem;" << std::endl; - - clKernWrite(transKernel, 3) << tmpBuffType << " " << dtComplex << " *to = (tmp_tot_mem + " << num_elements_loaded << ");" << std::endl; - - //Do not advance offset when postcallback is set as the starting address of global buffer is needed - if (!params.fft_hasPostCallback) - { - clKernWrite(transKernel, 3) << "inputA_R += iOffset;" << std::endl; // Set A ptr to the start of each slice - clKernWrite(transKernel, 3) << "inputA_I += iOffset;" << std::endl; // Set A ptr to the start of each slice - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - clKernWrite(transKernel, 3) << tmpBuffType << " " << dtComplex << " *tmp_swap_ptr[2];" << std::endl; - break; - case CLFFT_REAL: - clKernWrite(transKernel, 3) << tmpBuffType << " " << dtPlanar << " *tmp_swap_ptr[2];" << std::endl; - } - clKernWrite(transKernel, 3) << "tmp_swap_ptr[0] = te;" << std::endl; - clKernWrite(transKernel, 3) << "tmp_swap_ptr[1] = to;" << std::endl; - - clKernWrite(transKernel, 3) << "size_t swap_inx = 0;" << std::endl; - - clKernWrite(transKernel, 3) << "size_t start = cycle_stat[g_index / " << num_grps_pro_row << "][0];" << std::endl; - clKernWrite(transKernel, 3) << "size_t end = cycle_stat[g_index / " << num_grps_pro_row << "][1];" << std::endl; - - clKernWrite(transKernel, 3) << "size_t end_indx = " << num_elements_loaded << ";" << std::endl; - clKernWrite(transKernel, 3) << "size_t work_id = g_index % " << num_grps_pro_row << ";" << std::endl; - - clKernWrite(transKernel, 3) << "if( work_id == " << (num_grps_pro_row - 1) << " ){" << std::endl; - clKernWrite(transKernel, 6) << "end_indx = " << smaller_dim - num_elements_loaded * (num_grps_pro_row - 1) << ";" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "for (size_t loop = start; loop <= end; loop ++){" << std::endl; - clKernWrite(transKernel, 6) << "swap_inx = 1 - swap_inx;" << std::endl; - - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - clKernWrite(transKernel, 6) << "swap(inputA, tmp_swap_ptr[swap_inx], tmp_swap_ptr[1 - swap_inx], swap_table[loop][0], swap_table[loop][1], swap_table[loop][2], end_indx, work_id"; - break; - case CLFFT_COMPLEX_PLANAR: - clKernWrite(transKernel, 6) << "swap(inputA_R, inputA_I, tmp_swap_ptr[swap_inx], tmp_swap_ptr[1 - swap_inx], swap_table[loop][0], swap_table[loop][1], swap_table[loop][2], end_indx, work_id"; - break; - } - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 0) << ", iOffset, post_userdata"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - } - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 0) << ", iOffset, pre_userdata"; - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 0) << "}" << std::endl; - strKernel = transKernel.str(); - } - return CLFFT_SUCCESS; +void permutation_calculation(size_t m, size_t n, + std::vector> &permutationVec) { + /* + calculate inplace transpose permutation lists + reference: + https://en.wikipedia.org/wiki/In-place_matrix_transposition + and + http://www.netlib.org/utk/people/JackDongarra/CCDSC-2014/talk35.pdf + row major matrix of size n x m + p(k) = (k*n)mod(m*n-1), if 0 < k < m*n-1 + when k = 0 or m*n-1, it does not require movement + */ + if (m < 1 || n < 1) + return; + + size_t mn_minus_one = m * n - 1; + // maintain a table so check is faster + auto *table = new size_t[mn_minus_one + 1](); // init to zeros + table[0] = 1; + + for (size_t i = 1; i < mn_minus_one; i++) { + // first check if i is already stored in somewhere in vector of vectors + bool already_checked = false; + if (table[i] >= 1) + already_checked = true; + if (already_checked == true) + continue; + + // if not checked yet + std::vector vec; + vec.push_back(i); + table[i] += 1; + size_t temp = i; + + while (true) { + temp = (temp * n); + temp = temp % (mn_minus_one); + if (find(vec.begin(), vec.end(), temp) != vec.end()) { + // what goes around comes around and it should + break; + } + if (table[temp] >= 1) { + already_checked = true; + break; + } + vec.push_back(temp); + table[temp] += 1; + } + if (already_checked == true) + continue; + permutationVec.push_back(vec); + } + delete[] table; } +// swap lines. This kind of kernels are using with combination of square +// transpose kernels to perform nonsqaure transpose this function assumes a 1:2 +// ratio +clfftStatus +genSwapKernel(const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + std::string &strKernel, std::string &KernelFuncName, + const size_t &lwSize, const size_t reShapeFactor) { + strKernel.reserve(4096); + std::stringstream transKernel(std::stringstream::out); + + // These strings represent the various data types we read or write in the + // kernel, depending on how the plan is configured + std::string dtInput; // The type read as input into kernel + std::string dtOutput; // The type written as output from kernel + std::string dtPlanar; // Fundamental type for planar arrays + std::string tmpBuffType; + std::string dtComplex; // Fundamental type for complex arrays + + // NOTE: Enable only for debug + // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : + // enable\n" << std::endl; + + // if (params.fft_inputLayout != params.fft_outputLayout) + // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + dtPlanar = "float"; + dtComplex = "float2"; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + dtPlanar = "double"; + dtComplex = "double2"; + + // Emit code that enables double precision in the kernel + clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#else" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#endif\n" << std::endl; + + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + break; + } + + // This detects whether the input matrix is rectangle of ratio 1:2 + + if ((params.fft_N[0] != 2 * params.fft_N[1]) && + (params.fft_N[1] != 2 * params.fft_N[0])) { + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_placeness == CLFFT_OUTOFPLACE) { + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + size_t smaller_dim = + (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; + + size_t input_elm_size_in_bytes; + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + input_elm_size_in_bytes = 4; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + input_elm_size_in_bytes = 8; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + input_elm_size_in_bytes *= 2; + break; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + size_t max_elements_loaded = AVAIL_MEM_SIZE / input_elm_size_in_bytes; + size_t num_elements_loaded; + size_t local_work_size_swap, num_grps_pro_row; + + tmpBuffType = "__local"; + if ((max_elements_loaded >> 1) > smaller_dim) { + local_work_size_swap = (smaller_dim < 256) ? smaller_dim : 256; + num_elements_loaded = smaller_dim; + num_grps_pro_row = 1; + } else { + num_grps_pro_row = (smaller_dim << 1) / max_elements_loaded; + num_elements_loaded = max_elements_loaded >> 1; + local_work_size_swap = + (num_elements_loaded < 256) ? num_elements_loaded : 256; + } + + // If post-callback is set for the plan + if (params.fft_hasPostCallback) { + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by swap kernel + if (params.fft_postCallback.localMemSize > 0) { + bool validLDSSize = false; + + validLDSSize = + ((2 * input_elm_size_in_bytes * (num_elements_loaded * 2)) + + params.fft_postCallback.localMemSize) < params.limit_LocalMemSize; + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } -//swap lines. a more general kernel generator. -//this function accepts any ratio in theory. But in practice we restrict it to 1:2, 1:3, 1:5 and 1:10 ration -clfftStatus genSwapKernelGeneral(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, std::string& KernelFuncName, const size_t& lwSize, const size_t reShapeFactor) -{ - if (params.fft_placeness == CLFFT_OUTOFPLACE) - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - size_t smaller_dim = (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; - size_t bigger_dim = (params.fft_N[0] >= params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; - size_t dim_ratio = bigger_dim / smaller_dim; - /* - if ( (params.fft_N[0] != 2 * params.fft_N[1]) && (params.fft_N[1] != 2 * params.fft_N[0]) && - (params.fft_N[0] != 3 * params.fft_N[1]) && (params.fft_N[1] != 3 * params.fft_N[0]) && - (params.fft_N[0] != 5 * params.fft_N[1]) && (params.fft_N[1] != 5 * params.fft_N[0]) && - (params.fft_N[0] != 10 * params.fft_N[1]) && (params.fft_N[1] != 10 * params.fft_N[0]) ) - */ - if(dim_ratio % 2 != 0 && dim_ratio % 3 != 0 && dim_ratio % 5 != 0 && dim_ratio % 10 != 0) - { - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - strKernel.reserve(4096); - std::stringstream transKernel(std::stringstream::out); - - // These strings represent the various data types we read or write in the kernel, depending on how the plan - // is configured - std::string dtInput; // The type read as input into kernel - std::string dtOutput; // The type written as output from kernel - std::string dtPlanar; // Fundamental type for planar arrays - std::string tmpBuffType; - std::string dtComplex; // Fundamental type for complex arrays - - // NOTE: Enable only for debug - // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl; - - //if (params.fft_inputLayout != params.fft_outputLayout) - // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - switch (params.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - dtPlanar = "float"; - dtComplex = "float2"; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - dtPlanar = "double"; - dtComplex = "double2"; - - // Emit code that enables double precision in the kernel - clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#else" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#endif\n" << std::endl; - - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - break; - } - - - size_t LDS_per_WG = smaller_dim; - while (LDS_per_WG > 1024)//avoiding using too much lds memory. the biggest LDS memory we will allocate would be 1024*sizeof(float2/double2)*2 - { - if (LDS_per_WG % 2 == 0) - { - LDS_per_WG /= 2; - continue; - } - if (LDS_per_WG % 3 == 0) - { - LDS_per_WG /= 3; - continue; - } - if (LDS_per_WG % 5 == 0) - { - LDS_per_WG /= 5; - continue; - } - return CLFFT_NOTIMPLEMENTED; - } - size_t WG_per_line = smaller_dim / LDS_per_WG; - - size_t input_elm_size_in_bytes; - switch (params.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - input_elm_size_in_bytes = 4; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - input_elm_size_in_bytes = 8; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - input_elm_size_in_bytes *= 2; - break; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - /* not entirely clearly why do i need this yet - size_t max_elements_loaded = AVAIL_MEM_SIZE / input_elm_size_in_bytes; - size_t num_elements_loaded; - size_t local_work_size_swap, num_grps_pro_row; - */ - - //if pre-callback is set for the plan - if (params.fft_hasPreCallback) - { - //we have already checked available LDS for pre callback - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_preCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - //if post-callback is set for the plan - //rarely do we need post callback in swap kernel. But it is possible. - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 0) << params.fft_postCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - //twiddle in swap kernel (for now, swap with twiddle seems to always be the second kernel after transpose) - bool twiddleSwapKernel = params.fft_3StepTwiddle && (dim_ratio > 1); - //twiddle factors applied to the output of swap kernels if swap kernels are the last kernel in transpose order - bool twiddleSwapKernelOut = twiddleSwapKernel && (params.nonSquareKernelOrder == TRANSPOSE_AND_SWAP || params.nonSquareKernelOrder == TRANSPOSE_LEADING_AND_SWAP); - //twiddle factors applied to the input of swap kernels if swap kernels are the first kernel in transpose order - bool twiddleSwapKernelIn = twiddleSwapKernel && (params.nonSquareKernelOrder == SWAP_AND_TRANSPOSE); - - - //generate the swap_table - std::vector > permutationTable; - permutation_calculation(dim_ratio, smaller_dim, permutationTable); - - clKernWrite(transKernel, 0) << "__constant size_t swap_table["<< permutationTable.size()+2 <<"][1] = {" << std::endl; - clKernWrite(transKernel, 0) << "{0}," << std::endl; - clKernWrite(transKernel, 0) << "{"<< smaller_dim * dim_ratio - 1 <<"}," << std::endl;// add the first and last row to the swap table. needed for twiddling - for (std::vector >::iterator itor = permutationTable.begin(); itor != permutationTable.end(); itor++) - { - clKernWrite(transKernel, 0) << "{" << (*itor)[0] << "}"; - if (itor == (permutationTable.end() - 1))//last vector - clKernWrite(transKernel, 0) << std::endl << "};" << std::endl; - else - clKernWrite(transKernel, 0) << "," << std::endl; - } - - //twiddle in swap kernel - //twiddle in or out should be using the same twiddling table - if (twiddleSwapKernel) - { - std::string str; - StockhamGenerator::TwiddleTableLarge twLarge(smaller_dim * smaller_dim * dim_ratio); - if ((params.fft_precision == CLFFT_SINGLE) || (params.fft_precision == CLFFT_SINGLE_FAST)) - twLarge.GenerateTwiddleTable(str); - else - twLarge.GenerateTwiddleTable(str); - clKernWrite(transKernel, 0) << str << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - //std::string funcName = "swap_nonsquare_" + std::to_string(smaller_dim) + "_" + std::to_string(dim_ratio); - std::string funcName = "swap_nonsquare_"; - std::string smaller_dim_str = static_cast(std::ostringstream() << smaller_dim).str(); - std::string dim_ratio_str = static_cast(std::ostringstream() << dim_ratio).str(); - if(params.fft_N[0] > params.fft_N[1]) - funcName = funcName + smaller_dim_str + "_" + dim_ratio_str; - else - funcName = funcName + dim_ratio_str + "_" + smaller_dim_str; - - KernelFuncName = funcName; - size_t local_work_size_swap = 256; - - for (size_t bothDir = 0; bothDir < 2; bothDir++) - { - bool fwd = bothDir ? false : true; - // Generate kernel API - - /*when swap can be performed in LDS itself then, same prototype of transpose can be used for swap function too*/ - std::string funcNameTW; - if (twiddleSwapKernel) - { - if (fwd) - funcNameTW = funcName + "_tw_fwd"; - else - funcNameTW = funcName + "_tw_back"; + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_postCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + // If pre-callback is set for the plan + if (params.fft_hasPreCallback) { + // we have already checked available LDS for pre callback + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_preCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + /*Generating the swapping logic*/ + { + size_t num_reduced_row; + size_t num_reduced_col; + + if (params.fft_N[1] == smaller_dim) { + num_reduced_row = smaller_dim; + num_reduced_col = 2; + } else { + num_reduced_row = 2; + num_reduced_col = smaller_dim; + } + + std::string funcName; + + clKernWrite(transKernel, 0) << std::endl; + + auto *cycle_map = new size_t[num_reduced_row * num_reduced_col * 2]; + /* The memory required by cycle_map cannot exceed 2 times row*col by + * design*/ + + get_cycles(cycle_map, num_reduced_row, num_reduced_col); + + size_t *cycle_stat = new size_t[cycle_map[0] * 2], stat_idx = 0; + clKernWrite(transKernel, 0) << std::endl; + + clKernWrite(transKernel, 0) + << "__constant size_t swap_table[][3] = {" << std::endl; + + size_t inx = 0, start_inx, swap_inx = 0, num_swaps = 0; + for (size_t i = 0; i < cycle_map[0]; i++) { + start_inx = cycle_map[++inx]; + clKernWrite(transKernel, 0) + << "{ " << start_inx << ", " << cycle_map[inx + 1] << ", 0}," + << std::endl; + cycle_stat[stat_idx++] = num_swaps; + num_swaps++; + + while (start_inx != cycle_map[++inx]) { + size_t action_var = (cycle_map[inx + 1] == start_inx) ? 2 : 1; + clKernWrite(transKernel, 0) + << "{ " << cycle_map[inx] << ", " << cycle_map[inx + 1] << ", " + << action_var << "}," << std::endl; + if (action_var == 2) + cycle_stat[stat_idx++] = num_swaps; + num_swaps++; + } + } + /*Appending swap table for touching corner elements for post call back*/ + size_t last_datablk_idx = num_reduced_row * num_reduced_col - 1; + clKernWrite(transKernel, 0) << "{ 0, 0, 0}," << std::endl; + clKernWrite(transKernel, 0) << "{ " << last_datablk_idx << ", " + << last_datablk_idx << ", 0}," << std::endl; + + clKernWrite(transKernel, 0) << "};" << std::endl; + /*cycle_map[0] + 2, + 2 is added for post callback table appending*/ + size_t num_cycles_minus_1 = cycle_map[0] - 1; + + clKernWrite(transKernel, 0) << "__constant size_t cycle_stat[" + << cycle_map[0] << "][2] = {" << std::endl; + for (size_t i = 0; i < num_cycles_minus_1; i++) { + clKernWrite(transKernel, 0) << "{ " << cycle_stat[i * 2] << ", " + << cycle_stat[i * 2 + 1] << "}," << std::endl; + } + clKernWrite(transKernel, 0) + << "{ " << cycle_stat[num_cycles_minus_1 * 2] << ", " + << (cycle_stat[num_cycles_minus_1 * 2 + 1] + 2) << "}," << std::endl; + + clKernWrite(transKernel, 0) << "};" << std::endl; + + clKernWrite(transKernel, 0) << std::endl; + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 0) + << "void swap(global " << dtComplex << "* inputA, " << tmpBuffType + << " " << dtComplex << "* Ls, " << tmpBuffType << " " << dtComplex + << " * Ld, size_t is, size_t id, size_t pos, size_t end_indx, size_t " + "work_id"; + break; + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 0) + << "void swap(global " << dtPlanar << "* inputA_R, global " + << dtPlanar << "* inputA_I, " << tmpBuffType << " " << dtComplex + << "* Ls, " << tmpBuffType << " " << dtComplex + << "* Ld, size_t is, size_t id, size_t pos, size_t end_indx, size_t " + "work_id"; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + clKernWrite(transKernel, 0) + << "void swap(global " << dtPlanar << "* inputA, " << tmpBuffType + << " " << dtPlanar << "* Ls, " << tmpBuffType << " " << dtPlanar + << "* Ld, size_t is, size_t id, size_t pos, size_t end_indx, size_t " + "work_id"; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 0) + << ", size_t iOffset, __global void* post_userdata"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", __local void* localmem"; + } + } + + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 0) + << ", size_t iOffset, __global void* pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", __local void* localmem"; + } + } + + clKernWrite(transKernel, 0) << "){" << std::endl; + + clKernWrite(transKernel, 3) + << "for (size_t j = get_local_id(0); j < end_indx; j += " + << local_work_size_swap << "){" << std::endl; + + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: + + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; + + clKernWrite(transKernel, 9) + << "Ls[j] = " << params.fft_preCallback.funcname + << "(inputA, ( is *" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j + iOffset), pre_userdata"; + // clKernWrite(transKernel, 9) << "Ls[j] = " << + // params.fft_preCallback.funcname << "(inputA + iOffset, ( is *" << + // smaller_dim << " + " << num_elements_loaded << " * work_id + j), + // pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } - else - funcNameTW = funcName; - - genTransposePrototypeLeadingDimensionBatched(params, local_work_size_swap, dtPlanar, dtComplex, funcNameTW, transKernel, dtInput, dtOutput); - - clKernWrite(transKernel, 3) << "//each wg handles 1/"<< WG_per_line <<" row of " << LDS_per_WG << " in memory" << std::endl; - clKernWrite(transKernel, 3) << "const size_t num_wg_per_batch = " << (permutationTable.size() + 2)*WG_per_line << ";" << std::endl; // number of wg per batch = number of independent cycles - clKernWrite(transKernel, 3) << "size_t group_id = get_group_id(0);" << std::endl; - clKernWrite(transKernel, 3) << "size_t idx = get_local_id(0);" << std::endl; - - clKernWrite(transKernel, 3) << std::endl; - clKernWrite(transKernel, 3) << "size_t batch_offset = group_id / num_wg_per_batch;" << std::endl; - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 3) << "inputA += batch_offset*" << smaller_dim * bigger_dim << ";" << std::endl; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_COMPLEX_PLANAR: - { - clKernWrite(transKernel, 3) << "inputA_R += batch_offset*" << smaller_dim * bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 3) << "inputA_I += batch_offset*" << smaller_dim * bigger_dim << ";" << std::endl; - break; + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 9) + << "Ld[j] = " << params.fft_preCallback.funcname + << "(inputA, ( id *" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j + iOffset), pre_userdata"; + // clKernWrite(transKernel, 9) << "Ld[j] = " << + // params.fft_preCallback.funcname << "(inputA + iOffset, ( id *" << + // smaller_dim << " + " << num_elements_loaded << " * work_id + j), + // pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + clKernWrite(transKernel, 0) << ");" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + + clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j] = " << params.fft_preCallback.funcname + << "(inputA, ( id *" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j + iOffset), pre_userdata"; + // clKernWrite(transKernel, 9) << "Ld[j] = " << + // params.fft_preCallback.funcname << "(inputA + iOffset, ( id *" << + // smaller_dim << " + " << num_elements_loaded << " * work_id + j), + // pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } - clKernWrite(transKernel, 3) << "group_id -= batch_offset*" << (permutationTable.size() + 2)*WG_per_line << ";" << std::endl; - - clKernWrite(transKernel, 3) << std::endl; - if(WG_per_line == 1) - clKernWrite(transKernel, 3) << "size_t prev = swap_table[group_id][0];" << std::endl; - else - clKernWrite(transKernel, 3) << "size_t prev = swap_table[group_id/" << WG_per_line <<"][0];" << std::endl; - clKernWrite(transKernel, 3) << "size_t next = 0;" << std::endl; - - clKernWrite(transKernel, 3) << std::endl; - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - { - clKernWrite(transKernel, 3) << "__local " << dtInput << " prevValue[" << LDS_per_WG << "];" << std::endl;//lds within each wg should be able to store a row block (smaller_dim) of element - clKernWrite(transKernel, 3) << "__local " << dtInput << " nextValue[" << LDS_per_WG << "];" << std::endl; - break; + clKernWrite(transKernel, 0) << ");" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + } else { + clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; + clKernWrite(transKernel, 9) + << "Ls[j] = inputA[is *" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j] = inputA[id *" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + + clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j] = inputA[id *" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + } + + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(inputA, (iOffset + id*" + << smaller_dim << " + " << num_elements_loaded + << " * work_id + j), post_userdata, Ls[j]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } - case CLFFT_COMPLEX_PLANAR: - { - clKernWrite(transKernel, 3) << "__local " << dtComplex << " prevValue[" << LDS_per_WG << "];" << std::endl;//lds within each wg should be able to store a row block (smaller_dim) of element - clKernWrite(transKernel, 3) << "__local " << dtComplex << " nextValue[" << LDS_per_WG << "];" << std::endl; - break; + clKernWrite(transKernel, 0) << ");" << std::endl; + } else if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) + << "inputA[id*" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j + iOffset] = Ls[j];" << std::endl; + } else { + clKernWrite(transKernel, 6) + << "inputA[id*" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j] = Ls[j];" << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; + clKernWrite(transKernel, 9) + << "Ls[j] = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, (is * " << smaller_dim << " + " + << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 9) + << "Ld[j] = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, (id * " << smaller_dim << " + " + << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } + clKernWrite(transKernel, 0) << ");" << std::endl; - clKernWrite(transKernel, 3) << std::endl; - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - if (WG_per_line == 1) - { - //might look like: size_t group_offset = (prev/3)*729*3 + (prev%3)*729; - clKernWrite(transKernel, 3) << "size_t group_offset = (prev/" << dim_ratio << ")*" << smaller_dim << "*" << dim_ratio - << " + (prev%" << dim_ratio << ")*" << smaller_dim << ";" << std::endl; - } - else - { - //if smaller_dim is 2187 > 1024 this should look like size_t group_offset = (prev/3)*2187*3 + (prev%3)*2187 + (group_id % 3)*729; - clKernWrite(transKernel, 3) << "size_t group_offset = (prev/" << dim_ratio << ")*" << smaller_dim << "*" << dim_ratio - << " + (prev%" << dim_ratio << ")*" << smaller_dim << " + (group_id % " << WG_per_line << ")*" << LDS_per_WG << ";" << std::endl; - } + clKernWrite(transKernel, 6) << "}" << std::endl; + + clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; + + clKernWrite(transKernel, 9) + << "Ld[j] = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, (id * " << smaller_dim << " + " + << num_elements_loaded << " * work_id + j + iOffset), pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } - else - { - if (WG_per_line == 1)//might look like: size_t group_offset = prev*729; - clKernWrite(transKernel, 3) << "size_t group_offset = (prev*" << smaller_dim << ");" << std::endl; - else//if smaller_dim is 2187 > 1024 this should look like size_t group_offset = prev*2187 + (group_id % 3)*729; - clKernWrite(transKernel, 3) << "size_t group_offset = (prev*" << smaller_dim << ") + (group_id % " << WG_per_line << ")*" << LDS_per_WG << ";" << std::endl; + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 6) << "}" << std::endl; + } else { + clKernWrite(transKernel, 6) << "if (pos == 0){" << std::endl; + clKernWrite(transKernel, 9) + << "Ls[j].x = inputA_R[is*" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 9) + << "Ls[j].y = inputA_I[is*" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j].x = inputA_R[id*" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j].y = inputA_I[id*" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + + clKernWrite(transKernel, 6) << "else if (pos == 1){" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j].x = inputA_R[id*" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 9) + << "Ld[j].y = inputA_I[id*" << smaller_dim << " + " + << num_elements_loaded << " * work_id + j];" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + } + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(inputA_R, inputA_I, (iOffset + id*" << smaller_dim << " + " + << num_elements_loaded + << " * work_id + j), post_userdata, Ls[j].x, Ls[j].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 6) + << "inputA_R[id*" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j] = Ls[j].x;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[id*" << smaller_dim << " + " << num_elements_loaded + << " * work_id + j] = Ls[j].y;" << std::endl; + } + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 0) << "}" << std::endl << std::endl; + + funcName = "swap_nonsquare"; + KernelFuncName = funcName; + // Generate kernel API + + /*when swap can be performed in LDS itself then, same prototype of transpose + * can be used for swap function too*/ + genTransposePrototypeLeadingDimensionBatched( + params, local_work_size_swap, dtPlanar, dtComplex, funcName, + transKernel, dtInput, dtOutput); + + clKernWrite(transKernel, 3) + << "size_t g_index = get_group_id(0);" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t numGroupsY_1 = " << cycle_map[0] * num_grps_pro_row + << " ;" << std::endl; + for (size_t i = 2; i < params.fft_DataDim - 1; i++) { + clKernWrite(transKernel, 3) + << "const size_t numGroupsY_" << i << " = numGroupsY_" << i - 1 + << " * " << params.fft_N[i] << ";" << std::endl; + } - clKernWrite(transKernel, 3) << std::endl; - //move to that row block and load that row block to LDS - if (twiddleSwapKernelIn) - { - clKernWrite(transKernel, 6) << "size_t p;" << std::endl; - clKernWrite(transKernel, 6) << "size_t q;" << std::endl; - clKernWrite(transKernel, 6) << dtComplex << " twiddle_factor;" << std::endl; - } - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - { - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "] = " << params.fft_preCallback.funcname - << "(inputA-batch_offset*" << smaller_dim * bigger_dim << ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - } - else - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "] = inputA[group_offset+idx+" << i << "];" << std::endl; - } - } - else - { - // need to handle boundary - clKernWrite(transKernel, 3) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "] = " << params.fft_preCallback.funcname - << "(inputA-batch_offset*" << smaller_dim * bigger_dim << ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - } - else - clKernWrite(transKernel, 6) << "prevValue[idx+" << i << "] = inputA[group_offset+idx+" << i << "];" << std::endl; - } - clKernWrite(transKernel, 3) << "}" << std::endl; - } - } - break; + delete[] cycle_map; + delete[] cycle_stat; + + Swap_OffsetCalc(transKernel, params); + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: + + clKernWrite(transKernel, 3) + << "__local " << dtInput << " tmp_tot_mem[" + << (num_elements_loaded * 2) << "];" << std::endl; + clKernWrite(transKernel, 3) << tmpBuffType << " " << dtInput + << " *te = tmp_tot_mem;" << std::endl; + + clKernWrite(transKernel, 3) + << tmpBuffType << " " << dtInput << " *to = (tmp_tot_mem + " + << num_elements_loaded << ");" << std::endl; + + // Do not advance offset when postcallback is set as the starting address + // of global buffer is needed + if (!params.fft_hasPostCallback && !params.fft_hasPreCallback) + clKernWrite(transKernel, 3) + << "inputA += iOffset;" + << std::endl; // Set A ptr to the start of each slice + break; + case CLFFT_COMPLEX_PLANAR: + + clKernWrite(transKernel, 3) + << "__local " << dtComplex << " tmp_tot_mem[" + << (num_elements_loaded * 2) << "];" << std::endl; + clKernWrite(transKernel, 3) << tmpBuffType << " " << dtComplex + << " *te = tmp_tot_mem;" << std::endl; + + clKernWrite(transKernel, 3) + << tmpBuffType << " " << dtComplex << " *to = (tmp_tot_mem + " + << num_elements_loaded << ");" << std::endl; + + // Do not advance offset when postcallback is set as the starting address + // of global buffer is needed + if (!params.fft_hasPostCallback) { + clKernWrite(transKernel, 3) + << "inputA_R += iOffset;" + << std::endl; // Set A ptr to the start of each slice + clKernWrite(transKernel, 3) + << "inputA_I += iOffset;" + << std::endl; // Set A ptr to the start of each slice + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 3) << tmpBuffType << " " << dtComplex + << " *tmp_swap_ptr[2];" << std::endl; + break; + case CLFFT_REAL: + clKernWrite(transKernel, 3) << tmpBuffType << " " << dtPlanar + << " *tmp_swap_ptr[2];" << std::endl; + } + clKernWrite(transKernel, 3) << "tmp_swap_ptr[0] = te;" << std::endl; + clKernWrite(transKernel, 3) << "tmp_swap_ptr[1] = to;" << std::endl; + + clKernWrite(transKernel, 3) << "size_t swap_inx = 0;" << std::endl; + + clKernWrite(transKernel, 3) << "size_t start = cycle_stat[g_index / " + << num_grps_pro_row << "][0];" << std::endl; + clKernWrite(transKernel, 3) << "size_t end = cycle_stat[g_index / " + << num_grps_pro_row << "][1];" << std::endl; + + clKernWrite(transKernel, 3) + << "size_t end_indx = " << num_elements_loaded << ";" << std::endl; + clKernWrite(transKernel, 3) << "size_t work_id = g_index % " + << num_grps_pro_row << ";" << std::endl; + + clKernWrite(transKernel, 3) + << "if( work_id == " << (num_grps_pro_row - 1) << " ){" << std::endl; + clKernWrite(transKernel, 6) + << "end_indx = " + << smaller_dim - num_elements_loaded * (num_grps_pro_row - 1) << ";" + << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) + << "for (size_t loop = start; loop <= end; loop ++){" << std::endl; + clKernWrite(transKernel, 6) << "swap_inx = 1 - swap_inx;" << std::endl; + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: + clKernWrite(transKernel, 6) + << "swap(inputA, tmp_swap_ptr[swap_inx], tmp_swap_ptr[1 - swap_inx], " + "swap_table[loop][0], swap_table[loop][1], swap_table[loop][2], " + "end_indx, work_id"; + break; + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 6) + << "swap(inputA_R, inputA_I, tmp_swap_ptr[swap_inx], tmp_swap_ptr[1 " + "- swap_inx], swap_table[loop][0], swap_table[loop][1], " + "swap_table[loop][2], end_indx, work_id"; + break; + } + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 0) << ", iOffset, post_userdata"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + } + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 0) << ", iOffset, pre_userdata"; + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 0) << "}" << std::endl; + strKernel = transKernel.str(); + } + return CLFFT_SUCCESS; +} + +// swap lines. a more general kernel generator. +// this function accepts any ratio in theory. But in practice we restrict it to +// 1:2, 1:3, 1:5 and 1:10 ration +clfftStatus genSwapKernelGeneral( + const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + std::string &strKernel, std::string &KernelFuncName, const size_t &lwSize, + const size_t reShapeFactor) { + if (params.fft_placeness == CLFFT_OUTOFPLACE) + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + size_t smaller_dim = + (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; + size_t bigger_dim = + (params.fft_N[0] >= params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; + size_t dim_ratio = bigger_dim / smaller_dim; + /* + if ( (params.fft_N[0] != 2 * params.fft_N[1]) && (params.fft_N[1] != 2 * + params.fft_N[0]) && (params.fft_N[0] != 3 * params.fft_N[1]) && + (params.fft_N[1] != 3 * params.fft_N[0]) && (params.fft_N[0] != 5 * + params.fft_N[1]) && (params.fft_N[1] != 5 * params.fft_N[0]) && + (params.fft_N[0] != 10 * params.fft_N[1]) && (params.fft_N[1] != 10 * + params.fft_N[0]) ) +*/ + if (dim_ratio % 2 != 0 && dim_ratio % 3 != 0 && dim_ratio % 5 != 0 && + dim_ratio % 10 != 0) { + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + strKernel.reserve(4096); + std::stringstream transKernel(std::stringstream::out); + + // These strings represent the various data types we read or write in the + // kernel, depending on how the plan is configured + std::string dtInput; // The type read as input into kernel + std::string dtOutput; // The type written as output from kernel + std::string dtPlanar; // Fundamental type for planar arrays + std::string tmpBuffType; + std::string dtComplex; // Fundamental type for complex arrays + + // NOTE: Enable only for debug + // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : + // enable\n" << std::endl; + + // if (params.fft_inputLayout != params.fft_outputLayout) + // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + dtPlanar = "float"; + dtComplex = "float2"; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + dtPlanar = "double"; + dtComplex = "double2"; + + // Emit code that enables double precision in the kernel + clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#else" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#endif\n" << std::endl; + + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + break; + } + + size_t LDS_per_WG = smaller_dim; + while (LDS_per_WG > + 1024) // avoiding using too much lds memory. the biggest LDS memory we + // will allocate would be 1024*sizeof(float2/double2)*2 + { + if (LDS_per_WG % 2 == 0) { + LDS_per_WG /= 2; + continue; + } + if (LDS_per_WG % 3 == 0) { + LDS_per_WG /= 3; + continue; + } + if (LDS_per_WG % 5 == 0) { + LDS_per_WG /= 5; + continue; + } + return CLFFT_NOTIMPLEMENTED; + } + size_t WG_per_line = smaller_dim / LDS_per_WG; + + size_t input_elm_size_in_bytes; + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + input_elm_size_in_bytes = 4; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + input_elm_size_in_bytes = 8; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + input_elm_size_in_bytes *= 2; + break; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + /* not entirely clearly why do i need this yet + size_t max_elements_loaded = AVAIL_MEM_SIZE / input_elm_size_in_bytes; + size_t num_elements_loaded; + size_t local_work_size_swap, num_grps_pro_row; + */ + + // if pre-callback is set for the plan + if (params.fft_hasPreCallback) { + // we have already checked available LDS for pre callback + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_preCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + // if post-callback is set for the plan + // rarely do we need post callback in swap kernel. But it is possible. + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 0) + << params.fft_postCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + // twiddle in swap kernel (for now, swap with twiddle seems to always be the + // second kernel after transpose) + bool twiddleSwapKernel = params.fft_3StepTwiddle && (dim_ratio > 1); + // twiddle factors applied to the output of swap kernels if swap kernels are + // the last kernel in transpose order + bool twiddleSwapKernelOut = + twiddleSwapKernel && + (params.nonSquareKernelOrder == TRANSPOSE_AND_SWAP || + params.nonSquareKernelOrder == TRANSPOSE_LEADING_AND_SWAP); + // twiddle factors applied to the input of swap kernels if swap kernels are + // the first kernel in transpose order + bool twiddleSwapKernelIn = + twiddleSwapKernel && (params.nonSquareKernelOrder == SWAP_AND_TRANSPOSE); + + // generate the swap_table + std::vector> permutationTable; + permutation_calculation(dim_ratio, smaller_dim, permutationTable); + + clKernWrite(transKernel, 0) + << "__constant size_t swap_table[" << permutationTable.size() + 2 + << "][1] = {" << std::endl; + clKernWrite(transKernel, 0) << "{0}," << std::endl; + clKernWrite(transKernel, 0) << "{" << smaller_dim * dim_ratio - 1 << "}," + << std::endl; // add the first and last row to the + // swap table. needed for twiddling + for (auto itor = + permutationTable.begin(); + itor != permutationTable.end(); itor++) { + clKernWrite(transKernel, 0) << "{" << (*itor)[0] << "}"; + if (itor == (permutationTable.end() - 1)) // last vector + clKernWrite(transKernel, 0) << std::endl << "};" << std::endl; + else + clKernWrite(transKernel, 0) << "," << std::endl; + } + + // twiddle in swap kernel + // twiddle in or out should be using the same twiddling table + if (twiddleSwapKernel) { + std::string str; + StockhamGenerator::TwiddleTableLarge twLarge(smaller_dim * smaller_dim * + dim_ratio); + if ((params.fft_precision == CLFFT_SINGLE) || + (params.fft_precision == CLFFT_SINGLE_FAST)) + twLarge.GenerateTwiddleTable(str); + else + twLarge.GenerateTwiddleTable(str); + clKernWrite(transKernel, 0) << str << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + // std::string funcName = "swap_nonsquare_" + std::to_string(smaller_dim) + + // "_" + std::to_string(dim_ratio); + std::string funcName = "swap_nonsquare_"; + std::string smaller_dim_str = static_cast( + std::ostringstream() << smaller_dim) + .str(); + std::string dim_ratio_str = + static_cast(std::ostringstream() << dim_ratio) + .str(); + if (params.fft_N[0] > params.fft_N[1]) + funcName = funcName + smaller_dim_str + "_" + dim_ratio_str; + else + funcName = funcName + dim_ratio_str + "_" + smaller_dim_str; + + KernelFuncName = funcName; + size_t local_work_size_swap = 256; + + for (size_t bothDir = 0; bothDir < 2; bothDir++) { + bool fwd = bothDir ? false : true; + // Generate kernel API + + /*when swap can be performed in LDS itself then, same prototype of transpose + * can be used for swap function too*/ + std::string funcNameTW; + if (twiddleSwapKernel) { + if (fwd) + funcNameTW = funcName + "_tw_fwd"; + else + funcNameTW = funcName + "_tw_back"; + } else + funcNameTW = funcName; + + genTransposePrototypeLeadingDimensionBatched( + params, local_work_size_swap, dtPlanar, dtComplex, funcNameTW, + transKernel, dtInput, dtOutput); + + clKernWrite(transKernel, 3) + << "//each wg handles 1/" << WG_per_line << " row of " << LDS_per_WG + << " in memory" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t num_wg_per_batch = " + << (permutationTable.size() + 2) * WG_per_line << ";" + << std::endl; // number of wg per batch = number of independent cycles + clKernWrite(transKernel, 3) + << "size_t group_id = get_group_id(0);" << std::endl; + clKernWrite(transKernel, 3) << "size_t idx = get_local_id(0);" << std::endl; + + clKernWrite(transKernel, 3) << std::endl; + clKernWrite(transKernel, 3) + << "size_t batch_offset = group_id / num_wg_per_batch;" << std::endl; + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 3) + << "inputA += batch_offset*" << smaller_dim * bigger_dim << ";" + << std::endl; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_COMPLEX_PLANAR: { + clKernWrite(transKernel, 3) + << "inputA_R += batch_offset*" << smaller_dim * bigger_dim << ";" + << std::endl; + clKernWrite(transKernel, 3) + << "inputA_I += batch_offset*" << smaller_dim * bigger_dim << ";" + << std::endl; + break; + } + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + clKernWrite(transKernel, 3) + << "group_id -= batch_offset*" + << (permutationTable.size() + 2) * WG_per_line << ";" << std::endl; + + clKernWrite(transKernel, 3) << std::endl; + if (WG_per_line == 1) + clKernWrite(transKernel, 3) + << "size_t prev = swap_table[group_id][0];" << std::endl; + else + clKernWrite(transKernel, 3) << "size_t prev = swap_table[group_id/" + << WG_per_line << "][0];" << std::endl; + clKernWrite(transKernel, 3) << "size_t next = 0;" << std::endl; + + clKernWrite(transKernel, 3) << std::endl; + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: { + clKernWrite(transKernel, 3) + << "__local " << dtInput << " prevValue[" << LDS_per_WG << "];" + << std::endl; // lds within each wg should be able to store a row + // block (smaller_dim) of element + clKernWrite(transKernel, 3) << "__local " << dtInput << " nextValue[" + << LDS_per_WG << "];" << std::endl; + break; + } + case CLFFT_COMPLEX_PLANAR: { + clKernWrite(transKernel, 3) + << "__local " << dtComplex << " prevValue[" << LDS_per_WG << "];" + << std::endl; // lds within each wg should be able to store a row + // block (smaller_dim) of element + clKernWrite(transKernel, 3) << "__local " << dtComplex << " nextValue[" + << LDS_per_WG << "];" << std::endl; + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 3) << std::endl; + if (params.fft_N[0] > + params.fft_N[1]) // decides whether we have a tall or wide rectangle + { + if (WG_per_line == 1) { + // might look like: size_t group_offset = (prev/3)*729*3 + (prev%3)*729; + clKernWrite(transKernel, 3) + << "size_t group_offset = (prev/" << dim_ratio << ")*" + << smaller_dim << "*" << dim_ratio << " + (prev%" << dim_ratio + << ")*" << smaller_dim << ";" << std::endl; + } else { + // if smaller_dim is 2187 > 1024 this should look like size_t + // group_offset = (prev/3)*2187*3 + (prev%3)*2187 + (group_id % 3)*729; + clKernWrite(transKernel, 3) + << "size_t group_offset = (prev/" << dim_ratio << ")*" + << smaller_dim << "*" << dim_ratio << " + (prev%" << dim_ratio + << ")*" << smaller_dim << " + (group_id % " << WG_per_line << ")*" + << LDS_per_WG << ";" << std::endl; + } + } else { + if (WG_per_line == 1) // might look like: size_t group_offset = prev*729; + clKernWrite(transKernel, 3) << "size_t group_offset = (prev*" + << smaller_dim << ");" << std::endl; + else // if smaller_dim is 2187 > 1024 this should look like size_t + // group_offset = prev*2187 + (group_id % 3)*729; + clKernWrite(transKernel, 3) + << "size_t group_offset = (prev*" << smaller_dim + << ") + (group_id % " << WG_per_line << ")*" << LDS_per_WG << ";" + << std::endl; + } + + clKernWrite(transKernel, 3) << std::endl; + // move to that row block and load that row block to LDS + if (twiddleSwapKernelIn) { + clKernWrite(transKernel, 6) << "size_t p;" << std::endl; + clKernWrite(transKernel, 6) << "size_t q;" << std::endl; + clKernWrite(transKernel, 6) + << dtComplex << " twiddle_factor;" << std::endl; + } + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) { + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y;" << std::endl; + } + } else + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "] = inputA[group_offset+idx+" + << i << "];" << std::endl; + } + } else { + // need to handle boundary + clKernWrite(transKernel, 3) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y;" << std::endl; + } + } else + clKernWrite(transKernel, 6) + << "prevValue[idx+" << i << "] = inputA[group_offset+idx+" + << i << "];" << std::endl; + } + clKernWrite(transKernel, 3) << "}" << std::endl; } - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_COMPLEX_PLANAR: - { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - { - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "] = " << params.fft_preCallback.funcname << - "(inputA_R-batch_offset*"<< smaller_dim * bigger_dim <<", inputA_I-batch_offset*"<< smaller_dim * bigger_dim << - ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - } - } - else - { - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "];" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "];" << std::endl; - } - } - } - else - { - // need to handle boundary - clKernWrite(transKernel, 3) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "] = " << params.fft_preCallback.funcname << - "(inputA_R-batch_offset*" << smaller_dim * bigger_dim << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim << - ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - } - } - else - { - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "];" << std::endl; - clKernWrite(transKernel, 3) << "prevValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "];" << std::endl; - } - } - clKernWrite(transKernel, 3) << "}" << std::endl; - } + } + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_COMPLEX_PLANAR: { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) { + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA_R-batch_offset*" << smaller_dim * bigger_dim + << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].y = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].y = inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + } + } else { + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" + << i << "];" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].y = inputA_I[group_offset+idx+" + << i << "];" << std::endl; } - break; - } - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - clKernWrite(transKernel, 3) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - - clKernWrite(transKernel, 3) << std::endl; - clKernWrite(transKernel, 3) << "do{" << std::endl;//begining of do-while - //calculate the next location p(k) = (k*n)mod(m*n-1), if 0 < k < m*n-1 - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - clKernWrite(transKernel, 6) << "next = (prev*" << smaller_dim << ")%" << smaller_dim*dim_ratio - 1 << ";" << std::endl; - //takes care the last row - clKernWrite(transKernel, 6) << "if (prev == " << smaller_dim * dim_ratio - 1 << ")" << std::endl; - clKernWrite(transKernel, 9) << "next = " << smaller_dim * dim_ratio - 1 << ";" << std::endl; - if (WG_per_line == 1) - { - clKernWrite(transKernel, 6) << "group_offset = (next/" << dim_ratio << ")*" << smaller_dim << "*" << dim_ratio - << " + (next%" << dim_ratio << ")*" << smaller_dim << ";" << std::endl; //might look like: group_offset = (next/3)*729*3 + (next%3)*729; - } - else - { - //if smaller_dim is 2187 > 1024 this should look like size_t group_offset = (next/3)*2187*3 + (next%3)*2187 + (group_id % 3)*729; - clKernWrite(transKernel, 6) << "group_offset = (next/" << dim_ratio << ")*" << smaller_dim << "*" << dim_ratio - << " + (next%" << dim_ratio << ")*" << smaller_dim << " + (group_id % " << WG_per_line << ")*" << LDS_per_WG << ";" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "next = (prev*" << dim_ratio << ")%" << smaller_dim*dim_ratio - 1 << ";" << std::endl; - //takes care the last row - clKernWrite(transKernel, 6) << "if (prev == " << smaller_dim * dim_ratio - 1 << ")" << std::endl; - clKernWrite(transKernel, 9) << "next = " << smaller_dim * dim_ratio - 1 << ";" << std::endl; - if (WG_per_line == 1) //might look like: size_t group_offset = prev*729; - clKernWrite(transKernel, 6) << "group_offset = (next*" << smaller_dim << ");" << std::endl; - else//if smaller_dim is 2187 > 1024 this should look like size_t group_offset = next*2187 + (group_id % 3)*729; - clKernWrite(transKernel, 6) << "group_offset = (next*" << smaller_dim << ") + (group_id % " << WG_per_line << ")*" << LDS_per_WG << ";" << std::endl; + } + } else { + // need to handle boundary + clKernWrite(transKernel, 3) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA_R-batch_offset*" << smaller_dim * bigger_dim + << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].y = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i + << "].y = inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + } + } else { + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].x = inputA_R[group_offset+idx+" + << i << "];" << std::endl; + clKernWrite(transKernel, 3) + << "prevValue[idx+" << i << "].y = inputA_I[group_offset+idx+" + << i << "];" << std::endl; + } + } + clKernWrite(transKernel, 3) << "}" << std::endl; } + } + break; + } + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + clKernWrite(transKernel, 3) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + clKernWrite(transKernel, 3) << std::endl; + clKernWrite(transKernel, 3) << "do{" << std::endl; // begining of do-while + // calculate the next location p(k) = (k*n)mod(m*n-1), if 0 < k < m*n-1 + if (params.fft_N[0] > + params.fft_N[1]) // decides whether we have a tall or wide rectangle + { + clKernWrite(transKernel, 6) + << "next = (prev*" << smaller_dim << ")%" + << smaller_dim * dim_ratio - 1 << ";" << std::endl; + // takes care the last row + clKernWrite(transKernel, 6) + << "if (prev == " << smaller_dim * dim_ratio - 1 << ")" << std::endl; + clKernWrite(transKernel, 9) + << "next = " << smaller_dim * dim_ratio - 1 << ";" << std::endl; + if (WG_per_line == 1) { + clKernWrite(transKernel, 6) + << "group_offset = (next/" << dim_ratio << ")*" << smaller_dim + << "*" << dim_ratio << " + (next%" << dim_ratio << ")*" + << smaller_dim << ";" + << std::endl; // might look like: group_offset = (next/3)*729*3 + + // (next%3)*729; + } else { + // if smaller_dim is 2187 > 1024 this should look like size_t + // group_offset = (next/3)*2187*3 + (next%3)*2187 + (group_id % 3)*729; + clKernWrite(transKernel, 6) + << "group_offset = (next/" << dim_ratio << ")*" << smaller_dim + << "*" << dim_ratio << " + (next%" << dim_ratio << ")*" + << smaller_dim << " + (group_id % " << WG_per_line << ")*" + << LDS_per_WG << ";" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "next = (prev*" << dim_ratio << ")%" << smaller_dim * dim_ratio - 1 + << ";" << std::endl; + // takes care the last row + clKernWrite(transKernel, 6) + << "if (prev == " << smaller_dim * dim_ratio - 1 << ")" << std::endl; + clKernWrite(transKernel, 9) + << "next = " << smaller_dim * dim_ratio - 1 << ";" << std::endl; + if (WG_per_line == 1) // might look like: size_t group_offset = prev*729; + clKernWrite(transKernel, 6) + << "group_offset = (next*" << smaller_dim << ");" << std::endl; + else // if smaller_dim is 2187 > 1024 this should look like size_t + // group_offset = next*2187 + (group_id % 3)*729; + clKernWrite(transKernel, 6) + << "group_offset = (next*" << smaller_dim << ") + (group_id % " + << WG_per_line << ")*" << LDS_per_WG << ";" << std::endl; + } - clKernWrite(transKernel, 3) << std::endl; - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "] = " << params.fft_preCallback.funcname - << "(inputA-batch_offset*" << smaller_dim * bigger_dim << ", batch_offset*" << smaller_dim*bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - } - else - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "] = inputA[group_offset+idx+" << i << "];" << std::endl; - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "] = " << params.fft_preCallback.funcname - << "(inputA-batch_offset*" << smaller_dim * bigger_dim << ", batch_offset*" << smaller_dim*bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - } - else - clKernWrite(transKernel, 9) << "nextValue[idx+" << i << "] = inputA[group_offset+idx+" << i << "];" << std::endl; - } - clKernWrite(transKernel, 6) << "}" << std::endl; - } - } - break; + clKernWrite(transKernel, 3) << std::endl; + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y;" << std::endl; + } + } else + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i << "] = inputA[group_offset+idx+" + << i << "];" << std::endl; + } + else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].x = inputA[group_offset+idx+" + << i << "].x * twiddle_factor.x + inputA[group_offset+idx+" + << i << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i << "].y = inputA[group_offset+idx+" + << i << "].y * twiddle_factor.x - inputA[group_offset+idx+" + << i << "].x * twiddle_factor.y;" << std::endl; + } + } else + clKernWrite(transKernel, 9) + << "nextValue[idx+" << i << "] = inputA[group_offset+idx+" + << i << "];" << std::endl; + } + clKernWrite(transKernel, 6) << "}" << std::endl; } - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_COMPLEX_PLANAR: - { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - { - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "] = " << params.fft_preCallback.funcname << - "(inputA_R-batch_offset*" << smaller_dim * bigger_dim << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim << - ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "];" << std::endl; - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "];" << std::endl; - } - } - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "] = " << params.fft_preCallback.funcname << - "(inputA_R-batch_offset*" << smaller_dim * bigger_dim << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim << - ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; - } - else - { - if (twiddleSwapKernelIn) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide; read input index realted - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 3) << "nextValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i << "] * twiddle_factor.y;" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" << i << "];" << std::endl; - clKernWrite(transKernel, 6) << "nextValue[idx+" << i << "].y = inputA_I[group_offset+idx+" << i << "];" << std::endl; - } - } - clKernWrite(transKernel, 6) << "}" << std::endl; - } + } + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_COMPLEX_PLANAR: { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) { + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA_R-batch_offset*" << smaller_dim * bigger_dim + << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].y = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].y = inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" + << i << "];" << std::endl; + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i << "].y = inputA_I[group_offset+idx+" + << i << "];" << std::endl; } - break; - } - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + } else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i + << "] = " << params.fft_preCallback.funcname + << "(inputA_R-batch_offset*" << smaller_dim * bigger_dim + << ", inputA_I-batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i << ", pre_userdata);" << std::endl; + } else { + if (twiddleSwapKernelIn) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have + // a tall or wide rectangle + { + // input is wide; output is tall; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim + << ";" << std::endl; + } else { + // input is tall; output is wide; read input index realted + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim + << ";" << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim + << ";" << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].y = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].x = inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.x + inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 3) + << "nextValue[idx+" << i + << "].y = inputA_I[group_offset+idx+" << i + << "] * twiddle_factor.x - inputA_R[group_offset+idx+" << i + << "] * twiddle_factor.y;" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i << "].x = inputA_R[group_offset+idx+" + << i << "];" << std::endl; + clKernWrite(transKernel, 6) + << "nextValue[idx+" << i << "].y = inputA_I[group_offset+idx+" + << i << "];" << std::endl; + } + } + clKernWrite(transKernel, 6) << "}" << std::endl; } + } + break; + } + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } - clKernWrite(transKernel, 6) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - - clKernWrite(transKernel, 3) << std::endl; - switch (params.fft_inputLayout) - { - case CLFFT_REAL:// for real case this is different - case CLFFT_COMPLEX_INTERLEAVED: - { - if (twiddleSwapKernelOut) + clKernWrite(transKernel, 6) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + + clKernWrite(transKernel, 3) << std::endl; + switch (params.fft_inputLayout) { + case CLFFT_REAL: // for real case this is different + case CLFFT_COMPLEX_INTERLEAVED: { + if (twiddleSwapKernelOut) { + clKernWrite(transKernel, 6) << "size_t p;" << std::endl; + clKernWrite(transKernel, 6) << "size_t q;" << std::endl; + clKernWrite(transKernel, 6) + << dtComplex << " twiddle_factor;" << std::endl; + + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have a + // tall or wide rectangle { - clKernWrite(transKernel, 6) << "size_t p;" << std::endl; - clKernWrite(transKernel, 6) << "size_t q;" << std::endl; - clKernWrite(transKernel, 6) << dtComplex << " twiddle_factor;" << std::endl; - - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" << i << "].x * twiddle_factor.x - prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" << i << "].x * twiddle_factor.y + prevValue[idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" << i << "].x * twiddle_factor.x + prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" << i << "].y * twiddle_factor.x - prevValue[idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - //clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "] = prevValue[idx+" << i << "];" << std::endl; - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" << i << "].x * twiddle_factor.x - prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" << i << "].x * twiddle_factor.y + prevValue[idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" << i << "].x * twiddle_factor.x + prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" << i << "].y * twiddle_factor.x - prevValue[idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - //clKernWrite(transKernel, 9) << "inputA[group_offset+idx+" << i << "] = prevValue[idx+" << i << "];" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - } + // input is wide; output is tall + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" + << std::endl; + } else { + // input is tall; output is wide + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" + << std::endl; } - else if(!twiddleSwapKernelOut)//could be twiddleSwapKernelIn + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" + << i << "].x * twiddle_factor.x - prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" + << i << "].x * twiddle_factor.y + prevValue[idx+" << i + << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" + << i << "].x * twiddle_factor.x + prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" + << i << "].y * twiddle_factor.x - prevValue[idx+" << i + << "].x * twiddle_factor.y;" << std::endl; + } + // clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << + // "] = prevValue[idx+" << i << "];" << std::endl; + } else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have a + // tall or wide rectangle { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - //twiddling and callback do not coexist - if (params.fft_hasPostCallback) - { - if (i + 256 < LDS_per_WG) - { - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(inputA - batch_offset*" << smaller_dim * bigger_dim - << ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", post_userdata, prevValue[idx+" << i - << "]);" << std::endl; - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(inputA - batch_offset*" << smaller_dim * bigger_dim - << ", batch_offset*" << smaller_dim * bigger_dim << "+group_offset+idx+" << i << ", post_userdata, prevValue[idx+" << i - << "]);" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - } - else - { - if (i + 256 < LDS_per_WG) - clKernWrite(transKernel, 6) << "inputA[group_offset+idx+" << i << "] = prevValue[idx+" << i << "];" << std::endl; - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - clKernWrite(transKernel, 9) << "inputA[group_offset+idx+" << i << "] = prevValue[idx+" << i << "];" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - } - } + // input is wide; output is tall + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" + << std::endl; + } else { + // input is tall; output is wide + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" + << std::endl; + } + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" + << i << "].x * twiddle_factor.x - prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" + << i << "].x * twiddle_factor.y + prevValue[idx+" << i + << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].x = prevValue[idx+" + << i << "].x * twiddle_factor.x + prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "].y = prevValue[idx+" + << i << "].y * twiddle_factor.x - prevValue[idx+" << i + << "].x * twiddle_factor.y;" << std::endl; + } + // clKernWrite(transKernel, 9) << "inputA[group_offset+idx+" << i << + // "] = prevValue[idx+" << i << "];" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + } + } + } else if (!twiddleSwapKernelOut) // could be twiddleSwapKernelIn + { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + // twiddling and callback do not coexist + if (params.fft_hasPostCallback) { + if (i + 256 < LDS_per_WG) { + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(inputA - batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i + << ", post_userdata, prevValue[idx+" << i << "]);" + << std::endl; + } else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(inputA - batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i + << ", post_userdata, prevValue[idx+" << i << "]);" + << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + } + } else { + if (i + 256 < LDS_per_WG) + clKernWrite(transKernel, 6) + << "inputA[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "];" << std::endl; + else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + clKernWrite(transKernel, 9) + << "inputA[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "];" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; } - break; + } } - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_COMPLEX_PLANAR: - { - if (twiddleSwapKernelOut) + } + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_COMPLEX_PLANAR: { + if (twiddleSwapKernelOut) { + clKernWrite(transKernel, 6) << "size_t p;" << std::endl; + clKernWrite(transKernel, 6) << "size_t q;" << std::endl; + clKernWrite(transKernel, 6) + << dtComplex << " twiddle_factor;" << std::endl; + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) { + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have a + // tall or wide rectangle { - clKernWrite(transKernel, 6) << "size_t p;" << std::endl; - clKernWrite(transKernel, 6) << "size_t q;" << std::endl; - clKernWrite(transKernel, 6) << dtComplex << " twiddle_factor;" << std::endl; - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - { - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x * twiddle_factor.x - prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x * twiddle_factor.y + prevValue[idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x * twiddle_factor.x + prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].y * twiddle_factor.x - prevValue[idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - if (params.fft_N[0] > params.fft_N[1])//decides whether we have a tall or wide rectangle - { - //input is wide; output is tall - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" << std::endl; - } - else - { - //input is tall; output is wide - clKernWrite(transKernel, 6) << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" << std::endl; - clKernWrite(transKernel, 6) << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" << std::endl; - } - clKernWrite(transKernel, 6) << "twiddle_factor = TW3step(p*q);" << std::endl; - if (fwd) - { - //forward - clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x * twiddle_factor.x - prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x * twiddle_factor.y + prevValue[idx+" << i << "].y * twiddle_factor.x;" << std::endl; - } - else - { - //backward - clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x * twiddle_factor.x + prevValue[idx+" << i << "].y * twiddle_factor.y;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].y * twiddle_factor.x - prevValue[idx+" << i << "].x * twiddle_factor.y;" << std::endl; - } - clKernWrite(transKernel, 6) << "}" << std::endl; - } - clKernWrite(transKernel, 3) << std::endl; - } + // input is wide; output is tall + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" + << std::endl; + } else { + // input is tall; output is wide + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" + << std::endl; } - else if (!twiddleSwapKernelOut)//could be twiddleSwapKernelIn + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 6) + << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x * twiddle_factor.x - prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x * twiddle_factor.y + prevValue[idx+" << i + << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 6) + << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x * twiddle_factor.x + prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].y * twiddle_factor.x - prevValue[idx+" << i + << "].x * twiddle_factor.y;" << std::endl; + } + } else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + if (params.fft_N[0] > params.fft_N[1]) // decides whether we have a + // tall or wide rectangle { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - //twiddling and callback do not coexist - if (params.fft_hasPostCallback) - { - if (i + 256 < LDS_per_WG) - { - //clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x;" << std::endl; - //clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].y;" << std::endl; - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(inputA_R - batch_offset*" << smaller_dim * bigger_dim - << ", inputA_I - batch_offset*" << smaller_dim * bigger_dim << ", batch_offset*" << smaller_dim * bigger_dim - << "+group_offset+idx+" << i << ", post_userdata, prevValue[idx+" << i << "].x, prevValue[idx+" << i << "].y);" << std::endl; - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(inputA_R - batch_offset*" << smaller_dim * bigger_dim - << ", inputA_I - batch_offset*" << smaller_dim * bigger_dim << ", batch_offset*" << smaller_dim * bigger_dim - << "+group_offset+idx+" << i << ", post_userdata, prevValue[idx+" << i << "].x, prevValue[idx+" << i << "].y);" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - } - else - { - if (i + 256 < LDS_per_WG) - { - clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].y;" << std::endl; - } - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].x;" << std::endl; - clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" << i << "].y;" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } - } - } + // input is wide; output is tall + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << smaller_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << smaller_dim << ";" + << std::endl; + } else { + // input is tall; output is wide + clKernWrite(transKernel, 6) + << "p = (group_offset+idx+" << i << ")/" << bigger_dim << ";" + << std::endl; + clKernWrite(transKernel, 6) + << "q = (group_offset+idx+" << i << ")%" << bigger_dim << ";" + << std::endl; } - break; - } - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + clKernWrite(transKernel, 6) + << "twiddle_factor = TW3step(p*q);" << std::endl; + if (fwd) { + // forward + clKernWrite(transKernel, 6) + << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x * twiddle_factor.x - prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x * twiddle_factor.y + prevValue[idx+" << i + << "].y * twiddle_factor.x;" << std::endl; + } else { + // backward + clKernWrite(transKernel, 6) + << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x * twiddle_factor.x + prevValue[idx+" << i + << "].y * twiddle_factor.y;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].y * twiddle_factor.x - prevValue[idx+" << i + << "].x * twiddle_factor.y;" << std::endl; + } + clKernWrite(transKernel, 6) << "}" << std::endl; + } + clKernWrite(transKernel, 3) << std::endl; } - clKernWrite(transKernel, 6) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - - clKernWrite(transKernel, 3) << std::endl; - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - { - for (size_t i = 0; i < LDS_per_WG; i = i + 256) - { - if (i + 256 < LDS_per_WG) - clKernWrite(transKernel, 6) << "prevValue[idx+" << i << "] = nextValue[idx+" << i << "];" << std::endl; - else - { - // need to handle boundary - clKernWrite(transKernel, 6) << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; - clKernWrite(transKernel, 9) << "prevValue[idx + " << i << "] = nextValue[idx + " << i << "]; " << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - } + } else if (!twiddleSwapKernelOut) // could be twiddleSwapKernelIn + { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + // twiddling and callback do not coexist + if (params.fft_hasPostCallback) { + if (i + 256 < LDS_per_WG) { + // clKernWrite(transKernel, 6) << "inputA_R[group_offset+idx+" << + // i << "] = prevValue[idx+" << i << "].x;" << std::endl; + // clKernWrite(transKernel, 6) << "inputA_I[group_offset+idx+" << + // i << "] = prevValue[idx+" << i << "].y;" << std::endl; + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(inputA_R - batch_offset*" << smaller_dim * bigger_dim + << ", inputA_I - batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i + << ", post_userdata, prevValue[idx+" << i + << "].x, prevValue[idx+" << i << "].y);" << std::endl; + } else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(inputA_R - batch_offset*" << smaller_dim * bigger_dim + << ", inputA_I - batch_offset*" << smaller_dim * bigger_dim + << ", batch_offset*" << smaller_dim * bigger_dim + << "+group_offset+idx+" << i + << ", post_userdata, prevValue[idx+" << i + << "].x, prevValue[idx+" << i << "].y);" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; } - break; + } else { + if (i + 256 < LDS_per_WG) { + clKernWrite(transKernel, 6) + << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].y;" << std::endl; + } else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_R[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].x;" << std::endl; + clKernWrite(transKernel, 6) + << "inputA_I[group_offset+idx+" << i << "] = prevValue[idx+" + << i << "].y;" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + } + } } - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + } + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + clKernWrite(transKernel, 6) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + + clKernWrite(transKernel, 3) << std::endl; + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: { + for (size_t i = 0; i < LDS_per_WG; i = i + 256) { + if (i + 256 < LDS_per_WG) + clKernWrite(transKernel, 6) + << "prevValue[idx+" << i << "] = nextValue[idx+" << i << "];" + << std::endl; + else { + // need to handle boundary + clKernWrite(transKernel, 6) + << "if(idx+" << i << "<" << LDS_per_WG << "){" << std::endl; + clKernWrite(transKernel, 9) + << "prevValue[idx + " << i << "] = nextValue[idx + " << i << "]; " + << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; } + } + break; + } + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } - clKernWrite(transKernel, 6) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + clKernWrite(transKernel, 6) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - clKernWrite(transKernel, 3) << std::endl; - clKernWrite(transKernel, 3) << "prev = next;" << std::endl; - if (WG_per_line == 1) - clKernWrite(transKernel, 3) << "}while(next!=swap_table[group_id][0]);" << std::endl;//end of do-while - else - clKernWrite(transKernel, 3) << "}while(next!=swap_table[group_id/"<< WG_per_line <<"][0]);" << std::endl;//end of do-while - clKernWrite(transKernel, 0) << "}" << std::endl;//end of kernel + clKernWrite(transKernel, 3) << std::endl; + clKernWrite(transKernel, 3) << "prev = next;" << std::endl; + if (WG_per_line == 1) + clKernWrite(transKernel, 3) << "}while(next!=swap_table[group_id][0]);" + << std::endl; // end of do-while + else + clKernWrite(transKernel, 3) + << "}while(next!=swap_table[group_id/" << WG_per_line << "][0]);" + << std::endl; // end of do-while + clKernWrite(transKernel, 0) << "}" << std::endl; // end of kernel - if (!twiddleSwapKernel) - break; // break for bothDir only need one kernel if twiddle is not done here + if (!twiddleSwapKernel) + break; // break for bothDir only need one kernel if twiddle is not done + // here - }//end of for (size_t bothDir = 0; bothDir < 2; bothDir++) - + } // end of for (size_t bothDir = 0; bothDir < 2; bothDir++) - //by now the kernel string is generated - strKernel = transKernel.str(); - return CLFFT_SUCCESS; + // by now the kernel string is generated + strKernel = transKernel.str(); + return CLFFT_SUCCESS; } -//generate transepose kernel with sqaure 2d matrix of row major with arbitrary batch size +// generate transepose kernel with sqaure 2d matrix of row major with arbitrary +// batch size /* -Below is a matrix(row major) containing three sqaure sub matrix along column +Below is a matrix(row major) containing three sqaure sub matrix along column The transpose will be done within each sub matrix. [M0 M1 M2] */ -clfftStatus genTransposeKernelBatched(const FFTGeneratedTransposeSquareAction::Signature & params, std::string& strKernel, const size_t& lwSize, const size_t reShapeFactor) -{ - strKernel.reserve(4096); - std::stringstream transKernel(std::stringstream::out); - - // These strings represent the various data types we read or write in the kernel, depending on how the plan - // is configured - std::string dtInput; // The type read as input into kernel - std::string dtOutput; // The type written as output from kernel - std::string dtPlanar; // Fundamental type for planar arrays - std::string dtComplex; // Fundamental type for complex arrays - - // NOTE: Enable only for debug - // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl; - - //if (params.fft_inputLayout != params.fft_outputLayout) - // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - switch (params.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - dtPlanar = "float"; - dtComplex = "float2"; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - dtPlanar = "double"; - dtComplex = "double2"; - - // Emit code that enables double precision in the kernel - clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#else" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#endif\n" << std::endl; - - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - break; - } - - // it is a better idea to do twiddle in swap kernel if we will have a swap kernel. - // for pure square transpose, twiddle will be done in transpose kernel - bool twiddleTransposeKernel = params.fft_3StepTwiddle && (params.transposeMiniBatchSize == 1);//when transposeMiniBatchSize == 1 it is guaranteed to be a sqaure matrix transpose - // If twiddle computation has been requested, generate the lookup function - - if (twiddleTransposeKernel) - { - std::string str; - StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * params.fft_N[1]); - if ((params.fft_precision == CLFFT_SINGLE) || (params.fft_precision == CLFFT_SINGLE_FAST)) - twLarge.GenerateTwiddleTable(str); - else - twLarge.GenerateTwiddleTable(str); - clKernWrite(transKernel, 0) << str << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - - - // This detects whether the input matrix is square - bool notSquare = (params.fft_N[0] == params.fft_N[1]) ? false : true; - - if (notSquare && (params.fft_placeness == CLFFT_INPLACE)) - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - // This detects whether the input matrix is a multiple of 16*reshapefactor or not - - bool mult_of_16 = (params.fft_N[0] % (reShapeFactor * 16) == 0) ? true : false; - - - - for (size_t bothDir = 0; bothDir < 2; bothDir++) - { - bool fwd = bothDir ? false : true; - - //If pre-callback is set for the plan - if (params.fft_hasPreCallback) - { - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_preCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - //If post-callback is set for the plan - if (params.fft_hasPostCallback) - { - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_postCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - std::string funcName; - if (twiddleTransposeKernel) // it makes more sense to do twiddling in swap kernel - funcName = fwd ? "transpose_square_tw_fwd" : "transpose_square_tw_back"; - else - funcName = "transpose_square"; - - - // Generate kernel API - genTransposePrototype(params, lwSize, dtPlanar, dtComplex, funcName, transKernel, dtInput, dtOutput); - size_t wgPerBatch; - if (mult_of_16) - wgPerBatch = (params.fft_N[0] / 16 / reShapeFactor)*(params.fft_N[0] / 16 / reShapeFactor + 1) / 2; - else - wgPerBatch = (params.fft_N[0] / (16 * reShapeFactor) + 1)*(params.fft_N[0] / (16 * reShapeFactor) + 1 + 1) / 2; - clKernWrite(transKernel, 3) << "const size_t numGroupsY_1 = " << wgPerBatch << ";" << std::endl; - - for (size_t i = 2; i < params.fft_DataDim - 1; i++) - { - clKernWrite(transKernel, 3) << "const size_t numGroupsY_" << i << " = numGroupsY_" << i - 1 << " * " << params.fft_N[i] << ";" << std::endl; - } - - clKernWrite(transKernel, 3) << "size_t g_index;" << std::endl; - clKernWrite(transKernel, 3) << std::endl; - - OffsetCalc(transKernel, params, true); - - - if (params.fft_placeness == CLFFT_OUTOFPLACE) - OffsetCalc(transKernel, params, false); - - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - //Do not advance offset when precallback is set as the starting address of global buffer is needed - if (!params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "inputA += iOffset;" << std::endl; // Set A ptr to the start of each slice - } - break; - case CLFFT_COMPLEX_PLANAR: - //Do not advance offset when precallback is set as the starting address of global buffer is needed - if (!params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "inputA_R += iOffset;" << std::endl; // Set A ptr to the start of each slice - clKernWrite(transKernel, 3) << "inputA_I += iOffset;" << std::endl; // Set A ptr to the start of each slice - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - if (params.fft_placeness == CLFFT_OUTOFPLACE) - { - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 3) << "outputA += oOffset;" << std::endl; // Set A ptr to the start of each slice - - break; - case CLFFT_COMPLEX_PLANAR: - - clKernWrite(transKernel, 3) << "outputA_R += oOffset;" << std::endl; // Set A ptr to the start of each slice - clKernWrite(transKernel, 3) << "outputA_I += oOffset;" << std::endl; // Set A ptr to the start of each slice - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - } - else - { - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPreCallback) - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA = inputA + iOffset;" << std::endl; - else - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA = inputA;" << std::endl; - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_R = inputA_R + iOffset;" << std::endl; - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_I = inputA_I + iOffset;" << std::endl; - } - else - { - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_R = inputA_R;" << std::endl; - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_I = inputA_I;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - } - - - clKernWrite(transKernel, 3) << std::endl; - - - // Now compute the corresponding y,x coordinates - // for a triangular indexing - if (mult_of_16) - clKernWrite(transKernel, 3) << "float row = (" << -2.0f*params.fft_N[0] / 16 / reShapeFactor - 1 << "+sqrt((" << 4.0f*params.fft_N[0] / 16 / reShapeFactor*(params.fft_N[0] / 16 / reShapeFactor + 1) << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; - else - clKernWrite(transKernel, 3) << "float row = (" << -2.0f*(params.fft_N[0] / (16 * reShapeFactor) + 1) - 1 << "+sqrt((" << 4.0f*(params.fft_N[0] / (16 * reShapeFactor) + 1)*(params.fft_N[0] / (16 * reShapeFactor) + 1 + 1) << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; - - - clKernWrite(transKernel, 3) << "if (row == (float)(size_t)row) row -= 1; " << std::endl; - clKernWrite(transKernel, 3) << "const size_t t_gy = (size_t)row;" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - if (mult_of_16) - clKernWrite(transKernel, 3) << "const long t_gx_p = g_index - " << (params.fft_N[0] / 16 / reShapeFactor) << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; - else - clKernWrite(transKernel, 3) << "const long t_gx_p = g_index - " << (params.fft_N[0] / (16 * reShapeFactor) + 1) << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; - - clKernWrite(transKernel, 3) << "const long t_gy_p = t_gx_p - t_gy;" << std::endl; - - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t d_lidx = get_local_id(0) % 16;" << std::endl; - clKernWrite(transKernel, 3) << "const size_t d_lidy = get_local_id(0) / 16;" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t lidy = (d_lidy * 16 + d_lidx) /" << (16 * reShapeFactor) << ";" << std::endl; - clKernWrite(transKernel, 3) << "const size_t lidx = (d_lidy * 16 + d_lidx) %" << (16 * reShapeFactor) << ";" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t idx = lidx + t_gx_p*" << 16 * reShapeFactor << ";" << std::endl; - clKernWrite(transKernel, 3) << "const size_t idy = lidy + t_gy_p*" << 16 * reShapeFactor << ";" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t starting_index_yx = t_gy_p*" << 16 * reShapeFactor << " + t_gx_p*" << 16 * reShapeFactor*params.fft_N[0] << ";" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "__local " << dtComplex << " xy_s[" << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; - clKernWrite(transKernel, 3) << "__local " << dtComplex << " yx_s[" << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; - - clKernWrite(transKernel, 3) << dtComplex << " tmpm, tmpt;" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - // Step 1: Load both blocks into local memory - // Here I load inputA for both blocks contiguously and write it contigously into - // the corresponding shared memories. - // Afterwards I use non-contiguous access from local memory and write contiguously - // back into the arrays - - if (mult_of_16) { - clKernWrite(transKernel, 3) << "size_t index;" << std::endl; - clKernWrite(transKernel, 3) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 6) << "index = lidy*" << 16 * reShapeFactor << " + lidx + loop*256;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - { - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "tmpm = inputA[(idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = inputA[(lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - } - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "tmpm.x = inputA_R[(idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 6) << "tmpm.y = inputA_I[(idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - - clKernWrite(transKernel, 6) << "tmpt.x = inputA_R[(lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - clKernWrite(transKernel, 6) << "tmpt.y = inputA_I[(lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - // it makes more sense to do twiddling in swap kernel - // If requested, generate the Twiddle math to multiply constant values - if (twiddleTransposeKernel) - genTwiddleMath(params, transKernel, dtComplex, fwd); - - clKernWrite(transKernel, 6) << "xy_s[index] = tmpm; " << std::endl; - clKernWrite(transKernel, 6) << "yx_s[index] = tmpt; " << std::endl; - - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - - // Step2: Write from shared to global - clKernWrite(transKernel, 3) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 6) << "index = lidx*" << 16 * reShapeFactor << " + lidy + " << 16 / reShapeFactor << "*loop;" << std::endl; - - - // Handle planar and interleaved right here - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPostCallback) - { - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - else - { - //assume tranpose is only two dimensional for now - //size_t actualBatchSize = params.transposeBatchSize / params.transposeMiniBatchSize; - size_t blockOffset = params.fft_inStride[2]; - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA-" << blockOffset <<"*((get_group_id(0)/numGroupsY_1)%"<< params.transposeMiniBatchSize <<"), ((idy + loop*" << 16 / reShapeFactor << ")*" - << params.fft_N[0] << " + idx + "<< blockOffset <<"*( (get_group_id(0)/numGroupsY_1 )%" << params.transposeMiniBatchSize <<") " << "), post_userdata, yx_s[index]"; - } - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - if (params.transposeMiniBatchSize < 2) - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - else - { - size_t blockOffset = params.fft_inStride[2]; - //clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA-iOffset, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx +iOffset), post_userdata, xy_s[index]"; - //clKernWrite(transKernel, 0) << std::endl; - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA-" << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << "), ((lidy + loop*" << 16 / reShapeFactor << ")*" - << params.fft_N[0] << " + lidx + starting_index_yx + " << blockOffset << "*( (get_group_id(0)/numGroupsY_1 )%" << params.transposeMiniBatchSize << ") " << "), post_userdata, xy_s[index]"; - } - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; - clKernWrite(transKernel, 6) << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPostCallback) - { - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - else - { - size_t blockOffset = params.fft_inStride[2]; - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA_R - "<< blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << - "), outputA_I -" << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << - "), ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx +"<< blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << - ")), post_userdata, yx_s[index].x, yx_s[index].y"; - } - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - else - { - size_t blockOffset = params.fft_inStride[2]; - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA_R - " << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << - "), outputA_I -" << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << - "), ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx +" << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" << params.transposeMiniBatchSize << - ")), post_userdata, xy_s[index].x, xy_s[index].y"; - } - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; - clKernWrite(transKernel, 6) << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; - - clKernWrite(transKernel, 6) << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index].x;" << std::endl; - clKernWrite(transKernel, 6) << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index].y;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - - clKernWrite(transKernel, 3) << "}" << std::endl; - - } - else {//mult_of_16 - - clKernWrite(transKernel, 3) << "size_t index;" << std::endl; - clKernWrite(transKernel, 3) << "if (" << params.fft_N[0] << " - (t_gx_p + 1) *" << 16 * reShapeFactor << ">0){" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor << " + lidx + loop*256;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 9) << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 9) << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 9) << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - - clKernWrite(transKernel, 9) << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - clKernWrite(transKernel, 9) << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - // it makes more sense to do twiddling in swap kernel - // If requested, generate the Twiddle math to multiply constant values - if (twiddleTransposeKernel) - genTwiddleMath(params, transKernel, dtComplex, fwd); - - clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; - clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "else{" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor << " + lidx + loop*256;" << std::endl; - - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << "&& idx<" << params.fft_N[0] << ")" << std::endl; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") " << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") " << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 12) << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") " << std::endl; - clKernWrite(transKernel, 12) << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << "&& idx<" << params.fft_N[0] << ") {" << std::endl; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem); }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") {" << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem); }" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata); }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") {" << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata); }" << std::endl; - } - } - else - { - clKernWrite(transKernel, 12) << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 12) << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx]; }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") {" << std::endl; - clKernWrite(transKernel, 12) << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - clKernWrite(transKernel, 12) << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx]; }" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - // If requested, generate the Twiddle math to multiply constant values - if (twiddleTransposeKernel) - genTwiddleMath(params, transKernel, dtComplex, fwd); - - clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; - clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; - - clKernWrite(transKernel, 9) << "}" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - clKernWrite(transKernel, 3) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - clKernWrite(transKernel, 3) << "" << std::endl; - - // Step2: Write from shared to global - - clKernWrite(transKernel, 3) << "if (" << params.fft_N[0] << " - (t_gx_p + 1) *" << 16 * reShapeFactor << ">0){" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 9) << "index = lidx*" << 16 * reShapeFactor << " + lidy + " << 16 / reShapeFactor << "*loop ;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPostCallback) - { - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - else - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA - iOffset, iOffset + ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - else - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA - iOffset, iOffset + ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; - clKernWrite(transKernel, 9) << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index]; " << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPostCallback) - { - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - else - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - else - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; - clKernWrite(transKernel, 9) << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; - clKernWrite(transKernel, 9) << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].x; " << std::endl; - clKernWrite(transKernel, 9) << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].y; " << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - clKernWrite(transKernel, 6) << "}" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "else{" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - - clKernWrite(transKernel, 9) << "index = lidx*" << 16 * reShapeFactor << " + lidy + " << 16 / reShapeFactor << "*loop;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << " && idx<" << params.fft_N[0] << ")" << std::endl; - if (params.fft_hasPostCallback) - { - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - else - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA - iOffset, iOffset + ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ")" << std::endl; - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - else - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA - iOffset, iOffset + ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index]; " << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ")" << std::endl; - clKernWrite(transKernel, 12) << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << " && idx<" << params.fft_N[0] << ") {" << std::endl; - - if (params.fft_hasPostCallback) - { - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - { - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - } - else - { - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - } - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << "); }" << std::endl; - - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") {" << std::endl; - if (params.transposeMiniBatchSize < 2)//which means the matrix was not broken down into sub square matrics - { - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - } - else - { - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - } - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << "); }" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].x; " << std::endl; - clKernWrite(transKernel, 12) << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].y; }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << params.fft_N[0] << ") {" << std::endl; - clKernWrite(transKernel, 12) << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].x;" << std::endl; - clKernWrite(transKernel, 12) << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].y; }" << std::endl; - } - - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - clKernWrite(transKernel, 6) << "}" << std::endl; // end for - clKernWrite(transKernel, 3) << "}" << std::endl; // end else - - - } - clKernWrite(transKernel, 0) << "}" << std::endl; - - strKernel = transKernel.str(); - - - if (!twiddleTransposeKernel) - break; // break for bothDir - } - - return CLFFT_SUCCESS; +clfftStatus genTransposeKernelBatched( + const FFTGeneratedTransposeSquareAction::Signature ¶ms, + std::string &strKernel, const size_t &lwSize, const size_t reShapeFactor) { + strKernel.reserve(4096); + std::stringstream transKernel(std::stringstream::out); + + // These strings represent the various data types we read or write in the + // kernel, depending on how the plan is configured + std::string dtInput; // The type read as input into kernel + std::string dtOutput; // The type written as output from kernel + std::string dtPlanar; // Fundamental type for planar arrays + std::string dtComplex; // Fundamental type for complex arrays + + // NOTE: Enable only for debug + // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : + // enable\n" << std::endl; + + // if (params.fft_inputLayout != params.fft_outputLayout) + // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + dtPlanar = "float"; + dtComplex = "float2"; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + dtPlanar = "double"; + dtComplex = "double2"; + + // Emit code that enables double precision in the kernel + clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#else" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#endif\n" << std::endl; + + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + break; + } + + // it is a better idea to do twiddle in swap kernel if we will have a swap + // kernel. for pure square transpose, twiddle will be done in transpose + // kernel + bool twiddleTransposeKernel = + params.fft_3StepTwiddle && + (params.transposeMiniBatchSize == + 1); // when transposeMiniBatchSize == 1 it is guaranteed to be a sqaure + // matrix transpose + // If twiddle computation has been requested, generate the lookup function + + if (twiddleTransposeKernel) { + std::string str; + StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * + params.fft_N[1]); + if ((params.fft_precision == CLFFT_SINGLE) || + (params.fft_precision == CLFFT_SINGLE_FAST)) + twLarge.GenerateTwiddleTable(str); + else + twLarge.GenerateTwiddleTable(str); + clKernWrite(transKernel, 0) << str << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + // This detects whether the input matrix is square + bool notSquare = (params.fft_N[0] == params.fft_N[1]) ? false : true; + + if (notSquare && (params.fft_placeness == CLFFT_INPLACE)) + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + // This detects whether the input matrix is a multiple of 16*reshapefactor or + // not + + bool mult_of_16 = + (params.fft_N[0] % (reShapeFactor * 16) == 0) ? true : false; + + for (size_t bothDir = 0; bothDir < 2; bothDir++) { + bool fwd = bothDir ? false : true; + + // If pre-callback is set for the plan + if (params.fft_hasPreCallback) { + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_preCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + // If post-callback is set for the plan + if (params.fft_hasPostCallback) { + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_postCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + std::string funcName; + if (twiddleTransposeKernel) // it makes more sense to do twiddling in swap + // kernel + funcName = fwd ? "transpose_square_tw_fwd" : "transpose_square_tw_back"; + else + funcName = "transpose_square"; + + // Generate kernel API + genTransposePrototype(params, lwSize, dtPlanar, dtComplex, funcName, + transKernel, dtInput, dtOutput); + size_t wgPerBatch; + if (mult_of_16) + wgPerBatch = (params.fft_N[0] / 16 / reShapeFactor) * + (params.fft_N[0] / 16 / reShapeFactor + 1) / 2; + else + wgPerBatch = (params.fft_N[0] / (16 * reShapeFactor) + 1) * + (params.fft_N[0] / (16 * reShapeFactor) + 1 + 1) / 2; + clKernWrite(transKernel, 3) + << "const size_t numGroupsY_1 = " << wgPerBatch << ";" << std::endl; + + for (size_t i = 2; i < params.fft_DataDim - 1; i++) { + clKernWrite(transKernel, 3) + << "const size_t numGroupsY_" << i << " = numGroupsY_" << i - 1 + << " * " << params.fft_N[i] << ";" << std::endl; + } + + clKernWrite(transKernel, 3) << "size_t g_index;" << std::endl; + clKernWrite(transKernel, 3) << std::endl; + + OffsetCalc(transKernel, params, true); + + if (params.fft_placeness == CLFFT_OUTOFPLACE) + OffsetCalc(transKernel, params, false); + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + // Do not advance offset when precallback is set as the starting address + // of global buffer is needed + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "inputA += iOffset;" + << std::endl; // Set A ptr to the start of each slice + } + break; + case CLFFT_COMPLEX_PLANAR: + // Do not advance offset when precallback is set as the starting address + // of global buffer is needed + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "inputA_R += iOffset;" + << std::endl; // Set A ptr to the start of each slice + clKernWrite(transKernel, 3) + << "inputA_I += iOffset;" + << std::endl; // Set A ptr to the start of each slice + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_placeness == CLFFT_OUTOFPLACE) { + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 3) + << "outputA += oOffset;" + << std::endl; // Set A ptr to the start of each slice + + break; + case CLFFT_COMPLEX_PLANAR: + + clKernWrite(transKernel, 3) + << "outputA_R += oOffset;" + << std::endl; // Set A ptr to the start of each slice + clKernWrite(transKernel, 3) + << "outputA_I += oOffset;" + << std::endl; // Set A ptr to the start of each slice + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + } else { + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPreCallback) + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA = inputA + iOffset;" + << std::endl; + else + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA = inputA;" << std::endl; + break; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_R = inputA_R + iOffset;" + << std::endl; + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_I = inputA_I + iOffset;" + << std::endl; + } else { + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_R = inputA_R;" << std::endl; + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_I = inputA_I;" << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + } + + clKernWrite(transKernel, 3) << std::endl; + + // Now compute the corresponding y,x coordinates + // for a triangular indexing + if (mult_of_16) + clKernWrite(transKernel, 3) + << "float row = (" << -2.0f * params.fft_N[0] / 16 / reShapeFactor - 1 + << "+sqrt((" + << 4.0f * params.fft_N[0] / 16 / reShapeFactor * + (params.fft_N[0] / 16 / reShapeFactor + 1) + << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; + else + clKernWrite(transKernel, 3) + << "float row = (" + << -2.0f * (params.fft_N[0] / (16 * reShapeFactor) + 1) - 1 + << "+sqrt((" + << 4.0f * (params.fft_N[0] / (16 * reShapeFactor) + 1) * + (params.fft_N[0] / (16 * reShapeFactor) + 1 + 1) + << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; + + clKernWrite(transKernel, 3) + << "if (row == (float)(size_t)row) row -= 1; " << std::endl; + clKernWrite(transKernel, 3) + << "const size_t t_gy = (size_t)row;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + if (mult_of_16) + clKernWrite(transKernel, 3) + << "const long t_gx_p = g_index - " + << (params.fft_N[0] / 16 / reShapeFactor) + << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; + else + clKernWrite(transKernel, 3) + << "const long t_gx_p = g_index - " + << (params.fft_N[0] / (16 * reShapeFactor) + 1) + << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; + + clKernWrite(transKernel, 3) + << "const long t_gy_p = t_gx_p - t_gy;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t d_lidx = get_local_id(0) % 16;" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t d_lidy = get_local_id(0) / 16;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t lidy = (d_lidy * 16 + d_lidx) /" + << (16 * reShapeFactor) << ";" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t lidx = (d_lidy * 16 + d_lidx) %" + << (16 * reShapeFactor) << ";" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) << "const size_t idx = lidx + t_gx_p*" + << 16 * reShapeFactor << ";" << std::endl; + clKernWrite(transKernel, 3) << "const size_t idy = lidy + t_gy_p*" + << 16 * reShapeFactor << ";" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t starting_index_yx = t_gy_p*" << 16 * reShapeFactor + << " + t_gx_p*" << 16 * reShapeFactor * params.fft_N[0] << ";" + << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "__local " << dtComplex << " xy_s[" + << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; + clKernWrite(transKernel, 3) + << "__local " << dtComplex << " yx_s[" + << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; + + clKernWrite(transKernel, 3) << dtComplex << " tmpm, tmpt;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + // Step 1: Load both blocks into local memory + // Here I load inputA for both blocks contiguously and write it contigously + // into the corresponding shared memories. Afterwards I use non-contiguous + // access from local memory and write contiguously back into the arrays + + if (mult_of_16) { + clKernWrite(transKernel, 3) << "size_t index;" << std::endl; + clKernWrite(transKernel, 3) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 6) << "index = lidy*" << 16 * reShapeFactor + << " + lidx + loop*256;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" + << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata);" + << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "tmpm = inputA[(idy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = inputA[(lidy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + } break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata, localmem);" << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata);" << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "tmpm.x = inputA_R[(idy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 6) + << "tmpm.y = inputA_I[(idy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + + clKernWrite(transKernel, 6) + << "tmpt.x = inputA_R[(lidy + loop *" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + clKernWrite(transKernel, 6) + << "tmpt.y = inputA_I[(lidy + loop *" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // it makes more sense to do twiddling in swap kernel + // If requested, generate the Twiddle math to multiply constant values + if (twiddleTransposeKernel) + genTwiddleMath(params, transKernel, dtComplex, fwd); + + clKernWrite(transKernel, 6) << "xy_s[index] = tmpm; " << std::endl; + clKernWrite(transKernel, 6) << "yx_s[index] = tmpt; " << std::endl; + + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + // Step2: Write from shared to global + clKernWrite(transKernel, 3) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 6) + << "index = lidx*" << 16 * reShapeFactor << " + lidy + " + << 16 / reShapeFactor << "*loop;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPostCallback) { + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + else { + // assume tranpose is only two dimensional for now + // size_t actualBatchSize = params.transposeBatchSize / + // params.transposeMiniBatchSize; + size_t blockOffset = params.fft_inStride[2]; + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA-" + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize << "), ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx + " + << blockOffset << "*( (get_group_id(0)/numGroupsY_1 )%" + << params.transposeMiniBatchSize << ") " + << "), post_userdata, yx_s[index]"; + } + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + if (params.transposeMiniBatchSize < 2) + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + else { + size_t blockOffset = params.fft_inStride[2]; + // clKernWrite(transKernel, 6) << params.fft_postCallback.funcname + // << "(outputA-iOffset, ((lidy + loop*" << 16 / reShapeFactor << + // ")*" << params.fft_N[0] << " + lidx + starting_index_yx +iOffset), + // post_userdata, xy_s[index]"; clKernWrite(transKernel, 0) << + // std::endl; + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA-" + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize << "), ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx + " << blockOffset + << "*( (get_group_id(0)/numGroupsY_1 )%" + << params.transposeMiniBatchSize << ") " + << "), post_userdata, xy_s[index]"; + } + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 6) + << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; + clKernWrite(transKernel, 6) + << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index];" + << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPostCallback) { + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + else { + size_t blockOffset = params.fft_inStride[2]; + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA_R - " + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize << "), outputA_I -" + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize << "), ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx +" + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize + << ")), post_userdata, yx_s[index].x, yx_s[index].y"; + } + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx+ starting_index_yx), post_userdata, xy_s[index].x, " + "xy_s[index].y"; + else { + size_t blockOffset = params.fft_inStride[2]; + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA_R - " + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize << "), outputA_I -" + << blockOffset << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize << "), ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx+ starting_index_yx +" << blockOffset + << "*((get_group_id(0)/numGroupsY_1)%" + << params.transposeMiniBatchSize + << ")), post_userdata, xy_s[index].x, xy_s[index].y"; + } + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 6) + << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; + clKernWrite(transKernel, 6) + << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; + + clKernWrite(transKernel, 6) + << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx+ starting_index_yx] = xy_s[index].x;" << std::endl; + clKernWrite(transKernel, 6) + << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx+ starting_index_yx] = xy_s[index].y;" << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 3) << "}" << std::endl; + + } else { // mult_of_16 + + clKernWrite(transKernel, 3) << "size_t index;" << std::endl; + clKernWrite(transKernel, 3) + << "if (" << params.fft_N[0] << " - (t_gx_p + 1) *" + << 16 * reShapeFactor << ">0){" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor + << " + lidx + loop*256;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" + << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata);" + << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 9) + << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata, localmem);" << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata);" << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 9) + << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 9) + << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + + clKernWrite(transKernel, 9) + << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + clKernWrite(transKernel, 9) + << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // it makes more sense to do twiddling in swap kernel + // If requested, generate the Twiddle math to multiply constant values + if (twiddleTransposeKernel) + genTwiddleMath(params, transKernel, dtComplex, fwd); + + clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; + clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "else{" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor + << " + lidx + loop*256;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor + << ")<" << params.fft_N[0] << "&& idx<" + << params.fft_N[0] << ")" << std::endl; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" + << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") " << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata);" + << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") " << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 12) + << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") " << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor + << ")<" << params.fft_N[0] << "&& idx<" + << params.fft_N[0] << ") {" << std::endl; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata, localmem); }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem); }" + << std::endl; + } else { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata); }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata); }" << std::endl; + } + } else { + clKernWrite(transKernel, 12) + << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 12) + << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx]; }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + clKernWrite(transKernel, 12) + << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx]; }" + << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // If requested, generate the Twiddle math to multiply constant values + if (twiddleTransposeKernel) + genTwiddleMath(params, transKernel, dtComplex, fwd); + + clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; + clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; + + clKernWrite(transKernel, 9) << "}" << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + clKernWrite(transKernel, 3) + << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + clKernWrite(transKernel, 3) << "" << std::endl; + + // Step2: Write from shared to global + + clKernWrite(transKernel, 3) + << "if (" << params.fft_N[0] << " - (t_gx_p + 1) *" + << 16 * reShapeFactor << ">0){" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 9) + << "index = lidx*" << 16 * reShapeFactor << " + lidy + " + << 16 / reShapeFactor << "*loop ;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPostCallback) { + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + else + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA - iOffset, iOffset + ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + else + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA - iOffset, iOffset + ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; + clKernWrite(transKernel, 9) + << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index]; " << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPostCallback) { + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + else + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((idy + " + "loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, " + "xy_s[index].x, xy_s[index].y"; + else + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((lidy + " + "loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, " + "xy_s[index].x, xy_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; + clKernWrite(transKernel, 9) + << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; + clKernWrite(transKernel, 9) + << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].x; " << std::endl; + clKernWrite(transKernel, 9) + << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].y; " << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 6) << "}" << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "else{" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + + clKernWrite(transKernel, 9) + << "index = lidx*" << 16 * reShapeFactor << " + lidy + " + << 16 / reShapeFactor << "*loop;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor + << ")<" << params.fft_N[0] << " && idx<" + << params.fft_N[0] << ")" << std::endl; + if (params.fft_hasPostCallback) { + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + else + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA - iOffset, iOffset + ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ")" << std::endl; + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + else + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA - iOffset, iOffset + ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 12) + << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index]; " << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ")" << std::endl; + clKernWrite(transKernel, 12) + << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index];" << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor + << ")<" << params.fft_N[0] << " && idx<" + << params.fft_N[0] << ") {" << std::endl; + + if (params.fft_hasPostCallback) { + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + { + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + } else { + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((idy + " + "loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + } + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << "); }" << std::endl; + + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") {" << std::endl; + if (params.transposeMiniBatchSize < + 2) // which means the matrix was not broken down into sub square + // matrics + { + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, " + "xy_s[index].x, xy_s[index].y"; + } else { + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA_R-iOffset, outputA_I-iOffset, iOffset+((lidy + " + "loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, " + "xy_s[index].x, xy_s[index].y"; + } + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << "); }" << std::endl; + } else { + clKernWrite(transKernel, 12) + << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].x; " << std::endl; + clKernWrite(transKernel, 12) + << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].y; }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << params.fft_N[0] << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << params.fft_N[0] << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].x;" << std::endl; + clKernWrite(transKernel, 12) + << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].y; }" << std::endl; + } + + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 6) << "}" << std::endl; // end for + clKernWrite(transKernel, 3) << "}" << std::endl; // end else + } + clKernWrite(transKernel, 0) << "}" << std::endl; + + strKernel = transKernel.str(); + + if (!twiddleTransposeKernel) + break; // break for bothDir + } + + return CLFFT_SUCCESS; } -//generate transpose kernel with square 2d matrix of row major with blocks along the leading dimension -//aka leading dimension batched +// generate transpose kernel with square 2d matrix of row major with blocks +// along the leading dimension aka leading dimension batched /* Below is a matrix(row major) contaning three square sub matrix along row [M0 M2 M2] */ -clfftStatus genTransposeKernelLeadingDimensionBatched(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, const size_t& lwSize, const size_t reShapeFactor) -{ - strKernel.reserve(4096); - std::stringstream transKernel(std::stringstream::out); - - // These strings represent the various data types we read or write in the kernel, depending on how the plan - // is configured - std::string dtInput; // The type read as input into kernel - std::string dtOutput; // The type written as output from kernel - std::string dtPlanar; // Fundamental type for planar arrays - std::string dtComplex; // Fundamental type for complex arrays - - // NOTE: Enable only for debug - // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl; - - //if (params.fft_inputLayout != params.fft_outputLayout) - // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - switch (params.fft_precision) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - dtPlanar = "float"; - dtComplex = "float2"; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - dtPlanar = "double"; - dtComplex = "double2"; - - // Emit code that enables double precision in the kernel - clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#else" << std::endl; - clKernWrite(transKernel, 3) << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; - clKernWrite(transKernel, 0) << "#endif\n" << std::endl; - - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - break; - } - - - // If twiddle computation has been requested, generate the lookup function - if (params.fft_3StepTwiddle) - { - std::string str; - StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * params.fft_N[1]); - if ((params.fft_precision == CLFFT_SINGLE) || (params.fft_precision == CLFFT_SINGLE_FAST)) - twLarge.GenerateTwiddleTable(str); - else - twLarge.GenerateTwiddleTable(str); - clKernWrite(transKernel, 0) << str << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - size_t smaller_dim = (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; - size_t bigger_dim = (params.fft_N[0] >= params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; - size_t dim_ratio = bigger_dim / smaller_dim; - - // This detects whether the input matrix is rectangle of ratio 1:2 - - if ((params.fft_N[0] != 2 * params.fft_N[1]) && (params.fft_N[1] != 2 * params.fft_N[0]) && - (params.fft_N[0] != 3 * params.fft_N[1]) && (params.fft_N[1] != 3 * params.fft_N[0]) && - (params.fft_N[0] != 5 * params.fft_N[1]) && (params.fft_N[1] != 5 * params.fft_N[0]) && - (params.fft_N[0] != 10 * params.fft_N[1]) && (params.fft_N[1] != 10 * params.fft_N[0])) - { +clfftStatus genTransposeKernelLeadingDimensionBatched( + const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + std::string &strKernel, const size_t &lwSize, const size_t reShapeFactor) { + strKernel.reserve(4096); + std::stringstream transKernel(std::stringstream::out); + + // These strings represent the various data types we read or write in the + // kernel, depending on how the plan is configured + std::string dtInput; // The type read as input into kernel + std::string dtOutput; // The type written as output from kernel + std::string dtPlanar; // Fundamental type for planar arrays + std::string dtComplex; // Fundamental type for complex arrays + + // NOTE: Enable only for debug + // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : + // enable\n" << std::endl; + + // if (params.fft_inputLayout != params.fft_outputLayout) + // return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + dtPlanar = "float"; + dtComplex = "float2"; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + dtPlanar = "double"; + dtComplex = "double2"; + + // Emit code that enables double precision in the kernel + clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#else" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#endif\n" << std::endl; + + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + break; + } + + // If twiddle computation has been requested, generate the lookup function + if (params.fft_3StepTwiddle) { + std::string str; + StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * + params.fft_N[1]); + if ((params.fft_precision == CLFFT_SINGLE) || + (params.fft_precision == CLFFT_SINGLE_FAST)) + twLarge.GenerateTwiddleTable(str); + else + twLarge.GenerateTwiddleTable(str); + clKernWrite(transKernel, 0) << str << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + size_t smaller_dim = + (params.fft_N[0] < params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; + size_t bigger_dim = + (params.fft_N[0] >= params.fft_N[1]) ? params.fft_N[0] : params.fft_N[1]; + size_t dim_ratio = bigger_dim / smaller_dim; + + // This detects whether the input matrix is rectangle of ratio 1:2 + + if ((params.fft_N[0] != 2 * params.fft_N[1]) && + (params.fft_N[1] != 2 * params.fft_N[0]) && + (params.fft_N[0] != 3 * params.fft_N[1]) && + (params.fft_N[1] != 3 * params.fft_N[0]) && + (params.fft_N[0] != 5 * params.fft_N[1]) && + (params.fft_N[1] != 5 * params.fft_N[0]) && + (params.fft_N[0] != 10 * params.fft_N[1]) && + (params.fft_N[1] != 10 * params.fft_N[0])) { + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_placeness == CLFFT_OUTOFPLACE) { + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // This detects whether the input matrix is a multiple of 16*reshapefactor or + // not + + bool mult_of_16 = (smaller_dim % (reShapeFactor * 16) == 0) ? true : false; + + for (size_t bothDir = 0; bothDir < 2; bothDir++) { + bool fwd = bothDir ? false : true; + + // If pre-callback is set for the plan + if (params.fft_hasPreCallback) { + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_preCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + // If post-callback is set for the plan + if (params.fft_hasPostCallback) { + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_postCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + std::string funcName; + if (params.fft_3StepTwiddle) // TODO + funcName = + fwd ? "transpose_nonsquare_tw_fwd" : "transpose_nonsquare_tw_back"; + else + funcName = "transpose_nonsquare"; + + // Generate kernel API + genTransposePrototypeLeadingDimensionBatched( + params, lwSize, dtPlanar, dtComplex, funcName, transKernel, dtInput, + dtOutput); + + if (mult_of_16) // number of WG per sub square block + clKernWrite(transKernel, 3) + << "const size_t numGroups_square_matrix_Y_1 = " + << (smaller_dim / 16 / reShapeFactor) * + (smaller_dim / 16 / reShapeFactor + 1) / 2 + << ";" << std::endl; + else + clKernWrite(transKernel, 3) + << "const size_t numGroups_square_matrix_Y_1 = " + << (smaller_dim / (16 * reShapeFactor) + 1) * + (smaller_dim / (16 * reShapeFactor) + 1 + 1) / 2 + << ";" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t numGroupsY_1 = numGroups_square_matrix_Y_1 * " + << dim_ratio << ";" << std::endl; + + for (size_t i = 2; i < params.fft_DataDim - 1; i++) { + clKernWrite(transKernel, 3) + << "const size_t numGroupsY_" << i << " = numGroupsY_" << i - 1 + << " * " << params.fft_N[i] << ";" << std::endl; + } + + clKernWrite(transKernel, 3) << "size_t g_index;" << std::endl; + clKernWrite(transKernel, 3) << "size_t square_matrix_index;" << std::endl; + clKernWrite(transKernel, 3) << "size_t square_matrix_offset;" << std::endl; + clKernWrite(transKernel, 3) << std::endl; + + OffsetCalcLeadingDimensionBatched(transKernel, params); + + clKernWrite(transKernel, 3) + << "square_matrix_index = (g_index / numGroups_square_matrix_Y_1) ;" + << std::endl; + clKernWrite(transKernel, 3) + << "g_index = g_index % numGroups_square_matrix_Y_1" + << ";" << std::endl; + clKernWrite(transKernel, 3) << std::endl; + + if (smaller_dim == params.fft_N[1]) { + clKernWrite(transKernel, 3) + << "square_matrix_offset = square_matrix_index * " << smaller_dim + << ";" << std::endl; + } else { + clKernWrite(transKernel, 3) + << "square_matrix_offset = square_matrix_index *" + << smaller_dim * smaller_dim << ";" << std::endl; + } + + clKernWrite(transKernel, 3) + << "iOffset += square_matrix_offset ;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: + // Do not advance offset when precallback is set as the starting address + // of global buffer is needed + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "inputA += iOffset;" + << std::endl; // Set A ptr to the start of each slice + } + break; + case CLFFT_COMPLEX_PLANAR: + // Do not advance offset when precallback is set as the starting address + // of global buffer is needed + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "inputA_R += iOffset;" + << std::endl; // Set A ptr to the start of each slice + clKernWrite(transKernel, 3) + << "inputA_I += iOffset;" + << std::endl; // Set A ptr to the start of each slice + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA = inputA + iOffset;" + << std::endl; + } else { + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA = inputA;" << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_R = inputA_R + iOffset;" + << std::endl; + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_I = inputA_I + iOffset;" + << std::endl; + } else { + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_R = inputA_R;" << std::endl; + clKernWrite(transKernel, 3) + << "global " << dtInput << " *outputA_I = inputA_I;" << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 3) << std::endl; + + // Now compute the corresponding y,x coordinates + // for a triangular indexing + if (mult_of_16) + clKernWrite(transKernel, 3) + << "float row = (" << -2.0f * smaller_dim / 16 / reShapeFactor - 1 + << "+sqrt((" + << 4.0f * smaller_dim / 16 / reShapeFactor * + (smaller_dim / 16 / reShapeFactor + 1) + << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; + else + clKernWrite(transKernel, 3) + << "float row = (" + << -2.0f * (smaller_dim / (16 * reShapeFactor) + 1) - 1 << "+sqrt((" + << 4.0f * (smaller_dim / (16 * reShapeFactor) + 1) * + (smaller_dim / (16 * reShapeFactor) + 1 + 1) + << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; + + clKernWrite(transKernel, 3) + << "if (row == (float)(int)row) row -= 1; " << std::endl; + clKernWrite(transKernel, 3) << "const size_t t_gy = (int)row;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + if (mult_of_16) + clKernWrite(transKernel, 3) + << "const long t_gx_p = g_index - " + << (smaller_dim / 16 / reShapeFactor) + << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; + else + clKernWrite(transKernel, 3) + << "const long t_gx_p = g_index - " + << (smaller_dim / (16 * reShapeFactor) + 1) + << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; + + clKernWrite(transKernel, 3) + << "const long t_gy_p = t_gx_p - t_gy;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t d_lidx = get_local_id(0) % 16;" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t d_lidy = get_local_id(0) / 16;" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t lidy = (d_lidy * 16 + d_lidx) /" + << (16 * reShapeFactor) << ";" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t lidx = (d_lidy * 16 + d_lidx) %" + << (16 * reShapeFactor) << ";" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) << "const size_t idx = lidx + t_gx_p*" + << 16 * reShapeFactor << ";" << std::endl; + clKernWrite(transKernel, 3) << "const size_t idy = lidy + t_gy_p*" + << 16 * reShapeFactor << ";" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "const size_t starting_index_yx = t_gy_p*" << 16 * reShapeFactor + << " + t_gx_p*" << 16 * reShapeFactor * params.fft_N[0] << ";" + << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + switch (params.fft_inputLayout) { + case CLFFT_REAL: + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 3) + << "__local " << dtInput << " xy_s[" + << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; + clKernWrite(transKernel, 3) + << "__local " << dtInput << " yx_s[" + << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; + + clKernWrite(transKernel, 3) << dtInput << " tmpm, tmpt;" << std::endl; + break; + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 3) + << "__local " << dtComplex << " xy_s[" + << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; + clKernWrite(transKernel, 3) + << "__local " << dtComplex << " yx_s[" + << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; + + clKernWrite(transKernel, 3) << dtComplex << " tmpm, tmpt;" << std::endl; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + clKernWrite(transKernel, 3) << "" << std::endl; + + // Step 1: Load both blocks into local memory + // Here I load inputA for both blocks contiguously and write it contigously + // into the corresponding shared memories. Afterwards I use non-contiguous + // access from local memory and write contiguously back into the arrays + + if (mult_of_16) { + clKernWrite(transKernel, 3) << "size_t index;" << std::endl; + clKernWrite(transKernel, 3) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 6) << "index = lidy*" << 16 * reShapeFactor + << " + lidx + loop*256;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: { + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" + << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata);" + << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "tmpm = inputA[(idy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = inputA[(lidy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + } break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata, localmem);" << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 6) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata);" << std::endl; + clKernWrite(transKernel, 6) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop *" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 6) + << "tmpm.x = inputA_R[(idy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 6) + << "tmpm.y = inputA_I[(idy + loop *" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + + clKernWrite(transKernel, 6) + << "tmpt.x = inputA_R[(lidy + loop *" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + clKernWrite(transKernel, 6) + << "tmpt.y = inputA_I[(lidy + loop *" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // If requested, generate the Twiddle math to multiply constant values + if (params.fft_3StepTwiddle) + genTwiddleMathLeadingDimensionBatched(params, transKernel, dtComplex, + fwd); + + clKernWrite(transKernel, 6) << "xy_s[index] = tmpm; " << std::endl; + clKernWrite(transKernel, 6) << "yx_s[index] = tmpt; " << std::endl; + + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + clKernWrite(transKernel, 3) + << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + + // Step2: Write from shared to global + clKernWrite(transKernel, 3) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 6) + << "index = lidx*" << 16 * reShapeFactor << " + lidy + " + << 16 / reShapeFactor << "*loop;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx+ starting_index_yx), post_userdata, xy_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 6) + << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; + clKernWrite(transKernel, 6) + << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index];" + << std::endl; + } + + break; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 6) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx+ starting_index_yx), post_userdata, xy_s[index].x, " + "xy_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 6) + << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; + clKernWrite(transKernel, 6) + << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; + + clKernWrite(transKernel, 6) + << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx+ starting_index_yx] = xy_s[index].x;" << std::endl; + clKernWrite(transKernel, 6) + << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx+ starting_index_yx] = xy_s[index].y;" << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 3) << "}" << std::endl; + + } else { + + clKernWrite(transKernel, 3) << "size_t index;" << std::endl; + clKernWrite(transKernel, 3) + << "if (" << smaller_dim << " - (t_gx_p + 1) *" << 16 * reShapeFactor + << ">0){" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor + << " + lidx + loop*256;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" + << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata);" + << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 9) + << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata, localmem);" << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata);" << std::endl; + clKernWrite(transKernel, 9) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 9) + << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 9) + << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + + clKernWrite(transKernel, 9) + << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + clKernWrite(transKernel, 9) + << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // If requested, generate the Twiddle math to multiply constant values + if (params.fft_3StepTwiddle) + genTwiddleMathLeadingDimensionBatched(params, transKernel, dtComplex, + fwd); + + clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; + clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; + clKernWrite(transKernel, 6) << "}" << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "else{" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor + << " + lidx + loop*256;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_REAL: + clKernWrite(transKernel, 9) + << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << "&& idx<" << smaller_dim << ")" << std::endl; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" + << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << smaller_dim << ") " << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] << " + idx, pre_userdata);" + << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << smaller_dim << ") " << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 12) + << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << ") " << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + dtOutput = dtPlanar; + clKernWrite(transKernel, 9) + << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << "&& idx<" << smaller_dim << ") {" << std::endl; + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata, localmem); }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << smaller_dim << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata, localmem); }" + << std::endl; + } else { + clKernWrite(transKernel, 12) + << "tmpm = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx, pre_userdata); }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" + << smaller_dim << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "tmpt = " << params.fft_preCallback.funcname + << "(inputA_R, inputA_I, iOffset + (lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx, pre_userdata); }" << std::endl; + } + } else { + clKernWrite(transKernel, 12) + << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx];" << std::endl; + clKernWrite(transKernel, 12) + << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx]; }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx];" + << std::endl; + clKernWrite(transKernel, 12) + << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + lidx + starting_index_yx]; }" + << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + // If requested, generate the Twiddle math to multiply constant values + if (params.fft_3StepTwiddle) + genTwiddleMathLeadingDimensionBatched(params, transKernel, dtComplex, + fwd); + + clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; + clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; + + clKernWrite(transKernel, 9) << "}" << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "" << std::endl; + clKernWrite(transKernel, 3) + << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; + clKernWrite(transKernel, 3) << "" << std::endl; + + // Step2: Write from shared to global + + clKernWrite(transKernel, 3) + << "if (" << smaller_dim << " - (t_gx_p + 1) *" << 16 * reShapeFactor + << ">0){" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + clKernWrite(transKernel, 9) + << "index = lidx*" << 16 * reShapeFactor << " + lidy + " + << 16 / reShapeFactor << "*loop ;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; + clKernWrite(transKernel, 9) + << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index]; " << std::endl; + } + + break; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, " + "xy_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; + clKernWrite(transKernel, 9) + << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; + clKernWrite(transKernel, 9) + << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].x; " << std::endl; + clKernWrite(transKernel, 9) + << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].y; " << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 6) << "}" << std::endl; + clKernWrite(transKernel, 3) << "}" << std::endl; + + clKernWrite(transKernel, 3) << "else{" << std::endl; + clKernWrite(transKernel, 6) + << "for (size_t loop = 0; loop<" << reShapeFactor * reShapeFactor + << "; ++loop){" << std::endl; + + clKernWrite(transKernel, 9) + << "index = lidx*" << 16 * reShapeFactor << " + lidy + " + << 16 / reShapeFactor << "*loop;" << std::endl; + + // Handle planar and interleaved right here + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + clKernWrite(transKernel, 9) + << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << " && idx<" << smaller_dim << ")" << std::endl; + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << ")" << std::endl; + + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" + << 16 / reShapeFactor << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 12) + << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index]; " << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << ")" << std::endl; + clKernWrite(transKernel, 12) + << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index];" << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 9) + << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << " && idx<" << smaller_dim << ") {" << std::endl; + + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << "); }" << std::endl; + + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << ") {" << std::endl; + + clKernWrite(transKernel, 12) + << params.fft_postCallback.funcname + << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor + << ")*" << params.fft_N[0] + << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, " + "xy_s[index].y"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << "); }" << std::endl; + } else { + clKernWrite(transKernel, 12) + << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].x; " << std::endl; + clKernWrite(transKernel, 12) + << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] << " + idx] = yx_s[index].y; }" << std::endl; + clKernWrite(transKernel, 9) + << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" + << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor + << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim + << ") {" << std::endl; + clKernWrite(transKernel, 12) + << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].x;" << std::endl; + clKernWrite(transKernel, 12) + << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" + << params.fft_N[0] + << " + lidx + starting_index_yx] = xy_s[index].y; }" << std::endl; + } + + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + break; + default: return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + clKernWrite(transKernel, 6) << "}" << std::endl; // end for + clKernWrite(transKernel, 3) << "}" << std::endl; // end else } + clKernWrite(transKernel, 0) << "}" << std::endl; - if (params.fft_placeness == CLFFT_OUTOFPLACE) - { - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - // This detects whether the input matrix is a multiple of 16*reshapefactor or not - - bool mult_of_16 = (smaller_dim % (reShapeFactor * 16) == 0) ? true : false; - - for (size_t bothDir = 0; bothDir < 2; bothDir++) - { - bool fwd = bothDir ? false : true; - - //If pre-callback is set for the plan - if (params.fft_hasPreCallback) - { - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_preCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - //If post-callback is set for the plan - if (params.fft_hasPostCallback) - { - //Insert callback function code at the beginning - clKernWrite(transKernel, 0) << params.fft_postCallback.funcstring << std::endl; - clKernWrite(transKernel, 0) << std::endl; - } - - std::string funcName; - if (params.fft_3StepTwiddle) // TODO - funcName = fwd ? "transpose_nonsquare_tw_fwd" : "transpose_nonsquare_tw_back"; - else - funcName = "transpose_nonsquare"; - - - // Generate kernel API - genTransposePrototypeLeadingDimensionBatched(params, lwSize, dtPlanar, dtComplex, funcName, transKernel, dtInput, dtOutput); - - if (mult_of_16)//number of WG per sub square block - clKernWrite(transKernel, 3) << "const size_t numGroups_square_matrix_Y_1 = " << (smaller_dim / 16 / reShapeFactor)*(smaller_dim / 16 / reShapeFactor + 1) / 2 << ";" << std::endl; - else - clKernWrite(transKernel, 3) << "const size_t numGroups_square_matrix_Y_1 = " << (smaller_dim / (16 * reShapeFactor) + 1)*(smaller_dim / (16 * reShapeFactor) + 1 + 1) / 2 << ";" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t numGroupsY_1 = numGroups_square_matrix_Y_1 * "<< dim_ratio <<";" << std::endl; - - for (size_t i = 2; i < params.fft_DataDim - 1; i++) - { - clKernWrite(transKernel, 3) << "const size_t numGroupsY_" << i << " = numGroupsY_" << i - 1 << " * " << params.fft_N[i] << ";" << std::endl; - } - - clKernWrite(transKernel, 3) << "size_t g_index;" << std::endl; - clKernWrite(transKernel, 3) << "size_t square_matrix_index;" << std::endl; - clKernWrite(transKernel, 3) << "size_t square_matrix_offset;" << std::endl; - clKernWrite(transKernel, 3) << std::endl; - - OffsetCalcLeadingDimensionBatched(transKernel, params); - - clKernWrite(transKernel, 3) << "square_matrix_index = (g_index / numGroups_square_matrix_Y_1) ;" << std::endl; - clKernWrite(transKernel, 3) << "g_index = g_index % numGroups_square_matrix_Y_1" << ";" << std::endl; - clKernWrite(transKernel, 3) << std::endl; - - if (smaller_dim == params.fft_N[1]) - { - clKernWrite(transKernel, 3) << "square_matrix_offset = square_matrix_index * " << smaller_dim << ";" << std::endl; - } - else - { - clKernWrite(transKernel, 3) << "square_matrix_offset = square_matrix_index *" << smaller_dim * smaller_dim << ";" << std::endl; - } - - clKernWrite(transKernel, 3) << "iOffset += square_matrix_offset ;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - //Do not advance offset when precallback is set as the starting address of global buffer is needed - if (!params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "inputA += iOffset;" << std::endl; // Set A ptr to the start of each slice - } - break; - case CLFFT_COMPLEX_PLANAR: - //Do not advance offset when precallback is set as the starting address of global buffer is needed - if (!params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "inputA_R += iOffset;" << std::endl; // Set A ptr to the start of each slice - clKernWrite(transKernel, 3) << "inputA_I += iOffset;" << std::endl; // Set A ptr to the start of each slice - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA = inputA + iOffset;" << std::endl; - } - else - { - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA = inputA;" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPreCallback) - { - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_R = inputA_R + iOffset;" << std::endl; - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_I = inputA_I + iOffset;" << std::endl; - } - else - { - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_R = inputA_R;" << std::endl; - clKernWrite(transKernel, 3) << "global " << dtInput << " *outputA_I = inputA_I;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - clKernWrite(transKernel, 3) << std::endl; - - // Now compute the corresponding y,x coordinates - // for a triangular indexing - if (mult_of_16) - clKernWrite(transKernel, 3) << "float row = (" << -2.0f*smaller_dim / 16 / reShapeFactor - 1 << "+sqrt((" << 4.0f*smaller_dim / 16 / reShapeFactor*(smaller_dim / 16 / reShapeFactor + 1) << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; - else - clKernWrite(transKernel, 3) << "float row = (" << -2.0f*(smaller_dim / (16 * reShapeFactor) + 1) - 1 << "+sqrt((" << 4.0f*(smaller_dim / (16 * reShapeFactor) + 1)*(smaller_dim / (16 * reShapeFactor) + 1 + 1) << "-8.0f*g_index- 7)))/ (-2.0f);" << std::endl; - - - clKernWrite(transKernel, 3) << "if (row == (float)(int)row) row -= 1; " << std::endl; - clKernWrite(transKernel, 3) << "const size_t t_gy = (int)row;" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - if (mult_of_16) - clKernWrite(transKernel, 3) << "const long t_gx_p = g_index - " << (smaller_dim / 16 / reShapeFactor) << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; - else - clKernWrite(transKernel, 3) << "const long t_gx_p = g_index - " << (smaller_dim / (16 * reShapeFactor) + 1) << "*t_gy + t_gy*(t_gy + 1) / 2;" << std::endl; - - clKernWrite(transKernel, 3) << "const long t_gy_p = t_gx_p - t_gy;" << std::endl; - - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t d_lidx = get_local_id(0) % 16;" << std::endl; - clKernWrite(transKernel, 3) << "const size_t d_lidy = get_local_id(0) / 16;" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t lidy = (d_lidy * 16 + d_lidx) /" << (16 * reShapeFactor) << ";" << std::endl; - clKernWrite(transKernel, 3) << "const size_t lidx = (d_lidy * 16 + d_lidx) %" << (16 * reShapeFactor) << ";" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t idx = lidx + t_gx_p*" << 16 * reShapeFactor << ";" << std::endl; - clKernWrite(transKernel, 3) << "const size_t idy = lidy + t_gy_p*" << 16 * reShapeFactor << ";" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "const size_t starting_index_yx = t_gy_p*" << 16 * reShapeFactor << " + t_gx_p*" << 16 * reShapeFactor*params.fft_N[0] << ";" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - switch (params.fft_inputLayout) - { - case CLFFT_REAL: - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 3) << "__local " << dtInput << " xy_s[" << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; - clKernWrite(transKernel, 3) << "__local " << dtInput << " yx_s[" << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; - - clKernWrite(transKernel, 3) << dtInput << " tmpm, tmpt;" << std::endl; - break; - case CLFFT_COMPLEX_PLANAR: - clKernWrite(transKernel, 3) << "__local " << dtComplex << " xy_s[" << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; - clKernWrite(transKernel, 3) << "__local " << dtComplex << " yx_s[" << 16 * reShapeFactor * 16 * reShapeFactor << "];" << std::endl; - - clKernWrite(transKernel, 3) << dtComplex << " tmpm, tmpt;" << std::endl; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - clKernWrite(transKernel, 3) << "" << std::endl; - - // Step 1: Load both blocks into local memory - // Here I load inputA for both blocks contiguously and write it contigously into - // the corresponding shared memories. - // Afterwards I use non-contiguous access from local memory and write contiguously - // back into the arrays - - if (mult_of_16) { - clKernWrite(transKernel, 3) << "size_t index;" << std::endl; - clKernWrite(transKernel, 3) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 6) << "index = lidy*" << 16 * reShapeFactor << " + lidx + loop*256;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - { - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop * " << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "tmpm = inputA[(idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = inputA[(lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - } - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 6) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 6) << "tmpm.x = inputA_R[(idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 6) << "tmpm.y = inputA_I[(idy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - - clKernWrite(transKernel, 6) << "tmpt.x = inputA_R[(lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - clKernWrite(transKernel, 6) << "tmpt.y = inputA_I[(lidy + loop *" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - // If requested, generate the Twiddle math to multiply constant values - if (params.fft_3StepTwiddle) - genTwiddleMathLeadingDimensionBatched(params, transKernel, dtComplex, fwd); - - clKernWrite(transKernel, 6) << "xy_s[index] = tmpm; " << std::endl; - clKernWrite(transKernel, 6) << "yx_s[index] = tmpt; " << std::endl; - - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - clKernWrite(transKernel, 3) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - - - // Step2: Write from shared to global - clKernWrite(transKernel, 3) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 6) << "index = lidx*" << 16 * reShapeFactor << " + lidy + " << 16 / reShapeFactor << "*loop;" << std::endl; - - - // Handle planar and interleaved right here - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx), post_userdata, xy_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; - clKernWrite(transKernel, 6) << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index];" << std::endl; - } - - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 6) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 6) << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; - clKernWrite(transKernel, 6) << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; - - clKernWrite(transKernel, 6) << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index].x;" << std::endl; - clKernWrite(transKernel, 6) << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx+ starting_index_yx] = xy_s[index].y;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - - clKernWrite(transKernel, 3) << "}" << std::endl; - - } - else { - - clKernWrite(transKernel, 3) << "size_t index;" << std::endl; - clKernWrite(transKernel, 3) << "if (" << smaller_dim << " - (t_gx_p + 1) *" << 16 * reShapeFactor << ">0){" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor << " + lidx + loop*256;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 9) << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 9) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 9) << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 9) << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - - clKernWrite(transKernel, 9) << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - clKernWrite(transKernel, 9) << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - // If requested, generate the Twiddle math to multiply constant values - if (params.fft_3StepTwiddle) - genTwiddleMathLeadingDimensionBatched(params, transKernel, dtComplex, fwd); - - clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; - clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; - clKernWrite(transKernel, 6) << "}" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "else{" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 9) << "index = lidy*" << 16 * reShapeFactor << " + lidx + loop*256;" << std::endl; - - - // Handle planar and interleaved right here - switch (params.fft_inputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_REAL: - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << "&& idx<" << smaller_dim << ")" << std::endl; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem);" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") " << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata);" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") " << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite(transKernel, 12) << "tmpm = inputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") " << std::endl; - clKernWrite(transKernel, 12) << "tmpt = inputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - dtOutput = dtPlanar; - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << "&& idx<" << smaller_dim << ") {" << std::endl; - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata, localmem); }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") {" << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata, localmem); }" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "tmpm = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx, pre_userdata); }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") {" << std::endl; - clKernWrite(transKernel, 12) << "tmpt = " << params.fft_preCallback.funcname << "(inputA_R, inputA_I, iOffset + (lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx, pre_userdata); }" << std::endl; - } - } - else - { - clKernWrite(transKernel, 12) << "tmpm.x = inputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx];" << std::endl; - clKernWrite(transKernel, 12) << "tmpm.y = inputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx]; }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p *" << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") {" << std::endl; - clKernWrite(transKernel, 12) << "tmpt.x = inputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx];" << std::endl; - clKernWrite(transKernel, 12) << "tmpt.y = inputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx]; }" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - // If requested, generate the Twiddle math to multiply constant values - if (params.fft_3StepTwiddle) - genTwiddleMathLeadingDimensionBatched(params, transKernel, dtComplex, fwd); - - clKernWrite(transKernel, 9) << "xy_s[index] = tmpm;" << std::endl; - clKernWrite(transKernel, 9) << "yx_s[index] = tmpt;" << std::endl; - - clKernWrite(transKernel, 9) << "}" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "" << std::endl; - clKernWrite(transKernel, 3) << "barrier(CLK_LOCAL_MEM_FENCE);" << std::endl; - clKernWrite(transKernel, 3) << "" << std::endl; - - // Step2: Write from shared to global - - clKernWrite(transKernel, 3) << "if (" << smaller_dim << " - (t_gx_p + 1) *" << 16 * reShapeFactor << ">0){" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - clKernWrite(transKernel, 9) << "index = lidx*" << 16 * reShapeFactor << " + lidy + " << 16 / reShapeFactor << "*loop ;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index];" << std::endl; - clKernWrite(transKernel, 9) << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index]; " << std::endl; - } - - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 9) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 9) << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].x;" << std::endl; - clKernWrite(transKernel, 9) << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].y;" << std::endl; - clKernWrite(transKernel, 9) << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].x; " << std::endl; - clKernWrite(transKernel, 9) << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].y; " << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - clKernWrite(transKernel, 6) << "}" << std::endl; - clKernWrite(transKernel, 3) << "}" << std::endl; - - clKernWrite(transKernel, 3) << "else{" << std::endl; - clKernWrite(transKernel, 6) << "for (size_t loop = 0; loop<" << reShapeFactor*reShapeFactor << "; ++loop){" << std::endl; - - clKernWrite(transKernel, 9) << "index = lidx*" << 16 * reShapeFactor << " + lidy + " << 16 / reShapeFactor << "*loop;" << std::endl; - - // Handle planar and interleaved right here - switch (params.fft_outputLayout) - { - case CLFFT_COMPLEX_INTERLEAVED: - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << " && idx<" << smaller_dim << ")" << std::endl; - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ")" << std::endl; - - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index]"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << ");" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "outputA[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index]; " << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ")" << std::endl; - clKernWrite(transKernel, 12) << "outputA[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index];" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - clKernWrite(transKernel, 9) << "if ((idy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << " && idx<" << smaller_dim << ") {" << std::endl; - - if (params.fft_hasPostCallback) - { - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx), post_userdata, yx_s[index].x, yx_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << "); }" << std::endl; - - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") {" << std::endl; - - clKernWrite(transKernel, 12) << params.fft_postCallback.funcname << "(outputA_R, outputA_I, ((lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx), post_userdata, xy_s[index].x, xy_s[index].y"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite(transKernel, 0) << ", localmem"; - } - clKernWrite(transKernel, 0) << "); }" << std::endl; - } - else - { - clKernWrite(transKernel, 12) << "outputA_R[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].x; " << std::endl; - clKernWrite(transKernel, 12) << "outputA_I[(idy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + idx] = yx_s[index].y; }" << std::endl; - clKernWrite(transKernel, 9) << "if ((t_gy_p * " << 16 * reShapeFactor << " + lidx)<" << smaller_dim << " && (t_gx_p * " << 16 * reShapeFactor << " + lidy + loop*" << 16 / reShapeFactor << ")<" << smaller_dim << ") {" << std::endl; - clKernWrite(transKernel, 12) << "outputA_R[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].x;" << std::endl; - clKernWrite(transKernel, 12) << "outputA_I[(lidy + loop*" << 16 / reShapeFactor << ")*" << params.fft_N[0] << " + lidx + starting_index_yx] = xy_s[index].y; }" << std::endl; - } - - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - - - clKernWrite(transKernel, 6) << "}" << std::endl; // end for - clKernWrite(transKernel, 3) << "}" << std::endl; // end else - - } - clKernWrite(transKernel, 0) << "}" << std::endl; - - strKernel = transKernel.str(); - - if (!params.fft_3StepTwiddle) - break; - } - - return CLFFT_SUCCESS; -} + strKernel = transKernel.str(); + + if (!params.fft_3StepTwiddle) + break; + } -}// end of namespace clfft_transpose_generator + return CLFFT_SUCCESS; +} +} // end of namespace clfft_transpose_generator diff --git a/src/library/generator.transpose.gcn.cpp b/src/library/generator.transpose.gcn.cpp index 3e642458..8c1c86d8 100644 --- a/src/library/generator.transpose.gcn.cpp +++ b/src/library/generator.transpose.gcn.cpp @@ -14,1229 +14,1281 @@ * limitations under the License. * ************************************************************************/ - -// clfft.generator.Transpose.cpp : Dynamic run-time generator of openCL transpose kernels +// clfft.generator.Transpose.cpp : Dynamic run-time generator of openCL +// transpose kernels // // TODO: generalize the kernel to work with any size #include "stdafx.h" -#include +#include #include -#include "generator.transpose.gcn.h" #include "generator.stockham.h" +#include "generator.transpose.gcn.h" #include "action.h" -FFTGeneratedTransposeGCNAction::FFTGeneratedTransposeGCNAction(clfftPlanHandle plHandle, FFTPlan * plan, cl_command_queue queue, clfftStatus & err) - : FFTTransposeGCNAction(plHandle, plan, queue, err) -{ - if (err != CLFFT_SUCCESS) - { - // FFTTransposeGCNAction() failed, exit - fprintf(stderr, "FFTTransposeGCNAction() failed!\n"); - return; - } +FFTGeneratedTransposeGCNAction::FFTGeneratedTransposeGCNAction( + clfftPlanHandle plHandle, FFTPlan *plan, cl_command_queue queue, + clfftStatus &err) + : FFTTransposeGCNAction(plHandle, plan, queue, err) { + if (err != CLFFT_SUCCESS) { + // FFTTransposeGCNAction() failed, exit + fprintf(stderr, "FFTTransposeGCNAction() failed!\n"); + return; + } - // Initialize the FFTAction::FFTKernelGenKeyParams member - err = this->initParams(); + // Initialize the FFTAction::FFTKernelGenKeyParams member + err = this->initParams(); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeGCNAction::initParams() failed!\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedTransposeGCNAction::initParams() failed!\n"); + return; + } - FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTRepo &fftRepo = FFTRepo::getInstance(); - err = this->generateKernel(fftRepo, queue); + err = this->generateKernel(fftRepo, queue); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeGCNAction::generateKernel failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedTransposeGCNAction::generateKernel failed\n"); + return; + } - err = compileKernels( queue, plHandle, plan); + err = compileKernels(queue, plHandle, plan); - if (err != CLFFT_SUCCESS) - { - fprintf(stderr, "FFTGeneratedTransposeGCNAction::compileKernels failed\n"); - return; - } + if (err != CLFFT_SUCCESS) { + fprintf(stderr, "FFTGeneratedTransposeGCNAction::compileKernels failed\n"); + return; + } - err = CLFFT_SUCCESS; + err = CLFFT_SUCCESS; } +bool FFTGeneratedTransposeGCNAction::buildForwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; -bool FFTGeneratedTransposeGCNAction::buildForwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); - - return (!real_transform) || r2c_transform; + return (!real_transform) || r2c_transform; } -bool FFTGeneratedTransposeGCNAction::buildBackwardKernel() -{ - clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; - clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; +bool FFTGeneratedTransposeGCNAction::buildBackwardKernel() { + clfftLayout inputLayout = this->getSignatureData()->fft_inputLayout; + clfftLayout outputLayout = this->getSignatureData()->fft_outputLayout; - bool r2c_transform = (inputLayout == CLFFT_REAL); - bool c2r_transform = (outputLayout == CLFFT_REAL); - bool real_transform = (r2c_transform || c2r_transform); + bool r2c_transform = (inputLayout == CLFFT_REAL); + bool c2r_transform = (outputLayout == CLFFT_REAL); + bool real_transform = (r2c_transform || c2r_transform); - return (!real_transform) || c2r_transform; + return (!real_transform) || c2r_transform; } - -// A structure that represents a bounding box or tile, with convenient names for the row and column addresses -// local work sizes -struct tile -{ - union - { - size_t x; - size_t col; - }; - - union - { - size_t y; - size_t row; - }; +// A structure that represents a bounding box or tile, with convenient names for +// the row and column addresses local work sizes +struct tile { + union { + size_t x; + size_t col; + }; + + union { + size_t y; + size_t row; + }; }; -inline std::stringstream& clKernWrite( std::stringstream& rhs, const size_t tabIndex ) -{ - rhs << std::setw( tabIndex ) << ""; - return rhs; +inline std::stringstream &clKernWrite(std::stringstream &rhs, + const size_t tabIndex) { + rhs << std::setw(tabIndex) << ""; + return rhs; } +static void OffsetCalc(std::stringstream &transKernel, + const FFTKernelGenKeyParams ¶ms, bool input) { + const size_t *stride = input ? params.fft_inStride : params.fft_outStride; + std::string offset = input ? "iOffset" : "oOffset"; + + std::string offsetInOut = input ? "offsetIn" : "offsetOut"; + clKernWrite(transKernel, 3) + << "size_t " << offset << " = " << offsetInOut << " ;" << std::endl; + + clKernWrite(transKernel, 3) << "currDimIndex = groupIndex.y;" << std::endl; + + for (size_t i = params.fft_DataDim - 2; i > 0; i--) { + clKernWrite(transKernel, 3) + << offset << " += (currDimIndex/numGroupsY_" << i << ")*" + << stride[i + 1] << ";" << std::endl; + clKernWrite(transKernel, 3) + << "currDimIndex = currDimIndex % numGroupsY_" << i << ";" << std::endl; + } + + clKernWrite(transKernel, 3) + << "rowSizeinUnits = " << stride[1] << ";" << std::endl; + + if (params.transOutHorizontal) { + if (input) { + clKernWrite(transKernel, 3) + << offset + << " += rowSizeinUnits * wgTileExtent.y * wgUnroll * groupIndex.x;" + << std::endl; + clKernWrite(transKernel, 3) + << offset << " += currDimIndex * wgTileExtent.x;" << std::endl; + } else { + clKernWrite(transKernel, 3) + << offset << " += rowSizeinUnits * wgTileExtent.x * currDimIndex;" + << std::endl; + clKernWrite(transKernel, 3) + << offset << " += groupIndex.x * wgTileExtent.y * wgUnroll;" + << std::endl; + } + } else { + if (input) { + clKernWrite(transKernel, 3) + << offset + << " += rowSizeinUnits * wgTileExtent.y * wgUnroll * currDimIndex;" + << std::endl; + clKernWrite(transKernel, 3) + << offset << " += groupIndex.x * wgTileExtent.x;" << std::endl; + } else { + clKernWrite(transKernel, 3) + << offset << " += rowSizeinUnits * wgTileExtent.x * groupIndex.x;" + << std::endl; + clKernWrite(transKernel, 3) + << offset << " += currDimIndex * wgTileExtent.y * wgUnroll;" + << std::endl; + } + } -static void OffsetCalc(std::stringstream& transKernel, const FFTKernelGenKeyParams& params, bool input ) -{ - const size_t *stride = input ? params.fft_inStride : params.fft_outStride; - std::string offset = input ? "iOffset" : "oOffset"; - - - std::string offsetInOut = input ? "offsetIn" : "offsetOut"; - clKernWrite( transKernel, 3 ) << "size_t " << offset << " = " << offsetInOut << " ;" << std::endl; - - clKernWrite( transKernel, 3 ) << "currDimIndex = groupIndex.y;" << std::endl; - - - for(size_t i = params.fft_DataDim - 2; i > 0 ; i--) - { - clKernWrite( transKernel, 3 ) << offset << " += (currDimIndex/numGroupsY_" << i << ")*" << stride[i+1] << ";" << std::endl; - clKernWrite( transKernel, 3 ) << "currDimIndex = currDimIndex % numGroupsY_" << i << ";" << std::endl; - } - - clKernWrite( transKernel, 3 ) << "rowSizeinUnits = " << stride[1] << ";" << std::endl; - - if(params.transOutHorizontal) - { - if(input) - { - clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.y * wgUnroll * groupIndex.x;" << std::endl; - clKernWrite( transKernel, 3 ) << offset << " += currDimIndex * wgTileExtent.x;" << std::endl; - } - else - { - clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.x * currDimIndex;" << std::endl; - clKernWrite( transKernel, 3 ) << offset << " += groupIndex.x * wgTileExtent.y * wgUnroll;" << std::endl; - } - } - else - { - if(input) - { - clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.y * wgUnroll * currDimIndex;" << std::endl; - clKernWrite( transKernel, 3 ) << offset << " += groupIndex.x * wgTileExtent.x;" << std::endl; - } - else - { - clKernWrite( transKernel, 3 ) << offset << " += rowSizeinUnits * wgTileExtent.x * groupIndex.x;" << std::endl; - clKernWrite( transKernel, 3 ) << offset << " += currDimIndex * wgTileExtent.y * wgUnroll;" << std::endl; - } - } - - clKernWrite( transKernel, 3 ) << std::endl; + clKernWrite(transKernel, 3) << std::endl; } +// Small snippet of code that multiplies the twiddle factors into the +// butterfiles. It is only emitted if the plan tells the generator that it +// wants the twiddle factors generated inside of the transpose +static clfftStatus genTwiddleMath(const FFTKernelGenKeyParams ¶ms, + std::stringstream &transKernel, + const std::string &dtComplex, bool fwd) { + clKernWrite(transKernel, 9) + << dtComplex + << " W = TW3step( (groupIndex.x * wgTileExtent.x + xInd) * (currDimIndex " + "* wgTileExtent.y * wgUnroll + yInd) );" + << std::endl; + clKernWrite(transKernel, 9) << dtComplex << " T;" << std::endl; + + if (fwd) { + clKernWrite(transKernel, 9) + << "T.x = ( W.x * tmp.x ) - ( W.y * tmp.y );" << std::endl; + clKernWrite(transKernel, 9) + << "T.y = ( W.y * tmp.x ) + ( W.x * tmp.y );" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "T.x = ( W.x * tmp.x ) + ( W.y * tmp.y );" << std::endl; + clKernWrite(transKernel, 9) + << "T.y = -( W.y * tmp.x ) + ( W.x * tmp.y );" << std::endl; + } + + clKernWrite(transKernel, 9) << "tmp.x = T.x;" << std::endl; + clKernWrite(transKernel, 9) << "tmp.y = T.y;" << std::endl; + + return CLFFT_SUCCESS; +} +// These strings represent the names that are used as strKernel parameters +const std::string pmRealIn("pmRealIn"); +const std::string pmImagIn("pmImagIn"); +const std::string pmRealOut("pmRealOut"); +const std::string pmImagOut("pmImagOut"); +const std::string pmComplexIn("pmComplexIn"); +const std::string pmComplexOut("pmComplexOut"); + +static clfftStatus +genTransposePrototype(const FFTGeneratedTransposeGCNAction::Signature ¶ms, + const tile &lwSize, const std::string &dtPlanar, + const std::string &dtComplex, const std::string &funcName, + std::stringstream &transKernel, std::string &dtInput, + std::string &dtOutput) { + + // Declare and define the function + clKernWrite(transKernel, 0) + << "__attribute__(( reqd_work_group_size( " << lwSize.x << ", " + << lwSize.y << ", 1 ) ))" << std::endl; + clKernWrite(transKernel, 0) << "kernel void" << std::endl; + + clKernWrite(transKernel, 0) << funcName << "( "; + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + dtInput = dtComplex; + clKernWrite(transKernel, 0) + << "global " << dtInput << "* restrict " << pmComplexIn; + + switch (params.fft_placeness) { + case CLFFT_INPLACE: + dtOutput = dtComplex; + break; + case CLFFT_OUTOFPLACE: + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + dtOutput = dtComplex; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict " << pmComplexOut; + break; + case CLFFT_COMPLEX_PLANAR: + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict " << pmRealOut + << ", global " << dtOutput << "* restrict " << pmImagOut; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + case CLFFT_REAL: + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + case CLFFT_COMPLEX_PLANAR: + dtInput = dtPlanar; + clKernWrite(transKernel, 0) + << "global " << dtInput << "* restrict " << pmRealIn << ", global " + << dtInput << "* restrict " << pmImagIn; + + switch (params.fft_placeness) { + case CLFFT_INPLACE: + dtOutput = dtPlanar; + break; + case CLFFT_OUTOFPLACE: + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + dtOutput = dtComplex; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict " << pmComplexOut; + break; + case CLFFT_COMPLEX_PLANAR: + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict " << pmRealOut + << ", global " << dtOutput << "* restrict " << pmImagOut; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + case CLFFT_REAL: + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + dtInput = dtPlanar; + clKernWrite(transKernel, 0) + << "global " << dtInput << "* restrict " << pmRealIn; + + switch (params.fft_placeness) { + case CLFFT_INPLACE: + dtOutput = dtPlanar; + break; + case CLFFT_OUTOFPLACE: + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + dtOutput = dtPlanar; + clKernWrite(transKernel, 0) + << ", global " << dtOutput << "* restrict " << pmRealOut; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + } + + if (params.fft_hasPreCallback) { + assert(!params.fft_hasPostCallback); + + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) + << ", __global void* pre_userdata, __local void* localmem"; + } else { + clKernWrite(transKernel, 0) << ", __global void* pre_userdata"; + } + } + if (params.fft_hasPostCallback) { + assert(!params.fft_hasPreCallback); -// Small snippet of code that multiplies the twiddle factors into the butterfiles. It is only emitted if the plan tells -// the generator that it wants the twiddle factors generated inside of the transpose -static clfftStatus genTwiddleMath( const FFTKernelGenKeyParams& params, std::stringstream& transKernel, const std::string& dtComplex, bool fwd ) -{ - clKernWrite( transKernel, 9 ) << dtComplex << " W = TW3step( (groupIndex.x * wgTileExtent.x + xInd) * (currDimIndex * wgTileExtent.y * wgUnroll + yInd) );" << std::endl; - clKernWrite( transKernel, 9 ) << dtComplex << " T;" << std::endl; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) + << ", __global void* post_userdata, __local void* localmem"; + } else { + clKernWrite(transKernel, 0) << ", __global void* post_userdata"; + } + } - if(fwd) - { - clKernWrite( transKernel, 9 ) << "T.x = ( W.x * tmp.x ) - ( W.y * tmp.y );" << std::endl; - clKernWrite( transKernel, 9 ) << "T.y = ( W.y * tmp.x ) + ( W.x * tmp.y );" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "T.x = ( W.x * tmp.x ) + ( W.y * tmp.y );" << std::endl; - clKernWrite( transKernel, 9 ) << "T.y = -( W.y * tmp.x ) + ( W.x * tmp.y );" << std::endl; - } + // Close the method signature - clKernWrite( transKernel, 9 ) << "tmp.x = T.x;" << std::endl; - clKernWrite( transKernel, 9 ) << "tmp.y = T.y;" << std::endl; + clKernWrite(transKernel, 0) << ", const int offsetIn, const int offsetOut "; - return CLFFT_SUCCESS; + clKernWrite(transKernel, 0) << " )\n{" << std::endl; + + return CLFFT_SUCCESS; } -// These strings represent the names that are used as strKernel parameters -const std::string pmRealIn( "pmRealIn" ); -const std::string pmImagIn( "pmImagIn" ); -const std::string pmRealOut( "pmRealOut" ); -const std::string pmImagOut( "pmImagOut" ); -const std::string pmComplexIn( "pmComplexIn" ); -const std::string pmComplexOut( "pmComplexOut" ); +static clfftStatus +genTransposeKernel(const FFTGeneratedTransposeGCNAction::Signature ¶ms, + std::string &strKernel, const tile &lwSize, + const size_t reShapeFactor, const size_t loopCount, + const tile &blockSize) { + strKernel.reserve(4096); + std::stringstream transKernel(std::stringstream::out); + + // These strings represent the various data types we read or write in the + // kernel, depending on how the plan is configured + std::string dtInput; // The type read as input into kernel + std::string dtOutput; // The type written as output from kernel + std::string dtPlanar; // Fundamental type for planar arrays + std::string dtComplex; // Fundamental type for complex arrays + + // NOTE: Enable only for debug + // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : + // enable\n" << std::endl; + + switch (params.fft_precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + dtPlanar = "float"; + dtComplex = "float2"; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + dtPlanar = "double"; + dtComplex = "double2"; + + // Emit code that enables double precision in the kernel + clKernWrite(transKernel, 0) << "#ifdef cl_khr_fp64" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#else" << std::endl; + clKernWrite(transKernel, 3) + << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; + clKernWrite(transKernel, 0) << "#endif\n" << std::endl; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + break; + } + + // If twiddle computation has been requested, generate the lookup function + if (params.fft_3StepTwiddle) { + std::string str; + StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * + params.fft_N[1]); + if ((params.fft_precision == CLFFT_SINGLE) || + (params.fft_precision == CLFFT_SINGLE_FAST)) + twLarge.GenerateTwiddleTable(str); + else + twLarge.GenerateTwiddleTable(str); + clKernWrite(transKernel, 0) << str << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + clKernWrite(transKernel, 0) + << "// Local structure to embody/capture tile dimensions" << std::endl; + clKernWrite(transKernel, 0) << "typedef struct tag_Tile" << std::endl; + clKernWrite(transKernel, 0) << "{" << std::endl; + clKernWrite(transKernel, 3) << "size_t x;" << std::endl; + clKernWrite(transKernel, 3) << "size_t y;" << std::endl; + clKernWrite(transKernel, 0) << "} Tile;" << std::endl << std::endl; + + if (params.fft_placeness == CLFFT_INPLACE) + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + // If pre-callback is set for the plan + if (params.fft_hasPreCallback) { + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_preCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + // If post-callback is set for the plan + if (params.fft_hasPostCallback) { + // Insert callback function code at the beginning + clKernWrite(transKernel, 0) + << params.fft_postCallback.funcstring << std::endl; + clKernWrite(transKernel, 0) << std::endl; + } + + for (size_t bothDir = 0; bothDir < 2; bothDir++) { + // Generate the kernel entry point and parameter list + // + bool fwd = bothDir ? false : true; -static clfftStatus genTransposePrototype( const FFTGeneratedTransposeGCNAction::Signature & params, const tile& lwSize, const std::string& dtPlanar, const std::string& dtComplex, - const std::string &funcName, std::stringstream& transKernel, std::string& dtInput, std::string& dtOutput ) -{ + std::string funcName; + if (params.fft_3StepTwiddle) + funcName = fwd ? "transpose_gcn_tw_fwd" : "transpose_gcn_tw_back"; + else + funcName = "transpose_gcn"; + + genTransposePrototype(params, lwSize, dtPlanar, dtComplex, funcName, + transKernel, dtInput, dtOutput); + + clKernWrite(transKernel, 3) + << "const Tile localIndex = { get_local_id( 0 ), get_local_id( 1 ) }; " + << std::endl; + clKernWrite(transKernel, 3) << "const Tile localExtent = { get_local_size( " + "0 ), get_local_size( 1 ) }; " + << std::endl; + clKernWrite(transKernel, 3) + << "const Tile groupIndex = { get_group_id( 0 ), get_group_id( 1 ) };" + << std::endl; + clKernWrite(transKernel, 3) << std::endl; + + clKernWrite(transKernel, 3) + << "// Calculate the unit address (in terms of datatype) of the " + "beginning of the Tile for the WG block" + << std::endl; + clKernWrite(transKernel, 3) << "// Transpose of input & output blocks " + "happens with the Offset calculation" + << std::endl; + clKernWrite(transKernel, 3) + << "const size_t reShapeFactor = " << reShapeFactor << ";" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t wgUnroll = " << loopCount << ";" << std::endl; + clKernWrite(transKernel, 3) + << "const Tile wgTileExtent = { localExtent.x * reShapeFactor, " + "localExtent.y / reShapeFactor };" + << std::endl; + + // This is the size of a matrix in the y dimension in units of group size; + // used to calculate stride[2] indexing + // size_t numGroupsY = DivRoundingUp( params.fft_N[ 1 ], lwSize.y / + // reShapeFactor * loopCount ); + + // numGroupY_1 is the number of cumulative work groups up to 1st dimension + // numGroupY_2 is the number of cumulative work groups up to 2nd dimension + // and so forth + + size_t numGroupsTemp; + if (params.transOutHorizontal) + numGroupsTemp = DivRoundingUp(params.fft_N[0], blockSize.x); + else + numGroupsTemp = DivRoundingUp(params.fft_N[1], blockSize.y); + + clKernWrite(transKernel, 3) << "const size_t numGroupsY_1" + << " = " << numGroupsTemp << ";" << std::endl; + for (int i = 2; i < params.fft_DataDim - 1; i++) { + numGroupsTemp *= params.fft_N[i]; + clKernWrite(transKernel, 3) << "const size_t numGroupsY_" << i << " = " + << numGroupsTemp << ";" << std::endl; + } - // Declare and define the function - clKernWrite( transKernel, 0 ) << "__attribute__(( reqd_work_group_size( " << lwSize.x << ", " << lwSize.y << ", 1 ) ))" << std::endl; - clKernWrite( transKernel, 0 ) << "kernel void" << std::endl; + // Generate the amount of local data share we need + // Assumption: Even for planar data, we will still store values in LDS as + // interleaved + tile ldsSize = {blockSize.x, blockSize.y}; + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + case CLFFT_COMPLEX_PLANAR: + clKernWrite(transKernel, 3) + << "// LDS is always complex and allocated transposed: lds[ " + "wgTileExtent.y * wgUnroll ][ wgTileExtent.x ];" + << std::endl; + clKernWrite(transKernel, 3) + << "local " << dtComplex << " lds[ " << ldsSize.x << " ][ " + << ldsSize.y << " ];" << std::endl + << std::endl; + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + clKernWrite(transKernel, 3) + << "local " << dtPlanar << " lds[ " << ldsSize.x << " ][ " + << ldsSize.y << " ];" << std::endl + << std::endl; + break; + } + + clKernWrite(transKernel, 3) << "size_t currDimIndex;" << std::endl; + clKernWrite(transKernel, 3) << "size_t rowSizeinUnits;" << std::endl + << std::endl; - clKernWrite( transKernel, 0 ) << funcName << "( "; + OffsetCalc(transKernel, params, true); - switch( params.fft_inputLayout ) - { + switch (params.fft_inputLayout) { case CLFFT_COMPLEX_INTERLEAVED: - dtInput = dtComplex; - clKernWrite( transKernel, 0 ) << "global " << dtInput << "* restrict " << pmComplexIn; - - switch( params.fft_placeness ) - { - case CLFFT_INPLACE: - dtOutput = dtComplex; - break; - case CLFFT_OUTOFPLACE: - switch( params.fft_outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - dtOutput = dtComplex; - clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmComplexOut; - break; - case CLFFT_COMPLEX_PLANAR: - dtOutput = dtPlanar; - clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmRealOut - << ", global " << dtOutput << "* restrict " << pmImagOut; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - case CLFFT_REAL: - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - break; + // No need of tileIn declaration when precallback is set as the global + // buffer is used directly + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "global " << dtInput << "* tileIn = " << pmComplexIn + << " + iOffset;" << std::endl; + } + break; case CLFFT_COMPLEX_PLANAR: - dtInput = dtPlanar; - clKernWrite( transKernel, 0 ) << "global " << dtInput << "* restrict " << pmRealIn << ", global " << dtInput << "* restrict " << pmImagIn; - - switch( params.fft_placeness ) - { - case CLFFT_INPLACE: - dtOutput = dtPlanar; - break; - case CLFFT_OUTOFPLACE: - switch( params.fft_outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - dtOutput = dtComplex; - clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmComplexOut; - break; - case CLFFT_COMPLEX_PLANAR: - dtOutput = dtPlanar; - clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmRealOut - << ", global " << dtOutput << "* restrict " << pmImagOut; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - case CLFFT_REAL: - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - break; + // No need of tileIn declaration when precallback is set as the global + // buffer is used directly + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "global " << dtInput << "* realTileIn = " << pmRealIn + << " + iOffset;" << std::endl; + clKernWrite(transKernel, 3) + << "global " << dtInput << "* imagTileIn = " << pmImagIn + << " + iOffset;" << std::endl; + } + break; case CLFFT_HERMITIAN_INTERLEAVED: case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; case CLFFT_REAL: - dtInput = dtPlanar; - clKernWrite( transKernel, 0 ) << "global " << dtInput << "* restrict " << pmRealIn; - - switch( params.fft_placeness ) - { - case CLFFT_INPLACE: - dtOutput = dtPlanar; - break; - case CLFFT_OUTOFPLACE: - switch( params.fft_outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - dtOutput = dtPlanar; - clKernWrite( transKernel, 0 ) << ", global " << dtOutput << "* restrict " << pmRealOut; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - } - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + // No need of tileIn declaration when precallback is set as the global + // buffer is used directly + if (!params.fft_hasPreCallback) { + clKernWrite(transKernel, 3) + << "global " << dtInput << "* tileIn = " << pmRealIn + << " + iOffset;" << std::endl; + } + break; } - if (params.fft_hasPreCallback) - { - assert(!params.fft_hasPostCallback); - - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite( transKernel, 0 ) << ", __global void* pre_userdata, __local void* localmem"; - } - else - { - clKernWrite( transKernel, 0 ) << ", __global void* pre_userdata"; - } - } - - if (params.fft_hasPostCallback) - { - assert(!params.fft_hasPreCallback); - - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite( transKernel, 0 ) << ", __global void* post_userdata, __local void* localmem"; - } - else - { - clKernWrite( transKernel, 0 ) << ", __global void* post_userdata"; - } - } - - // Close the method signature - - - clKernWrite( transKernel, 0 ) << ", const int offsetIn, const int offsetOut "; - - clKernWrite( transKernel, 0 ) << " )\n{" << std::endl; - - return CLFFT_SUCCESS; -} - -static clfftStatus genTransposeKernel( const FFTGeneratedTransposeGCNAction::Signature & params, std::string& strKernel, const tile& lwSize, const size_t reShapeFactor, - const size_t loopCount, const tile& blockSize ) -{ - strKernel.reserve( 4096 ); - std::stringstream transKernel( std::stringstream::out ); - - // These strings represent the various data types we read or write in the kernel, depending on how the plan - // is configured - std::string dtInput; // The type read as input into kernel - std::string dtOutput; // The type written as output from kernel - std::string dtPlanar; // Fundamental type for planar arrays - std::string dtComplex; // Fundamental type for complex arrays - - // NOTE: Enable only for debug - // clKernWrite( transKernel, 0 ) << "#pragma OPENCL EXTENSION cl_amd_printf : enable\n" << std::endl; - - switch( params.fft_precision ) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - dtPlanar = "float"; - dtComplex = "float2"; - break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - dtPlanar = "double"; - dtComplex = "double2"; - - // Emit code that enables double precision in the kernel - clKernWrite( transKernel, 0 ) << "#ifdef cl_khr_fp64" << std::endl; - clKernWrite( transKernel, 3 ) << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable" << std::endl; - clKernWrite( transKernel, 0 ) << "#else" << std::endl; - clKernWrite( transKernel, 3 ) << "#pragma OPENCL EXTENSION cl_amd_fp64 : enable" << std::endl; - clKernWrite( transKernel, 0 ) << "#endif\n" << std::endl; - break; - default: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - break; + // This is the loop reading through the Tile + if (params.fft_inputLayout == CLFFT_REAL) { + clKernWrite(transKernel, 3) << dtPlanar << " tmp;" << std::endl; + } else { + clKernWrite(transKernel, 3) << dtComplex << " tmp;" << std::endl; } + clKernWrite(transKernel, 3) + << "rowSizeinUnits = " << params.fft_inStride[1] << ";" << std::endl; + clKernWrite(transKernel, 3) << std::endl << std::endl; - // If twiddle computation has been requested, generate the lookup function - if(params.fft_3StepTwiddle) - { - std::string str; - StockhamGenerator::TwiddleTableLarge twLarge(params.fft_N[0] * params.fft_N[1]); - if( (params.fft_precision == CLFFT_SINGLE) || (params.fft_precision == CLFFT_SINGLE_FAST) ) - twLarge.GenerateTwiddleTable(str); - else - twLarge.GenerateTwiddleTable(str); - clKernWrite( transKernel, 0 ) << str << std::endl; - clKernWrite( transKernel, 0 ) << std::endl; - } - - - clKernWrite( transKernel, 0 ) << "// Local structure to embody/capture tile dimensions" << std::endl; - clKernWrite( transKernel, 0 ) << "typedef struct tag_Tile" << std::endl; - clKernWrite( transKernel, 0 ) << "{" << std::endl; - clKernWrite( transKernel, 3 ) << "size_t x;" << std::endl; - clKernWrite( transKernel, 3 ) << "size_t y;" << std::endl; - clKernWrite( transKernel, 0 ) << "} Tile;" << std::endl << std::endl; - - if( params.fft_placeness == CLFFT_INPLACE ) - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - //If pre-callback is set for the plan - if (params.fft_hasPreCallback) - { - //Insert callback function code at the beginning - clKernWrite( transKernel, 0 ) << params.fft_preCallback.funcstring << std::endl; - clKernWrite( transKernel, 0 ) << std::endl; - } - - //If post-callback is set for the plan - if (params.fft_hasPostCallback) - { - //Insert callback function code at the beginning - clKernWrite( transKernel, 0 ) << params.fft_postCallback.funcstring << std::endl; - clKernWrite( transKernel, 0 ) << std::endl; - } - - for(size_t bothDir=0; bothDir<2; bothDir++) - { - // Generate the kernel entry point and parameter list - // - bool fwd = bothDir ? false : true; - - std::string funcName; - if(params.fft_3StepTwiddle) - funcName = fwd ? "transpose_gcn_tw_fwd" : "transpose_gcn_tw_back"; - else - funcName = "transpose_gcn"; - - genTransposePrototype( params, lwSize, dtPlanar, dtComplex, funcName, transKernel, dtInput, dtOutput ); - - clKernWrite( transKernel, 3 ) << "const Tile localIndex = { get_local_id( 0 ), get_local_id( 1 ) }; " << std::endl; - clKernWrite( transKernel, 3 ) << "const Tile localExtent = { get_local_size( 0 ), get_local_size( 1 ) }; " << std::endl; - clKernWrite( transKernel, 3 ) << "const Tile groupIndex = { get_group_id( 0 ), get_group_id( 1 ) };" << std::endl; - clKernWrite( transKernel, 3 ) << std::endl; - - - - clKernWrite( transKernel, 3 ) << "// Calculate the unit address (in terms of datatype) of the beginning of the Tile for the WG block" << std::endl; - clKernWrite( transKernel, 3 ) << "// Transpose of input & output blocks happens with the Offset calculation" << std::endl; - clKernWrite( transKernel, 3 ) << "const size_t reShapeFactor = " << reShapeFactor << ";" << std::endl; - clKernWrite( transKernel, 3 ) << "const size_t wgUnroll = " << loopCount << ";" << std::endl; - clKernWrite( transKernel, 3 ) << "const Tile wgTileExtent = { localExtent.x * reShapeFactor, localExtent.y / reShapeFactor };" << std::endl; - - - // This is the size of a matrix in the y dimension in units of group size; used to calculate stride[2] indexing - //size_t numGroupsY = DivRoundingUp( params.fft_N[ 1 ], lwSize.y / reShapeFactor * loopCount ); - - //numGroupY_1 is the number of cumulative work groups up to 1st dimension - //numGroupY_2 is the number of cumulative work groups up to 2nd dimension and so forth - - size_t numGroupsTemp; - if(params.transOutHorizontal) - numGroupsTemp = DivRoundingUp( params.fft_N[0], blockSize.x ); - else - numGroupsTemp = DivRoundingUp( params.fft_N[1], blockSize.y ); - - clKernWrite( transKernel, 3 ) << "const size_t numGroupsY_1" << " = " << numGroupsTemp << ";" << std::endl; - for(int i = 2; i < params.fft_DataDim - 1; i++) - { - numGroupsTemp *= params.fft_N[i]; - clKernWrite( transKernel, 3 ) << "const size_t numGroupsY_" << i << " = " << numGroupsTemp << ";" << std::endl; - } - - - // Generate the amount of local data share we need - // Assumption: Even for planar data, we will still store values in LDS as interleaved - tile ldsSize = { blockSize.x, blockSize.y }; - switch( params.fft_outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - case CLFFT_COMPLEX_PLANAR: - clKernWrite( transKernel, 3 ) << "// LDS is always complex and allocated transposed: lds[ wgTileExtent.y * wgUnroll ][ wgTileExtent.x ];" << std::endl; - clKernWrite( transKernel, 3 ) << "local " << dtComplex << " lds[ " << ldsSize.x << " ][ " << ldsSize.y << " ];" << std::endl << std::endl; - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - clKernWrite( transKernel, 3 ) << "local " << dtPlanar << " lds[ " << ldsSize.x << " ][ " << ldsSize.y << " ];" << std::endl << std::endl; - break; - } - - - clKernWrite( transKernel, 3 ) << "size_t currDimIndex;" << std::endl ; - clKernWrite( transKernel, 3 ) << "size_t rowSizeinUnits;" << std::endl << std::endl ; - - - OffsetCalc(transKernel, params, true); - - - switch( params.fft_inputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - //No need of tileIn declaration when precallback is set as the global buffer is used directly - if (!params.fft_hasPreCallback) - { - clKernWrite( transKernel, 3 ) << "global " << dtInput << "* tileIn = " << pmComplexIn << " + iOffset;" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - //No need of tileIn declaration when precallback is set as the global buffer is used directly - if (!params.fft_hasPreCallback) - { - clKernWrite( transKernel, 3 ) << "global " << dtInput << "* realTileIn = " << pmRealIn << " + iOffset;" << std::endl; - clKernWrite( transKernel, 3 ) << "global " << dtInput << "* imagTileIn = " << pmImagIn << " + iOffset;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - //No need of tileIn declaration when precallback is set as the global buffer is used directly - if (!params.fft_hasPreCallback) - { - clKernWrite( transKernel, 3 ) << "global " << dtInput << "* tileIn = " << pmRealIn << " + iOffset;" << std::endl; - } - break; - - } - - // This is the loop reading through the Tile - if( params.fft_inputLayout == CLFFT_REAL ) - { - clKernWrite( transKernel, 3 ) << dtPlanar << " tmp;" << std::endl; - } - else - { - clKernWrite( transKernel, 3 ) << dtComplex << " tmp;" << std::endl; - } - - clKernWrite( transKernel, 3 ) << "rowSizeinUnits = " << params.fft_inStride[ 1 ] << ";" << std::endl; - clKernWrite( transKernel, 3 ) << std::endl << std::endl; - - // - // Group index traversal is logical where X direction is horizontal in input buffer and vertical in output buffer - // when transOutHorizontal is enabled X direction is vertical in input buffer and horizontal in output buffer - // Not to be confused within a tile, where X is horizontal in input and vertical in output always - - - - bool branchingInGroupX = params.transOutHorizontal ? ((params.fft_N[1] % blockSize.y) != 0) : ((params.fft_N[0] % blockSize.x) != 0); - bool branchingInGroupY = params.transOutHorizontal ? ((params.fft_N[0] % blockSize.x) != 0) : ((params.fft_N[1] % blockSize.y) != 0); - bool branchingInBoth = branchingInGroupX && branchingInGroupY; - bool branchingInAny = branchingInGroupX || branchingInGroupY; - - size_t branchBlocks = branchingInBoth ? 4 : ( branchingInAny ? 2 : 1 ); - - size_t cornerGroupX = params.transOutHorizontal ? (params.fft_N[1] / blockSize.y) : (params.fft_N[0] / blockSize.x); - size_t cornerGroupY = params.transOutHorizontal ? (params.fft_N[0] / blockSize.x) : (params.fft_N[1] / blockSize.y); - - std::string gIndexX = "groupIndex.x"; //params.transOutHorizontal ? "currDimIndex" : "groupIndex.x"; - std::string gIndexY = "currDimIndex"; //params.transOutHorizontal ? "groupIndex.x" : "currDimIndex"; - - std::string wIndexX = params.transOutHorizontal ? "yInd" : "xInd"; - std::string wIndexY = params.transOutHorizontal ? "xInd" : "yInd"; - - size_t wIndexXEnd = params.transOutHorizontal ? params.fft_N[1] % blockSize.y : params.fft_N[0] % blockSize.x; - size_t wIndexYEnd = params.transOutHorizontal ? params.fft_N[0] % blockSize.x : params.fft_N[1] % blockSize.y; - - //If precallback is set - if (params.fft_hasPreCallback && params.fft_inputLayout == CLFFT_COMPLEX_PLANAR) - { - clKernWrite( transKernel, 3 ) << dtComplex << " retCallback;" << std::endl; - } - - for(size_t i = 0; i 0) - { - clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmComplexIn << ", iOffset + gInd, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmComplexIn << ", iOffset + gInd, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite( transKernel, 9 ) << "tmp = tileIn[ gInd ];" << std::endl; - } - } - break; - case CLFFT_COMPLEX_PLANAR: - { - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite( transKernel, 9 ) << "retCallback = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", " << pmImagIn << ", iOffset + gInd, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "retCallback = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", " << pmImagIn << ", iOffset + gInd, pre_userdata);" << std::endl; - } - clKernWrite( transKernel, 9 ) << "tmp.s0 = retCallback.x;" << std::endl; - clKernWrite( transKernel, 9 ) << "tmp.s1 = retCallback.y;" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "tmp.s0 = realTileIn[ gInd ];" << std::endl; - clKernWrite( transKernel, 9 ) << "tmp.s1 = imagTileIn[ gInd ];" << std::endl; - } - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - if (params.fft_hasPreCallback) - { - if (params.fft_preCallback.localMemSize > 0) - { - clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", iOffset + gInd, pre_userdata, localmem);" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "tmp = " << params.fft_preCallback.funcname << "(" << pmRealIn << ", iOffset + gInd, pre_userdata);" << std::endl; - } - } - else - { - clKernWrite( transKernel, 9 ) << "tmp = tileIn[ gInd ];" << std::endl; - } - break; - } - - clKernWrite( transKernel, 9 ) << "// Transpose of Tile data happens here" << std::endl; - - // If requested, generate the Twiddle math to multiply constant values - if( params.fft_3StepTwiddle ) - genTwiddleMath( params, transKernel, dtComplex, fwd ); - - clKernWrite( transKernel, 9 ) << "lds[ xInd ][ yInd ] = tmp; " << std::endl; - - if (branchingInAny) - { - clKernWrite(transKernel, 9) << "}" << std::endl; - clKernWrite(transKernel, 9) << std::endl; - } - - clKernWrite( transKernel, 6 ) << "}" << std::endl; - - if(branchingInAny) - clKernWrite( transKernel, 3 ) << "}" << std::endl; - } - - clKernWrite( transKernel, 3 ) << std::endl; - clKernWrite( transKernel, 3 ) << "barrier( CLK_LOCAL_MEM_FENCE );" << std::endl; - clKernWrite( transKernel, 3 ) << std::endl; - - OffsetCalc(transKernel, params, false); - - - switch( params.fft_outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - //No need of tileOut declaration when postcallback is set as the global buffer is used directly - if (!params.fft_hasPostCallback) - { - clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* tileOut = " << pmComplexOut << " + oOffset;" << std::endl << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - //No need of tileOut declaration when postcallback is set as the global buffer is used directly - if (!params.fft_hasPostCallback) - { - clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* realTileOut = " << pmRealOut << " + oOffset;" << std::endl; - clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* imagTileOut = " << pmImagOut << " + oOffset;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - clKernWrite( transKernel, 3 ) << "global " << dtOutput << "* tileOut = " << pmRealOut << " + oOffset;" << std::endl << std::endl; - break; - } - - // Write the transposed values from LDS into global memory - clKernWrite( transKernel, 3 ) << "rowSizeinUnits = " << params.fft_outStride[ 1 ] << ";" << std::endl; - clKernWrite( transKernel, 3 ) << "const size_t transposeRatio = wgTileExtent.x / ( wgTileExtent.y * wgUnroll );" << std::endl; - clKernWrite( transKernel, 3 ) << "const size_t groupingPerY = wgUnroll / wgTileExtent.y;" << std::endl; - clKernWrite( transKernel, 3 ) << std::endl << std::endl; - - for(size_t i = 0; i 1) - { - clKernWrite( transKernel, 0 ) << "|| (" << wIndexY << " < " << wIndexXEnd - 1 << ") )" << std::endl; - } - else - { - clKernWrite( transKernel, 0 ) << ")" << std::endl; - } - } - else - { - clKernWrite( transKernel, 9 ) << "if( (" << wIndexY << " < " << wIndexXEnd << ") )" << std::endl; - } - clKernWrite( transKernel, 9 ) << "{" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << std::endl; - if(params.fft_realSpecial) - { - clKernWrite( transKernel, 9 ) << "if( ((" << wIndexX << " == " << wIndexYEnd - 1 << ") && (" << - wIndexY << " < 1) && (" << limitToWGForRealSpecial << " == 0)) "; - if(wIndexYEnd > 1) - { - clKernWrite( transKernel, 0 ) << "|| (" << wIndexX << " < " << wIndexYEnd - 1 << ") )" << std::endl; - } - else - { - clKernWrite( transKernel, 0 ) << ")" << std::endl; - } - } - else - { - clKernWrite( transKernel, 9 ) << "if( (" << wIndexX << " < " << wIndexYEnd << ") )" << std::endl; - } - clKernWrite( transKernel, 9 ) << "{" << std::endl; - } - } - else - clKernWrite( transKernel, 9 ) << "{" << std::endl; - } - - switch( params.fft_outputLayout ) - { - case CLFFT_COMPLEX_INTERLEAVED: - if (params.fft_hasPostCallback) - { - clKernWrite( transKernel, 9 ) << params.fft_postCallback.funcname << "(" << pmComplexOut << ", (oOffset + gInd), post_userdata, tmp"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite( transKernel, 0 ) << ", localmem"; - } - clKernWrite( transKernel, 0 ) << ");" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "tileOut[ gInd ] = tmp;" << std::endl; - } - break; - case CLFFT_COMPLEX_PLANAR: - if (params.fft_hasPostCallback) - { - clKernWrite( transKernel, 9 ) << params.fft_postCallback.funcname << "(" << pmRealOut << ", " << pmImagOut << ", (oOffset + gInd), post_userdata, tmp.s0, tmp.s1"; - if (params.fft_postCallback.localMemSize > 0) - { - clKernWrite( transKernel, 0 ) << ", localmem"; - } - clKernWrite( transKernel, 0 ) << ");" << std::endl; - } - else - { - clKernWrite( transKernel, 9 ) << "realTileOut[ gInd ] = tmp.s0;" << std::endl; - clKernWrite( transKernel, 9 ) << "imagTileOut[ gInd ] = tmp.s1;" << std::endl; - } - break; - case CLFFT_HERMITIAN_INTERLEAVED: - case CLFFT_HERMITIAN_PLANAR: - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - case CLFFT_REAL: - clKernWrite( transKernel, 9 ) << "tileOut[ gInd ] = tmp;" << std::endl; - break; - } - - if(branchingInAny) - { - clKernWrite( transKernel, 9 ) << "}" << std::endl; - } - - clKernWrite( transKernel, 6 ) << "}" << std::endl; - - if(branchingInAny) - clKernWrite( transKernel, 3 ) << "}" << std::endl; - } - - clKernWrite( transKernel, 0 ) << "}\n" << std::endl; - - strKernel = transKernel.str( ); - //std::cout << strKernel; - - if(!params.fft_3StepTwiddle) - break; - } - - return CLFFT_SUCCESS; -} + // + // Group index traversal is logical where X direction is horizontal in input + // buffer and vertical in output buffer when transOutHorizontal is enabled X + // direction is vertical in input buffer and horizontal in output buffer Not + // to be confused within a tile, where X is horizontal in input and vertical + // in output always + + bool branchingInGroupX = params.transOutHorizontal + ? ((params.fft_N[1] % blockSize.y) != 0) + : ((params.fft_N[0] % blockSize.x) != 0); + bool branchingInGroupY = params.transOutHorizontal + ? ((params.fft_N[0] % blockSize.x) != 0) + : ((params.fft_N[1] % blockSize.y) != 0); + bool branchingInBoth = branchingInGroupX && branchingInGroupY; + bool branchingInAny = branchingInGroupX || branchingInGroupY; + + size_t branchBlocks = branchingInBoth ? 4 : (branchingInAny ? 2 : 1); + + size_t cornerGroupX = params.transOutHorizontal + ? (params.fft_N[1] / blockSize.y) + : (params.fft_N[0] / blockSize.x); + size_t cornerGroupY = params.transOutHorizontal + ? (params.fft_N[0] / blockSize.x) + : (params.fft_N[1] / blockSize.y); + + std::string gIndexX = "groupIndex.x"; // params.transOutHorizontal ? + // "currDimIndex" : "groupIndex.x"; + std::string gIndexY = "currDimIndex"; // params.transOutHorizontal ? + // "groupIndex.x" : "currDimIndex"; + + std::string wIndexX = params.transOutHorizontal ? "yInd" : "xInd"; + std::string wIndexY = params.transOutHorizontal ? "xInd" : "yInd"; + + size_t wIndexXEnd = params.transOutHorizontal + ? params.fft_N[1] % blockSize.y + : params.fft_N[0] % blockSize.x; + size_t wIndexYEnd = params.transOutHorizontal + ? params.fft_N[0] % blockSize.x + : params.fft_N[1] % blockSize.y; + + // If precallback is set + if (params.fft_hasPreCallback && + params.fft_inputLayout == CLFFT_COMPLEX_PLANAR) { + clKernWrite(transKernel, 3) << dtComplex << " retCallback;" << std::endl; + } + for (size_t i = 0; i < branchBlocks; i++) { + if (branchingInBoth) + if (i == 0) { + clKernWrite(transKernel, 3) + << "if( (" << gIndexX << " == " << cornerGroupX << ") && (" + << gIndexY << " == " << cornerGroupY << ") )" << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else if (i == 1) { + if (!cornerGroupY) + continue; + + clKernWrite(transKernel, 3) + << "else if( " << gIndexX << " == " << cornerGroupX << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else if (i == 2) { + if (!cornerGroupX) + continue; + + clKernWrite(transKernel, 3) + << "else if( " << gIndexY << " == " << cornerGroupY << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else { + if ((!cornerGroupX) || (!cornerGroupY)) + continue; + + clKernWrite(transKernel, 3) << "else" << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } + else if (branchingInAny) + if (i == 0) { + if (branchingInGroupX) { + clKernWrite(transKernel, 3) + << "if( " << gIndexX << " == " << cornerGroupX << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else { + clKernWrite(transKernel, 3) + << "if( " << gIndexY << " == " << cornerGroupY << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } + } else { + if ((!cornerGroupX) || (!cornerGroupY)) + continue; + + clKernWrite(transKernel, 3) << "else" << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } -clfftStatus FFTGeneratedTransposeGCNAction::initParams () -{ + clKernWrite(transKernel, 6) + << "for( uint t=0; t < wgUnroll; t++ )" << std::endl; + clKernWrite(transKernel, 6) << "{" << std::endl; + + clKernWrite(transKernel, 9) + << "size_t xInd = localIndex.x + localExtent.x * ( localIndex.y % " + "wgTileExtent.y ); " + << std::endl; + clKernWrite(transKernel, 9) + << "size_t yInd = localIndex.y/wgTileExtent.y + t * wgTileExtent.y; " + << std::endl; + + // Calculating the index seperately enables easier debugging through tools + clKernWrite(transKernel, 9) + << "size_t gInd = xInd + rowSizeinUnits * yInd;" << std::endl; + + if (branchingInBoth) { + if (i == 0) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) + << "if( (" << wIndexX << "< " << wIndexXEnd << ") && (" << wIndexY + << " < " << wIndexYEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } else if (i == 1) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) << "if( (" << wIndexX << " < " + << wIndexXEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } else if (i == 2) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) << "if( (" << wIndexY << " < " + << wIndexYEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } else + clKernWrite(transKernel, 9) << "{" << std::endl; + } else if (branchingInAny) { + if (i == 0) { + if (branchingInGroupX) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) << "if( (" << wIndexX << " < " + << wIndexXEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } else { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) << "if( (" << wIndexY << " < " + << wIndexYEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } + } else + clKernWrite(transKernel, 9) << "{" << std::endl; + } + + switch (params.fft_inputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: { + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "tmp = " << params.fft_preCallback.funcname << "(" + << pmComplexIn << ", iOffset + gInd, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmp = " << params.fft_preCallback.funcname << "(" + << pmComplexIn << ", iOffset + gInd, pre_userdata);" + << std::endl; + } + } else { + clKernWrite(transKernel, 9) << "tmp = tileIn[ gInd ];" << std::endl; + } + } break; + case CLFFT_COMPLEX_PLANAR: { + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "retCallback = " << params.fft_preCallback.funcname << "(" + << pmRealIn << ", " << pmImagIn + << ", iOffset + gInd, pre_userdata, localmem);" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "retCallback = " << params.fft_preCallback.funcname << "(" + << pmRealIn << ", " << pmImagIn + << ", iOffset + gInd, pre_userdata);" << std::endl; + } + clKernWrite(transKernel, 9) << "tmp.s0 = retCallback.x;" << std::endl; + clKernWrite(transKernel, 9) << "tmp.s1 = retCallback.y;" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmp.s0 = realTileIn[ gInd ];" << std::endl; + clKernWrite(transKernel, 9) + << "tmp.s1 = imagTileIn[ gInd ];" << std::endl; + } + } break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + if (params.fft_hasPreCallback) { + if (params.fft_preCallback.localMemSize > 0) { + clKernWrite(transKernel, 9) + << "tmp = " << params.fft_preCallback.funcname << "(" + << pmRealIn << ", iOffset + gInd, pre_userdata, localmem);" + << std::endl; + } else { + clKernWrite(transKernel, 9) + << "tmp = " << params.fft_preCallback.funcname << "(" + << pmRealIn << ", iOffset + gInd, pre_userdata);" << std::endl; + } + } else { + clKernWrite(transKernel, 9) << "tmp = tileIn[ gInd ];" << std::endl; + } + break; + } - this->signature.fft_precision = this->plan->precision; - this->signature.fft_placeness = this->plan->placeness; - this->signature.fft_inputLayout = this->plan->inputLayout; - this->signature.fft_outputLayout = this->plan->outputLayout; - this->signature.fft_3StepTwiddle = false; + clKernWrite(transKernel, 9) + << "// Transpose of Tile data happens here" << std::endl; - this->signature.fft_realSpecial = this->plan->realSpecial; + // If requested, generate the Twiddle math to multiply constant values + if (params.fft_3StepTwiddle) + genTwiddleMath(params, transKernel, dtComplex, fwd); - this->signature.transOutHorizontal = this->plan->transOutHorizontal; // using the twiddle front flag to specify horizontal write - // we do this so as to reuse flags in FFTKernelGenKeyParams - // and to avoid making a new one + clKernWrite(transKernel, 9) << "lds[ xInd ][ yInd ] = tmp; " << std::endl; - ARG_CHECK( this->plan->inStride.size( ) == this->plan->outStride.size( ) ); + if (branchingInAny) { + clKernWrite(transKernel, 9) << "}" << std::endl; + clKernWrite(transKernel, 9) << std::endl; + } - if( CLFFT_INPLACE == this->signature.fft_placeness ) - { - // If this is an in-place transform the - // input and output layout, dimensions and strides - // *MUST* be the same. - // - ARG_CHECK( this->signature.fft_inputLayout == this->signature.fft_outputLayout ) + clKernWrite(transKernel, 6) << "}" << std::endl; - for( size_t u = this->plan->inStride.size(); u-- > 0; ) - { - ARG_CHECK( this->plan->inStride[u] == this->plan->outStride[u] ); - } + if (branchingInAny) + clKernWrite(transKernel, 3) << "}" << std::endl; } - this->signature.fft_DataDim = this->plan->length.size() + 1; - int i = 0; - for(i = 0; i < (this->signature.fft_DataDim - 1); i++) - { - this->signature.fft_N[i] = this->plan->length[i]; - this->signature.fft_inStride[i] = this->plan->inStride[i]; - this->signature.fft_outStride[i] = this->plan->outStride[i]; - - } - this->signature.fft_inStride[i] = this->plan->iDist; - this->signature.fft_outStride[i] = this->plan->oDist; - - if (this->plan->large1D != 0) { - ARG_CHECK (this->signature.fft_N[0] != 0) - ARG_CHECK ((this->plan->large1D % this->signature.fft_N[0]) == 0) - this->signature.fft_3StepTwiddle = true; - ARG_CHECK ( this->plan->large1D == (this->signature.fft_N[1] * this->signature.fft_N[0]) ); - } + clKernWrite(transKernel, 3) << std::endl; + clKernWrite(transKernel, 3) + << "barrier( CLK_LOCAL_MEM_FENCE );" << std::endl; + clKernWrite(transKernel, 3) << std::endl; - // Query the devices in this context for their local memory sizes - // How we generate a kernel depends on the *minimum* LDS size for all devices. - // - const FFTEnvelope * pEnvelope = NULL; - OPENCL_V( this->plan->GetEnvelope( &pEnvelope ), _T( "GetEnvelope failed" ) ); - BUG_CHECK( NULL != pEnvelope ); - - // TODO: Since I am going with a 2D workgroup size now, I need a better check than this 1D use - // Check: CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE - // CL_DEVICE_MAX_WORK_ITEM_SIZES - this->signature.fft_R = 1; // Dont think i'll use - this->signature.fft_SIMD = pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size - - //Set callback if specified - if (this->plan->hasPreCallback) - { - this->signature.fft_hasPreCallback = true; - this->signature.fft_preCallback = this->plan->preCallback; - } - if (this->plan->hasPostCallback) - { - this->signature.fft_hasPostCallback = true; - this->signature.fft_postCallback = this->plan->postCallbackParam; - } - this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; - - return CLFFT_SUCCESS; -} + OffsetCalc(transKernel, params, false); -// Constants that specify the bounding sizes of the block that each workgroup will transpose -static const tile lwSize = { 16, 16 }; -static const size_t reShapeFactor = 4; // wgTileSize = { lwSize.x * reShapeFactor, lwSize.y / reShapeFactor } + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + // No need of tileOut declaration when postcallback is set as the global + // buffer is used directly + if (!params.fft_hasPostCallback) { + clKernWrite(transKernel, 3) + << "global " << dtOutput << "* tileOut = " << pmComplexOut + << " + oOffset;" << std::endl + << std::endl; + } + break; + case CLFFT_COMPLEX_PLANAR: + // No need of tileOut declaration when postcallback is set as the global + // buffer is used directly + if (!params.fft_hasPostCallback) { + clKernWrite(transKernel, 3) + << "global " << dtOutput << "* realTileOut = " << pmRealOut + << " + oOffset;" << std::endl; + clKernWrite(transKernel, 3) + << "global " << dtOutput << "* imagTileOut = " << pmImagOut + << " + oOffset;" << std::endl; + } + break; + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + clKernWrite(transKernel, 3) + << "global " << dtOutput << "* tileOut = " << pmRealOut + << " + oOffset;" << std::endl + << std::endl; + break; + } + // Write the transposed values from LDS into global memory + clKernWrite(transKernel, 3) + << "rowSizeinUnits = " << params.fft_outStride[1] << ";" << std::endl; + clKernWrite(transKernel, 3) + << "const size_t transposeRatio = wgTileExtent.x / ( wgTileExtent.y * " + "wgUnroll );" + << std::endl; + clKernWrite(transKernel, 3) + << "const size_t groupingPerY = wgUnroll / wgTileExtent.y;" + << std::endl; + clKernWrite(transKernel, 3) << std::endl << std::endl; + + for (size_t i = 0; i < branchBlocks; i++) { + if (branchingInBoth) + if (i == 0) { + clKernWrite(transKernel, 3) + << "if( (" << gIndexX << " == " << cornerGroupX << ") && (" + << gIndexY << " == " << cornerGroupY << ") )" << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else if (i == 1) { + if (!cornerGroupY) + continue; + + clKernWrite(transKernel, 3) + << "else if( " << gIndexX << " == " << cornerGroupX << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else if (i == 2) { + if (!cornerGroupX) + continue; + + clKernWrite(transKernel, 3) + << "else if( " << gIndexY << " == " << cornerGroupY << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else { + if ((!cornerGroupX) || (!cornerGroupY)) + continue; + + clKernWrite(transKernel, 3) << "else" << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } + else if (branchingInAny) + if (i == 0) { + if (branchingInGroupX) { + clKernWrite(transKernel, 3) + << "if( " << gIndexX << " == " << cornerGroupX << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } else { + clKernWrite(transKernel, 3) + << "if( " << gIndexY << " == " << cornerGroupY << " )" + << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } + } else { + if ((!cornerGroupX) || (!cornerGroupY)) + continue; + + clKernWrite(transKernel, 3) << "else" << std::endl; + clKernWrite(transKernel, 3) << "{" << std::endl; + } -static clfftStatus CalculateBlockSize(const clfftPrecision precision, size_t &loopCount, tile &blockSize) -{ - switch( precision ) - { - case CLFFT_SINGLE: - case CLFFT_SINGLE_FAST: - loopCount = 16; + clKernWrite(transKernel, 6) + << "for( uint t=0; t < wgUnroll; t++ )" << std::endl; + clKernWrite(transKernel, 6) << "{" << std::endl; + clKernWrite(transKernel, 9) + << "size_t xInd = localIndex.x + localExtent.x * ( localIndex.y % " + "groupingPerY ); " + << std::endl; + clKernWrite(transKernel, 9) << "size_t yInd = localIndex.y/groupingPerY " + "+ t * (wgTileExtent.y * transposeRatio); " + << std::endl; + clKernWrite(transKernel, 9) << "tmp = lds[ yInd ][ xInd ]; " << std::endl; + clKernWrite(transKernel, 9) + << "size_t gInd = xInd + rowSizeinUnits * yInd;" << std::endl; + + if (branchingInBoth) { + if (i == 0) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) + << "if( (" << wIndexY << " < " << wIndexXEnd << ") && (" + << wIndexX << " < " << wIndexYEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } else if (i == 1) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) << "if( (" << wIndexY << " < " + << wIndexXEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + + } else if (i == 2) { + clKernWrite(transKernel, 9) << std::endl; + clKernWrite(transKernel, 9) << "if( (" << wIndexX << " < " + << wIndexYEnd << ") )" << std::endl; + clKernWrite(transKernel, 9) << "{" << std::endl; + } else + clKernWrite(transKernel, 9) << "{" << std::endl; + } else if (branchingInAny) { + std::string limitToWGForRealSpecial = + params.transOutHorizontal ? "groupIndex.x" : "currDimIndex"; + + if (i == 0) { + if (branchingInGroupX) { + clKernWrite(transKernel, 9) << std::endl; + if (params.fft_realSpecial) { + clKernWrite(transKernel, 9) + << "if( ((" << wIndexY << " == " << wIndexXEnd - 1 << ") && (" + << wIndexX << " < 1) && (" << limitToWGForRealSpecial + << " == 0)) "; + if (wIndexXEnd > 1) { + clKernWrite(transKernel, 0) + << "|| (" << wIndexY << " < " << wIndexXEnd - 1 << ") )" + << std::endl; + } else { + clKernWrite(transKernel, 0) << ")" << std::endl; + } + } else { + clKernWrite(transKernel, 9) << "if( (" << wIndexY << " < " + << wIndexXEnd << ") )" << std::endl; + } + clKernWrite(transKernel, 9) << "{" << std::endl; + } else { + clKernWrite(transKernel, 9) << std::endl; + if (params.fft_realSpecial) { + clKernWrite(transKernel, 9) + << "if( ((" << wIndexX << " == " << wIndexYEnd - 1 << ") && (" + << wIndexY << " < 1) && (" << limitToWGForRealSpecial + << " == 0)) "; + if (wIndexYEnd > 1) { + clKernWrite(transKernel, 0) + << "|| (" << wIndexX << " < " << wIndexYEnd - 1 << ") )" + << std::endl; + } else { + clKernWrite(transKernel, 0) << ")" << std::endl; + } + } else { + clKernWrite(transKernel, 9) << "if( (" << wIndexX << " < " + << wIndexYEnd << ") )" << std::endl; + } + clKernWrite(transKernel, 9) << "{" << std::endl; + } + } else + clKernWrite(transKernel, 9) << "{" << std::endl; + } + + switch (params.fft_outputLayout) { + case CLFFT_COMPLEX_INTERLEAVED: + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname << "(" << pmComplexOut + << ", (oOffset + gInd), post_userdata, tmp"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 9) << "tileOut[ gInd ] = tmp;" << std::endl; + } break; - case CLFFT_DOUBLE: - case CLFFT_DOUBLE_FAST: - // Double precisions need about half the amount of LDS space as singles do - loopCount = 8; + case CLFFT_COMPLEX_PLANAR: + if (params.fft_hasPostCallback) { + clKernWrite(transKernel, 9) + << params.fft_postCallback.funcname << "(" << pmRealOut << ", " + << pmImagOut + << ", (oOffset + gInd), post_userdata, tmp.s0, tmp.s1"; + if (params.fft_postCallback.localMemSize > 0) { + clKernWrite(transKernel, 0) << ", localmem"; + } + clKernWrite(transKernel, 0) << ");" << std::endl; + } else { + clKernWrite(transKernel, 9) + << "realTileOut[ gInd ] = tmp.s0;" << std::endl; + clKernWrite(transKernel, 9) + << "imagTileOut[ gInd ] = tmp.s1;" << std::endl; + } break; - default: + case CLFFT_HERMITIAN_INTERLEAVED: + case CLFFT_HERMITIAN_PLANAR: return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + case CLFFT_REAL: + clKernWrite(transKernel, 9) << "tileOut[ gInd ] = tmp;" << std::endl; break; - } + } - blockSize.x = lwSize.x * reShapeFactor; - blockSize.y = lwSize.y / reShapeFactor * loopCount; + if (branchingInAny) { + clKernWrite(transKernel, 9) << "}" << std::endl; + } - return CLFFT_SUCCESS; -} + clKernWrite(transKernel, 6) << "}" << std::endl; + if (branchingInAny) + clKernWrite(transKernel, 3) << "}" << std::endl; + } + clKernWrite(transKernel, 0) << "}\n" << std::endl; + strKernel = transKernel.str(); + // std::cout << strKernel; -// OpenCL does not take unicode strings as input, so this routine returns only ASCII strings -// Feed this generator the FFTPlan, and it returns the generated program as a string -clfftStatus FFTGeneratedTransposeGCNAction::generateKernel ( FFTRepo& fftRepo, const cl_command_queue commQueueFFT ) -{ - - size_t loopCount = 0; - tile blockSize = {0, 0}; - OPENCL_V( CalculateBlockSize(this->signature.fft_precision, loopCount, blockSize), _T("CalculateBlockSize() failed!") ); - - //Requested local memory size by callback must not exceed the device LDS limits after factoring the LDS size required by main FFT kernel - if ((this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) || - (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0)) - { - assert(!(this->signature.fft_hasPreCallback && this->signature.fft_hasPostCallback)); - - bool validLDSSize = false; - size_t length = blockSize.x * blockSize.y; - - size_t requestedCallbackLDS = 0; - - if (this->signature.fft_hasPreCallback && this->signature.fft_preCallback.localMemSize > 0) - requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; - else if (this->signature.fft_hasPostCallback && this->signature.fft_postCallback.localMemSize > 0) - requestedCallbackLDS = this->signature.fft_postCallback.localMemSize; - - validLDSSize = ((length * this->plan->ElementSize()) + requestedCallbackLDS) < this->plan->envelope.limit_LocalMemSize; - - if(!validLDSSize) - { - fprintf(stderr, "Requested local memory size not available\n"); - return CLFFT_INVALID_ARG_VALUE; - } - } - - std::string programCode; - OPENCL_V( genTransposeKernel( this->signature, programCode, lwSize, reShapeFactor, loopCount, blockSize ), _T( "GenerateTransposeKernel() failed!" ) ); - - cl_int status = CL_SUCCESS; - cl_device_id Device = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &Device, NULL); - OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) ); - - cl_context QueueContext = NULL; - status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, sizeof(cl_context), &QueueContext, NULL); - OPENCL_V( status, _T( "clGetCommandQueueInfo failed" ) ); - - - OPENCL_V( fftRepo.setProgramCode( Transpose_GCN, this->getSignatureData(), programCode, Device, QueueContext ), _T( "fftRepo.setclString() failed!" ) ); - - // Note: See genFunctionPrototype( ) - if( this->signature.fft_3StepTwiddle ) - { - OPENCL_V( fftRepo.setProgramEntryPoints( Transpose_GCN, this->getSignatureData(), "transpose_gcn_tw_fwd", "transpose_gcn_tw_back", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) ); - } - else - { - OPENCL_V( fftRepo.setProgramEntryPoints( Transpose_GCN, this->getSignatureData(), "transpose_gcn", "transpose_gcn", Device, QueueContext ), _T( "fftRepo.setProgramEntryPoint() failed!" ) ); - } + if (!params.fft_3StepTwiddle) + break; + } - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } +clfftStatus FFTGeneratedTransposeGCNAction::initParams() { + + this->signature.fft_precision = this->plan->precision; + this->signature.fft_placeness = this->plan->placeness; + this->signature.fft_inputLayout = this->plan->inputLayout; + this->signature.fft_outputLayout = this->plan->outputLayout; + this->signature.fft_3StepTwiddle = false; -clfftStatus FFTGeneratedTransposeGCNAction::getWorkSizes( std::vector< size_t >& globalWS, std::vector< size_t >& localWS ) -{ - size_t loopCount = 0; - tile blockSize = {0, 0}; - OPENCL_V( CalculateBlockSize(this->signature.fft_precision, loopCount, blockSize), _T("CalculateBlockSize() failed!") ); + this->signature.fft_realSpecial = this->plan->realSpecial; + this->signature.transOutHorizontal = + this->plan->transOutHorizontal; // using the twiddle front flag to specify + // horizontal write we do this so as to + // reuse flags in FFTKernelGenKeyParams + // and to avoid making a new one - // We need to make sure that the global work size is evenly divisible by the local work size - // Our transpose works in tiles, so divide tiles in each dimension to get count of blocks, rounding up for remainder items - size_t numBlocksX = this->signature.transOutHorizontal ? - DivRoundingUp(this->signature.fft_N[ 1 ], blockSize.y ) : - DivRoundingUp(this->signature.fft_N[ 0 ], blockSize.x ); - size_t numBlocksY = this->signature.transOutHorizontal ? - DivRoundingUp( this->signature.fft_N[ 0 ], blockSize.x ) : - DivRoundingUp( this->signature.fft_N[ 1 ], blockSize.y ); - size_t numWIX = numBlocksX * lwSize.x; + ARG_CHECK(this->plan->inStride.size() == this->plan->outStride.size()); - // Batches of matrices are lined up along the Y axis, 1 after the other - size_t numWIY = numBlocksY * lwSize.y * this->plan->batchsize; - // fft_DataDim has one more dimension than the actual fft data, which is devoted to batch. - // dim from 2 to fft_DataDim - 2 are lined up along the Y axis - for(int i = 2; i < this->signature.fft_DataDim - 1; i++) - { - numWIY *= this->signature.fft_N[i]; - } + if (CLFFT_INPLACE == this->signature.fft_placeness) { + // If this is an in-place transform the + // input and output layout, dimensions and strides + // *MUST* be the same. + // + ARG_CHECK(this->signature.fft_inputLayout == + this->signature.fft_outputLayout) + for (size_t u = this->plan->inStride.size(); u-- > 0;) { + ARG_CHECK(this->plan->inStride[u] == this->plan->outStride[u]); + } + } + + this->signature.fft_DataDim = this->plan->length.size() + 1; + int i = 0; + for (i = 0; i < (this->signature.fft_DataDim - 1); i++) { + this->signature.fft_N[i] = this->plan->length[i]; + this->signature.fft_inStride[i] = this->plan->inStride[i]; + this->signature.fft_outStride[i] = this->plan->outStride[i]; + } + this->signature.fft_inStride[i] = this->plan->iDist; + this->signature.fft_outStride[i] = this->plan->oDist; + + if (this->plan->large1D != 0) { + ARG_CHECK(this->signature.fft_N[0] != 0) + ARG_CHECK((this->plan->large1D % this->signature.fft_N[0]) == 0) + this->signature.fft_3StepTwiddle = true; + ARG_CHECK(this->plan->large1D == + (this->signature.fft_N[1] * this->signature.fft_N[0])); + } + + // Query the devices in this context for their local memory sizes + // How we generate a kernel depends on the *minimum* LDS size for all + //devices. + // + const FFTEnvelope *pEnvelope = nullptr; + OPENCL_V(this->plan->GetEnvelope(&pEnvelope), _T( "GetEnvelope failed" )); + BUG_CHECK(nullptr != pEnvelope); + + // TODO: Since I am going with a 2D workgroup size now, I need a better check + // than this 1D use Check: + // CL_DEVICE_MAX_WORK_GROUP_SIZE/CL_KERNEL_WORK_GROUP_SIZE + // CL_DEVICE_MAX_WORK_ITEM_SIZES + this->signature.fft_R = 1; // Dont think i'll use + this->signature.fft_SIMD = + pEnvelope->limit_WorkGroupSize; // Use devices maximum workgroup size + + // Set callback if specified + if (this->plan->hasPreCallback) { + this->signature.fft_hasPreCallback = true; + this->signature.fft_preCallback = this->plan->preCallback; + } + if (this->plan->hasPostCallback) { + this->signature.fft_hasPostCallback = true; + this->signature.fft_postCallback = this->plan->postCallbackParam; + } + this->signature.limit_LocalMemSize = this->plan->envelope.limit_LocalMemSize; + + return CLFFT_SUCCESS; +} - globalWS.clear( ); - globalWS.push_back( numWIX ); - globalWS.push_back( numWIY ); +// Constants that specify the bounding sizes of the block that each workgroup +// will transpose +static const tile lwSize = {16, 16}; +static const size_t reShapeFactor = + 4; // wgTileSize = { lwSize.x * reShapeFactor, lwSize.y / reShapeFactor } + +static clfftStatus CalculateBlockSize(const clfftPrecision precision, + size_t &loopCount, tile &blockSize) { + switch (precision) { + case CLFFT_SINGLE: + case CLFFT_SINGLE_FAST: + loopCount = 16; + break; + case CLFFT_DOUBLE: + case CLFFT_DOUBLE_FAST: + // Double precisions need about half the amount of LDS space as singles do + loopCount = 8; + break; + default: + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + break; + } + + blockSize.x = lwSize.x * reShapeFactor; + blockSize.y = lwSize.y / reShapeFactor * loopCount; + + return CLFFT_SUCCESS; +} - localWS.clear( ); - localWS.push_back( lwSize.x ); - localWS.push_back( lwSize.y ); +// OpenCL does not take unicode strings as input, so this routine returns +//only ASCII strings Feed this generator the FFTPlan, and it returns the +//generated program as a string +clfftStatus FFTGeneratedTransposeGCNAction::generateKernel( + FFTRepo &fftRepo, const cl_command_queue commQueueFFT) { + + size_t loopCount = 0; + tile blockSize = {0, 0}; + OPENCL_V( + CalculateBlockSize(this->signature.fft_precision, loopCount, blockSize), + _T("CalculateBlockSize() failed!")); + + // Requested local memory size by callback must not exceed the device LDS + // limits after factoring the LDS size required by main FFT kernel + if ((this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) || + (this->signature.fft_hasPostCallback && + this->signature.fft_postCallback.localMemSize > 0)) { + assert(!(this->signature.fft_hasPreCallback && + this->signature.fft_hasPostCallback)); + + bool validLDSSize = false; + size_t length = blockSize.x * blockSize.y; + + size_t requestedCallbackLDS = 0; + + if (this->signature.fft_hasPreCallback && + this->signature.fft_preCallback.localMemSize > 0) + requestedCallbackLDS = this->signature.fft_preCallback.localMemSize; + else if (this->signature.fft_hasPostCallback && + this->signature.fft_postCallback.localMemSize > 0) + requestedCallbackLDS = this->signature.fft_postCallback.localMemSize; + + validLDSSize = + ((length * this->plan->ElementSize()) + requestedCallbackLDS) < + this->plan->envelope.limit_LocalMemSize; + + if (!validLDSSize) { + fprintf(stderr, "Requested local memory size not available\n"); + return CLFFT_INVALID_ARG_VALUE; + } + } + + std::string programCode; + OPENCL_V(genTransposeKernel(this->signature, programCode, lwSize, + reShapeFactor, loopCount, blockSize), + _T( "GenerateTransposeKernel() failed!" )); + + cl_int status = CL_SUCCESS; + cl_device_id Device = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_DEVICE, + sizeof(cl_device_id), &Device, nullptr); + OPENCL_V(status, _T( "clGetCommandQueueInfo failed" )); + + cl_context QueueContext = nullptr; + status = clGetCommandQueueInfo(commQueueFFT, CL_QUEUE_CONTEXT, + sizeof(cl_context), &QueueContext, nullptr); + OPENCL_V(status, _T( "clGetCommandQueueInfo failed" )); + + OPENCL_V(fftRepo.setProgramCode(Transpose_GCN, this->getSignatureData(), + programCode, Device, QueueContext), + _T( "fftRepo.setclString() failed!" )); + + // Note: See genFunctionPrototype( ) + if (this->signature.fft_3StepTwiddle) { + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_GCN, this->getSignatureData(), + "transpose_gcn_tw_fwd", "transpose_gcn_tw_back", Device, + QueueContext), + _T( "fftRepo.setProgramEntryPoint() failed!" )); + } else { + OPENCL_V(fftRepo.setProgramEntryPoints( + Transpose_GCN, this->getSignatureData(), "transpose_gcn", + "transpose_gcn", Device, QueueContext), + _T( "fftRepo.setProgramEntryPoint() failed!" )); + } + + return CLFFT_SUCCESS; +} - return CLFFT_SUCCESS; +clfftStatus +FFTGeneratedTransposeGCNAction::getWorkSizes(std::vector &globalWS, + std::vector &localWS) { + size_t loopCount = 0; + tile blockSize = {0, 0}; + OPENCL_V( + CalculateBlockSize(this->signature.fft_precision, loopCount, blockSize), + _T("CalculateBlockSize() failed!")); + + // We need to make sure that the global work size is evenly divisible by the + // local work size Our transpose works in tiles, so divide tiles in each + // dimension to get count of blocks, rounding up for remainder items + size_t numBlocksX = + this->signature.transOutHorizontal + ? DivRoundingUp(this->signature.fft_N[1], blockSize.y) + : DivRoundingUp(this->signature.fft_N[0], blockSize.x); + size_t numBlocksY = + this->signature.transOutHorizontal + ? DivRoundingUp(this->signature.fft_N[0], blockSize.x) + : DivRoundingUp(this->signature.fft_N[1], blockSize.y); + size_t numWIX = numBlocksX * lwSize.x; + + // Batches of matrices are lined up along the Y axis, 1 after the other + size_t numWIY = numBlocksY * lwSize.y * this->plan->batchsize; + // fft_DataDim has one more dimension than the actual fft data, which is + // devoted to batch. dim from 2 to fft_DataDim - 2 are lined up along the Y + // axis + for (int i = 2; i < this->signature.fft_DataDim - 1; i++) { + numWIY *= this->signature.fft_N[i]; + } + + globalWS.clear(); + globalWS.push_back(numWIX); + globalWS.push_back(numWIY); + + localWS.clear(); + localWS.push_back(lwSize.x); + localWS.push_back(lwSize.y); + + return CLFFT_SUCCESS; } diff --git a/src/library/generator.transpose.gcn.h b/src/library/generator.transpose.gcn.h index 12ad7014..aca4e7e1 100644 --- a/src/library/generator.transpose.gcn.h +++ b/src/library/generator.transpose.gcn.h @@ -15,11 +15,10 @@ * ************************************************************************/ #pragma once -#if !defined( AMD_CLFFT_generator_transpose_H ) +#if !defined(AMD_CLFFT_generator_transpose_H) #define AMD_CLFFT_generator_transpose_H +#include "plan.h" #include "private.h" #include "repo.h" -#include "plan.h" #endif - diff --git a/src/library/generator.transpose.h b/src/library/generator.transpose.h index d00b6579..5bcafe8f 100644 --- a/src/library/generator.transpose.h +++ b/src/library/generator.transpose.h @@ -1,40 +1,40 @@ /* ************************************************************************ -* Copyright 2016 Advanced Micro Devices, Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ************************************************************************/ + * Copyright 2016 Advanced Micro Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ************************************************************************/ #pragma once -#if !defined( AMD_CLFFT_GENERATOR_TRANSPOSE_HEADER ) +#if !defined(AMD_CLFFT_GENERATOR_TRANSPOSE_HEADER) #define AMD_CLFFT_GENERATOR_TRANSPOSE_HEADER -#include +#include "action.h" +#include "generator.stockham.h" +#include "plan.h" #include "private.h" #include "repo.h" -#include "plan.h" -#include "generator.stockham.h" -#include "action.h" +#include -#define AVAIL_MEM_SIZE 32768 +#define AVAIL_MEM_SIZE 32768 -inline std::stringstream& clKernWrite(std::stringstream& rhs, const size_t tabIndex) -{ - rhs << std::setw(tabIndex) << ""; - return rhs; +inline std::stringstream &clKernWrite(std::stringstream &rhs, + const size_t tabIndex) { + rhs << std::setw(tabIndex) << ""; + return rhs; } -namespace clfft_transpose_generator -{ -//generate transepose kernel with sqaure 2d matrix of row major with arbitrary batch size +namespace clfft_transpose_generator { +// generate transepose kernel with sqaure 2d matrix of row major with arbitrary +// batch size /* Below is a matrix(row major) containing three sqaure sub matrix along column The transpose will be done within each sub matrix. @@ -42,24 +42,37 @@ The transpose will be done within each sub matrix. M1 M2] */ -clfftStatus genTransposeKernelBatched(const FFTGeneratedTransposeSquareAction::Signature & params, std::string& strKernel, const size_t& lwSize, const size_t reShapeFactor); +clfftStatus genTransposeKernelBatched( + const FFTGeneratedTransposeSquareAction::Signature ¶ms, + std::string &strKernel, const size_t &lwSize, const size_t reShapeFactor); -//generate transpose kernel with square 2d matrix of row major with blocks along the leading dimension -//aka leading dimension batched +// generate transpose kernel with square 2d matrix of row major with blocks +// along the leading dimension aka leading dimension batched /* Below is a matrix(row major) contaning three square sub matrix along row [M0 M2 M2] */ -clfftStatus genTransposeKernelLeadingDimensionBatched(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, const size_t& lwSize, const size_t reShapeFactor); +clfftStatus genTransposeKernelLeadingDimensionBatched( + const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + std::string &strKernel, const size_t &lwSize, const size_t reShapeFactor); -//swap lines. This kind of kernels are using with combination of square transpose kernels to perform nonsqaure transpose 1:2 ratio -clfftStatus genSwapKernel(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, std::string& KernelFuncName, const size_t& lwSize, const size_t reShapeFactor); +// swap lines. This kind of kernels are using with combination of square +// transpose kernels to perform nonsqaure transpose 1:2 ratio +clfftStatus +genSwapKernel(const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + std::string &strKernel, std::string &KernelFuncName, + const size_t &lwSize, const size_t reShapeFactor); -clfftStatus genSwapKernelGeneral(const FFTGeneratedTransposeNonSquareAction::Signature & params, std::string& strKernel, std::string& KernelFuncName, const size_t& lwSize, const size_t reShapeFactor); +clfftStatus genSwapKernelGeneral( + const FFTGeneratedTransposeNonSquareAction::Signature ¶ms, + std::string &strKernel, std::string &KernelFuncName, const size_t &lwSize, + const size_t reShapeFactor); -void get_cycles(size_t *cycle_map, size_t num_reduced_row, size_t num_reduced_col); +void get_cycles(size_t *cycle_map, size_t num_reduced_row, + size_t num_reduced_col); -void permutation_calculation(size_t m, size_t n, std::vector > &permutationVec); -}//end of namespace clfft_transpose_generator +void permutation_calculation(size_t m, size_t n, + std::vector> &permutationVec); +} // end of namespace clfft_transpose_generator #endif \ No newline at end of file diff --git a/src/library/lifetime.cpp b/src/library/lifetime.cpp index 8ca9a940..48691db7 100644 --- a/src/library/lifetime.cpp +++ b/src/library/lifetime.cpp @@ -14,90 +14,92 @@ * limitations under the License. * ************************************************************************/ - -// clfft.lifetime.cpp : Functions that control the lifetime of the FFT library and their supporting functions +// clfft.lifetime.cpp : Functions that control the lifetime of the FFT library +// and their supporting functions // -#include "stdafx.h" -#include "private.h" -#include "repo.h" #include "../include/sharedLibrary.h" #include "../statTimer/statisticalTimer.extern.h" +#include "private.h" +#include "repo.h" +#include "stdafx.h" -clfftStatus clfftInitSetupData( clfftSetupData* setupData ) -{ - setupData->major = clfftVersionMajor; - setupData->minor = clfftVersionMinor; - setupData->patch = clfftVersionPatch; - setupData->debugFlags = 0; +clfftStatus clfftInitSetupData(clfftSetupData *setupData) { + setupData->major = clfftVersionMajor; + setupData->minor = clfftVersionMinor; + setupData->patch = clfftVersionPatch; + setupData->debugFlags = 0; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } // Allow AMD's implementation of FFT's to allocate internal resources -clfftStatus clfftSetup( const clfftSetupData* sData ) -{ - // Static data is not thread safe (to create), so we implement a lock to protect instantiation for the first call - // Implemented outside of FFTRepo::getInstance to minimize lock overhead; this is only necessary on first creation - scopedLock sLock( FFTRepo::lockRepo(), _T( "FFTRepo::getInstance" ) ); - - // First invocation of this function will allocate the FFTRepo singleton; thereafter the object always exists - FFTRepo& fftRepo = FFTRepo::getInstance( ); - - clfftInitRequestLibNoMemAlloc(); - clfftInitBinaryCache(); - - // Discover and load the timer module if present - fftRepo.timerHandle = LoadSharedLibrary( "lib", "StatTimer", true ); - if( fftRepo.timerHandle ) - { - // Timer module discovered and loaded successfully - // Initialize function pointers to call into the shared module - PFGETSTATTIMER pfGetStatTimer = reinterpret_cast< PFGETSTATTIMER > ( LoadFunctionAddr( fftRepo.timerHandle, "getStatTimer" ) ); - - // Create and initialize our timer class, if the external timer shared library loaded - if( pfGetStatTimer ) - { - fftRepo.pStatTimer = reinterpret_cast< GpuStatTimer* > ( pfGetStatTimer( CLFFT_GPU ) ); - } - } - - // If the client has no setupData, we are done - if( sData == NULL ) - return CLFFT_SUCCESS; - - // Versioning checks commented out until necessary - //// If the major version number between the client and library do not match, return mismatch - //if( sData->major > clfftVersionMajor ) - // return CLFFT_VERSION_MISMATCH; - - //// If the minor version number between the client and library do not match, return mismatch - //if( sData->minor > clfftVersionMinor ) - // return CLFFT_VERSION_MISMATCH; - - //// We ignore patch version number for version validation - - fftRepo.setupData = *sData; - - return CLFFT_SUCCESS; +clfftStatus clfftSetup(const clfftSetupData *sData) { + // Static data is not thread safe (to create), so we implement a lock to + //protect instantiation for the first call Implemented outside of + //FFTRepo::getInstance to minimize lock overhead; this is only necessary on + //first creation + scopedLock sLock(FFTRepo::lockRepo(), _T( "FFTRepo::getInstance" )); + + // First invocation of this function will allocate the FFTRepo singleton; + //thereafter the object always exists + FFTRepo &fftRepo = FFTRepo::getInstance(); + + clfftInitRequestLibNoMemAlloc(); + clfftInitBinaryCache(); + + // Discover and load the timer module if present + fftRepo.timerHandle = LoadSharedLibrary("lib", "StatTimer", true); + if (fftRepo.timerHandle) { + // Timer module discovered and loaded successfully + // Initialize function pointers to call into the shared module + PFGETSTATTIMER pfGetStatTimer = reinterpret_cast( + LoadFunctionAddr(fftRepo.timerHandle, "getStatTimer")); + + // Create and initialize our timer class, if the external timer shared + //library loaded + if (pfGetStatTimer) { + fftRepo.pStatTimer = + reinterpret_cast(pfGetStatTimer(CLFFT_GPU)); + } + } + + // If the client has no setupData, we are done + if (sData == nullptr) + return CLFFT_SUCCESS; + + // Versioning checks commented out until necessary + //// If the major version number between the client and library do not match, + ///return mismatch + // if( sData->major > clfftVersionMajor ) + // return CLFFT_VERSION_MISMATCH; + + //// If the minor version number between the client and library do not match, + ///return mismatch + // if( sData->minor > clfftVersionMinor ) + // return CLFFT_VERSION_MISMATCH; + + //// We ignore patch version number for version validation + + fftRepo.setupData = *sData; + + return CLFFT_SUCCESS; } // Allow AMD's implementation of FFT's to destroy internal resources -clfftStatus clfftTeardown( ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - fftRepo.releaseResources( ); +clfftStatus clfftTeardown() { + FFTRepo &fftRepo = FFTRepo::getInstance(); + fftRepo.releaseResources(); - FreeSharedLibrary( fftRepo.timerHandle ); + FreeSharedLibrary(fftRepo.timerHandle); - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftGetVersion( cl_uint* major, cl_uint* minor, cl_uint* patch ) -{ - *major = clfftVersionMajor; - *minor = clfftVersionMinor; - *patch = clfftVersionPatch; +clfftStatus clfftGetVersion(cl_uint *major, cl_uint *minor, cl_uint *patch) { + *major = clfftVersionMajor; + *minor = clfftVersionMinor; + *patch = clfftVersionPatch; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } diff --git a/src/library/lock.h b/src/library/lock.h index 49c95aca..eec50c74 100644 --- a/src/library/lock.h +++ b/src/library/lock.h @@ -14,235 +14,213 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_lock_H ) +#if !defined(CLFFT_lock_H) #define CLFFT_lock_H -#if defined( _WIN32 ) - #include +#if defined(_WIN32) +#include #else - #include +#include #endif #include "private.h" -#if defined( _WIN32 ) - -// lockRAII provides an abstraction for the concept of a mutex; it wraps all mutex functions in generic methods -// On windows, the mutex is implemented as a CRITICAL_SECTION, as this is the fastest intraprocess mutex -// available. -// The template argument 'debugPrint' activates debugging information, but if not active the compiler optimizes -// the print statements out -template< bool debugPrint > -class lockRAII -{ - CRITICAL_SECTION cs; - tstring csName; - tstringstream tstream; - - // Does not make sense to create a copy of a lock object; private method - lockRAII( const lockRAII& rhs ): csName( rhs.csName ) - { - tstream << std::hex << std::showbase; - ::InitializeCriticalSection( &cs ); - } - - public: - lockRAII( ) - { - tstream << std::hex << std::showbase; - ::InitializeCriticalSection( &cs ); - } - - lockRAII( const tstring& name ): csName( name ) - { - tstream << std::hex << std::showbase; - ::InitializeCriticalSection( &cs ); - } - - ~lockRAII( ) - { - ::DeleteCriticalSection( &cs ); - } - - tstring& getName( ) - { - return csName; - } - - void setName( const tstring& name ) - { - csName = name; - } - - void enter( ) - { - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Attempting CRITICAL_SECTION( " ) << csName << _T( " )" ) << std::endl; - tout << tstream.str( ); - } - - ::EnterCriticalSection( &cs ); - - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Acquired CRITICAL_SECTION( " ) << csName << _T( " )" ) << std::endl; - tstream << _T( "\tOwningThread( " ) << cs.OwningThread << _T( " )" ) << std::endl; - tstream << _T( "\tLockcount( " ) << cs.LockCount << _T( " )" ) << std::endl; - tstream << _T( "\tRecursionCount( " ) << cs.RecursionCount << _T( " )" ) << std::endl; - tout << tstream.str( ); - } - } - - void leave( ) - { - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Releasing CRITICAL_SECTION( " ) << csName << _T( " )" ) << std::endl; - tstream << _T( "\tOwningThread( " ) << cs.OwningThread << _T( " )" ) << std::endl; - tstream << _T( "\tLockcount( " ) << cs.LockCount << _T( " )" ) << std::endl; - tstream << _T( "\tRecursionCount( " ) << cs.RecursionCount << _T( " )" ) << std::endl << std::endl; - tout << tstream.str( ); - } - - ::LeaveCriticalSection( &cs ); - } +#if defined(_WIN32) + +// lockRAII provides an abstraction for the concept of a mutex; it wraps +//all mutex functions in generic methods On windows, the mutex is implemented +//as a CRITICAL_SECTION, as this is the fastest intraprocess mutex available. +// The template argument 'debugPrint' activates debugging information, but +//if not active the compiler optimizes the print statements out +template class lockRAII { + CRITICAL_SECTION cs; + tstring csName; + tstringstream tstream; + + // Does not make sense to create a copy of a lock object; private method + lockRAII(const lockRAII &rhs) : csName(rhs.csName) { + tstream << std::hex << std::showbase; + ::InitializeCriticalSection(&cs); + } + +public: + lockRAII() { + tstream << std::hex << std::showbase; + ::InitializeCriticalSection(&cs); + } + + lockRAII(const tstring &name) : csName(name) { + tstream << std::hex << std::showbase; + ::InitializeCriticalSection(&cs); + } + + ~lockRAII() { ::DeleteCriticalSection(&cs); } + + tstring &getName() { return csName; } + + void setName(const tstring &name) { csName = name; } + + void enter() { + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Attempting CRITICAL_SECTION( " ) << csName << _T( " )" ) + << std::endl; + tout << tstream.str(); + } + + ::EnterCriticalSection(&cs); + + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Acquired CRITICAL_SECTION( " ) << csName << _T( " )" ) + << std::endl; + tstream << _T( "\tOwningThread( " ) << cs.OwningThread << _T( " )" ) + << std::endl; + tstream << _T( "\tLockcount( " ) << cs.LockCount << _T( " )" ) + << std::endl; + tstream << _T( "\tRecursionCount( " ) << cs.RecursionCount << _T( " )" ) + << std::endl; + tout << tstream.str(); + } + } + + void leave() { + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Releasing CRITICAL_SECTION( " ) << csName << _T( " )" ) + << std::endl; + tstream << _T( "\tOwningThread( " ) << cs.OwningThread << _T( " )" ) + << std::endl; + tstream << _T( "\tLockcount( " ) << cs.LockCount << _T( " )" ) + << std::endl; + tstream << _T( "\tRecursionCount( " ) << cs.RecursionCount << _T( " )" ) + << std::endl + << std::endl; + tout << tstream.str(); + } + + ::LeaveCriticalSection(&cs); + } }; #else -// lockRAII provides an abstraction for the concept of a mutex; it wraps all mutex functions in generic methods -// Linux implementation not done yet -// The template argument 'debugPrint' activates debugging information, but if not active the compiler optimizes -// the print statements out -template< bool debugPrint > -class lockRAII -{ - pthread_mutex_t mutex; - pthread_mutexattr_t mAttr; - tstring mutexName; - tstringstream tstream; - - // Does not make sense to create a copy of a lock object; private method - lockRAII( const lockRAII& rhs ): mutexName( rhs.mutexName ) - { - tstream << std::hex << std::showbase; - } - - public: - lockRAII( ) - { - tstream << std::hex << std::showbase; - pthread_mutexattr_init( &mAttr ); - pthread_mutexattr_settype( &mAttr, PTHREAD_MUTEX_RECURSIVE ); - pthread_mutex_init( &mutex, &mAttr ); - } - - lockRAII( const tstring& name ): mutexName( name ) - { - tstream << std::hex << std::showbase; - pthread_mutexattr_init( &mAttr ); - pthread_mutexattr_settype( &mAttr, PTHREAD_MUTEX_RECURSIVE ); - pthread_mutex_init( &mutex, &mAttr ); - } - - ~lockRAII( ) - { - pthread_mutex_destroy( &mutex ); - pthread_mutexattr_destroy( &mAttr ); - } - - tstring& getName( ) - { - return mutexName; - } - - void setName( const tstring& name ) - { - mutexName = name; - } - - void enter( ) - { - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Attempting pthread_mutex_t( " ) << mutexName << _T( " )" ) << std::endl; - tout << tstream.str( ); - } - - ::pthread_mutex_lock( &mutex ); - - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Acquired pthread_mutex_t( " ) << mutexName << _T( " )" ) << std::endl; - //tstream << _T( "\tOwningThread( " ) << mutex.OwningThread << _T( " )" ) << std::endl; - //tstream << _T( "\tLockcount( " ) << mutex.LockCount << _T( " )" ) << std::endl; - //tstream << _T( "\tRecursionCount( " ) << mutex.RecursionCount << _T( " )" ) << std::endl; - tout << tstream.str( ); - } - } - - void leave( ) - { - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Releasing pthread_mutex_t( " ) << mutexName << _T( " )" ) << std::endl; - //tstream << _T( "\tOwningThread( " ) << mutex.OwningThread << _T( " )" ) << std::endl; - //tstream << _T( "\tLockcount( " ) << mutex.LockCount << _T( " )" ) << std::endl; - //tstream << _T( "\tRecursionCount( " ) << mutex.RecursionCount << _T( " )" ) << std::endl << std::endl; - tout << tstream.str( ); - } - - ::pthread_mutex_unlock( &mutex ); - } +// lockRAII provides an abstraction for the concept of a mutex; it wraps +//all mutex functions in generic methods Linux implementation not done yet The +//template argument 'debugPrint' activates debugging information, but if not +//active the compiler optimizes the print statements out +template class lockRAII { + pthread_mutex_t mutex; + pthread_mutexattr_t mAttr; + tstring mutexName; + tstringstream tstream; + + // Does not make sense to create a copy of a lock object; private method + lockRAII(const lockRAII &rhs) : mutexName(rhs.mutexName) { + tstream << std::hex << std::showbase; + } + +public: + lockRAII() { + tstream << std::hex << std::showbase; + pthread_mutexattr_init(&mAttr); + pthread_mutexattr_settype(&mAttr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mutex, &mAttr); + } + + lockRAII(const tstring &name) : mutexName(name) { + tstream << std::hex << std::showbase; + pthread_mutexattr_init(&mAttr); + pthread_mutexattr_settype(&mAttr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mutex, &mAttr); + } + + ~lockRAII() { + pthread_mutex_destroy(&mutex); + pthread_mutexattr_destroy(&mAttr); + } + + tstring &getName() { return mutexName; } + + void setName(const tstring &name) { mutexName = name; } + + void enter() { + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Attempting pthread_mutex_t( " ) << mutexName << _T( " )" ) + << std::endl; + tout << tstream.str(); + } + + ::pthread_mutex_lock(&mutex); + + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Acquired pthread_mutex_t( " ) << mutexName << _T( " )" ) + << std::endl; + // tstream << _T( "\tOwningThread( " ) << mutex.OwningThread << _T( " )" ) + // << std::endl; tstream << _T( "\tLockcount( " ) << mutex.LockCount << _T( + // " )" ) << std::endl; tstream << _T( "\tRecursionCount( " ) << + // mutex.RecursionCount << _T( " )" ) << std::endl; + tout << tstream.str(); + } + } + + void leave() { + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Releasing pthread_mutex_t( " ) << mutexName << _T( " )" ) + << std::endl; + // tstream << _T( "\tOwningThread( " ) << mutex.OwningThread << _T( " )" ) + // << std::endl; tstream << _T( "\tLockcount( " ) << mutex.LockCount << _T( + // " )" ) << std::endl; tstream << _T( "\tRecursionCount( " ) << + // mutex.RecursionCount << _T( " )" ) << std::endl << std::endl; + tout << tstream.str(); + } + + ::pthread_mutex_unlock(&mutex); + } }; #endif -// Class used to make sure that we enter and leave critical sections in pairs -// The template logic logs our CRITICAL_SECTION actions; if the template parameter is false, -// the branch is constant and the compiler will optimize the branch out -template< bool debugPrint > -class scopedLock -{ - lockRAII< debugPrint >* sLock; - tstring sLockName; - tstringstream tstream; - - public: - scopedLock( lockRAII< debugPrint >& lock, const tstring& name ): sLock( &lock ), sLockName( name ) - { - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Entering scopedLock( " ) << sLockName << _T( " )" ) << std::endl << std::endl; - tout << tstream.str( ); - } - - sLock->enter( ); - } - - ~scopedLock( ) - { - sLock->leave( ); - - if( debugPrint ) - { - tstream.str( _T( "" ) ); - tstream << _T( "Left scopedLock( " ) << sLockName << _T( " )" ) << std::endl << std::endl; - tout << tstream.str( ); - } - } +// Class used to make sure that we enter and leave critical sections in +//pairs The template logic logs our CRITICAL_SECTION actions; if the template +//parameter is false, the branch is constant and the compiler will optimize the +//branch out +template class scopedLock { + lockRAII *sLock; + tstring sLockName; + tstringstream tstream; + +public: + scopedLock(lockRAII &lock, const tstring &name) + : sLock(&lock), sLockName(name) { + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Entering scopedLock( " ) << sLockName << _T( " )" ) + << std::endl + << std::endl; + tout << tstream.str(); + } + + sLock->enter(); + } + + ~scopedLock() { + sLock->leave(); + + if (debugPrint) { + tstream.str(_T( "" )); + tstream << _T( "Left scopedLock( " ) << sLockName << _T( " )" ) + << std::endl + << std::endl; + tout << tstream.str(); + } + } }; // Convenience macro to enable/disable debugging print statements -#define lockRAII lockRAII< false > -#define scopedLock scopedLock< false > +#define lockRAII lockRAII +#define scopedLock scopedLock -#endif // CLFFT_lock_H +#endif // CLFFT_lock_H diff --git a/src/library/mainpage.h b/src/library/mainpage.h index d4aca713..e3abbc92 100644 --- a/src/library/mainpage.h +++ b/src/library/mainpage.h @@ -16,105 +16,170 @@ /*! @file mainpage.h -This file contains all documentation, no code, in the form of comment text. It provides -chapter 1 of the documentation that is produced with doxygen. Chapter 1 includes the title page, installation instructions, and prose on the nature of FFT and their use in our library. +This file contains all documentation, no code, in the form of comment text. It +provides chapter 1 of the documentation that is produced with doxygen. Chapter 1 +includes the title page, installation instructions, and prose on the nature of +FFT and their use in our library. @mainpage OpenCL Fast Fourier Transforms (FFTs) -The clFFT library is an OpenCL library implementation of discrete Fast Fourier Transforms. The library: +The clFFT library is an OpenCL library implementation of discrete Fast Fourier +Transforms. The library: @li provides a fast and accurate platform for calculating discrete FFTs. @li works on CPU or GPU backends. @li supports in-place or out-of-place transforms. -@li supports 1D, 2D, and 3D transforms with a batch size that can be greater than or equal to 1. -@li supports planar (real and complex components are stored in separate arrays) and interleaved (real and complex components are stored as a pair in the same array) formats. +@li supports 1D, 2D, and 3D transforms with a batch size that can be greater +than or equal to 1. +@li supports planar (real and complex components are stored in separate arrays) +and interleaved (real and complex components are stored as a pair in the same +array) formats. @li supports lengths that are any combination of powers of 2, 3, 5, and 7. @li supports single and double precision floating point formats. @section IntroFFT Introduction to clFFT -The FFT is an implementation of the Discrete Fourier Transform (DFT) that makes use of symmetries in the FFT definition to reduce the mathematical intensity required from O(\f$N^2\f$) to O(\f$ N \log N\f$) when the sequence length, *N*, is the product of small prime factors. Currently, there is no standard API for FFT routines. Hardware vendors usually provide a set of high-performance FFTs optimized for their systems: no two vendors employ the same interfaces for their FFT routines. clFFT provides a set of FFT routines that are optimized for AMD graphics processors, and that are also functional across CPU and other compute devices. +The FFT is an implementation of the Discrete Fourier Transform (DFT) that makes +use of symmetries in the FFT definition to reduce the mathematical intensity +required from O(\f$N^2\f$) to O(\f$ N \log N\f$) when the sequence length, *N*, +is the product of small prime factors. Currently, there is no standard API for +FFT routines. Hardware vendors usually provide a set of high-performance FFTs +optimized for their systems: no two vendors employ the same interfaces for their +FFT routines. clFFT provides a set of FFT routines that are optimized for AMD +graphics processors, and that are also functional across CPU and other compute +devices. @subsection SupportRadix Supported radices -clFFT supports transform sizes that are powers of 2, 3, 5, and 7. This means that the vector lengths can be a combination of powers of two, three, five, and seven; examples include \f$2^7, 2^1*3^1, 3^2*5^4, 2^2*3^3*5^5\f$, up to the limit that the device can support. +clFFT supports transform sizes that are powers of 2, 3, 5, and 7. This means +that the vector lengths can be a combination of powers of two, three, five, and +seven; examples include \f$2^7, 2^1*3^1, 3^2*5^4, 2^2*3^3*5^5\f$, up to the +limit that the device can support. @subsection SizeLimit Transform size limits -Currently, there is an upper bound on the transform size that the library can support for certain transforms. This limit is \f$2^{24}\f$ for real 1D single precision and \f$2^{22}\f$ for real 1D double precision. +Currently, there is an upper bound on the transform size that the library can +support for certain transforms. This limit is \f$2^{24}\f$ for real 1D single +precision and \f$2^{22}\f$ for real 1D double precision. @subsection EnumDim Dimensionality -clFFT currently supports FFTs of (up to) three dimensions, given by the enum @ref clfftDim. This enum -is a required parameter of @ref clfftCreateDefaultPlan() to create an initial plan, where a plan is the collection of (almost) all the parameters needed to specify an FFT computation. For more information about clFFT plans, see the section \ref clFFTPlans. -Depending on the dimensionality that the client requests, clFFT uses the following formulations to compute the DFT: +clFFT currently supports FFTs of (up to) three dimensions, given by the enum +@ref clfftDim. This enum is a required parameter of @ref +clfftCreateDefaultPlan() to create an initial plan, where a plan is the +collection of (almost) all the parameters needed to specify an FFT computation. +For more information about clFFT plans, see the section \ref clFFTPlans. +Depending on the dimensionality that the client requests, clFFT uses the +following formulations to compute the DFT: @li For a 1D complex DFT \f[ -{\tilde{x}}_j = {{1}\over{scale}}\sum_{k=0}^{n-1}x_k\exp\left({\pm i}{{2\pi jk}\over{n}}\right)\hbox{ for } j=0,1,\ldots,n-1 -\f] -where, \f$x_k\f$ are the complex data to be transformed, \f$\tilde{x}_j\f$ are the transformed data, and the sign \f$\pm\f$ determines the direction of the transform: \f$-\f$ for forward and \f$+\f$ for backward. Note that you must provide the scaling factor. By default, the scale is set to 1 for forward transforms, and \f${{1}\over{N}}\f$ for backward transforms, where *N* is the size of transform. +{\tilde{x}}_j = {{1}\over{scale}}\sum_{k=0}^{n-1}x_k\exp\left({\pm i}{{2\pi +jk}\over{n}}\right)\hbox{ for } j=0,1,\ldots,n-1 \f] where, \f$x_k\f$ are the +complex data to be transformed, \f$\tilde{x}_j\f$ are the transformed data, and +the sign \f$\pm\f$ determines the direction of the transform: \f$-\f$ for +forward and \f$+\f$ for backward. Note that you must provide the scaling factor. +By default, the scale is set to 1 for forward transforms, and +\f${{1}\over{N}}\f$ for backward transforms, where *N* is the size of transform. @li For a 2D complex DFT \f[ -{\tilde{x}}_{jk} = {{1}\over{scale}}\sum_{q=0}^{m-1}\sum_{r=0}^{n-1}x_{rq}\exp\left({\pm i} {{2\pi jr}\over{n}}\right)\exp\left({\pm i}{{2\pi kq}\over{m}}\right) -\f] -for \f$j=0,1,\ldots,n-1\hbox{ and } k=0,1,\ldots,m-1\f$, where, \f$x_{rq}\f$ are the complex data to be transformed, \f$\tilde{x}_{jk}\f$ are the transformed data, and the sign \f$\pm\f$ determines the direction of the transform. By default, the scale is set to 1 for forwards transforms and \f${{1}\over{MN}}\f$ for backwards transforms, where *M* and *N* are the 2D size of the transform. +{\tilde{x}}_{jk} = +{{1}\over{scale}}\sum_{q=0}^{m-1}\sum_{r=0}^{n-1}x_{rq}\exp\left({\pm i} {{2\pi +jr}\over{n}}\right)\exp\left({\pm i}{{2\pi kq}\over{m}}\right) \f] for +\f$j=0,1,\ldots,n-1\hbox{ and } k=0,1,\ldots,m-1\f$, where, \f$x_{rq}\f$ are the +complex data to be transformed, \f$\tilde{x}_{jk}\f$ are the transformed data, +and the sign \f$\pm\f$ determines the direction of the transform. By default, +the scale is set to 1 for forwards transforms and \f${{1}\over{MN}}\f$ for +backwards transforms, where *M* and *N* are the 2D size of the transform. @li For a 3D complex DFT \f[ -\tilde{x}_{jkl} = {{1}\over{scale}}\sum_{s=0}^{p-1}\sum_{q=0}^{m-1}\sum_{r=0}^{n-1} -x_{rqs}\exp\left({\pm i} {{2\pi jr}\over{n}}\right)\exp\left({\pm i}{{2\pi kq}\over{m}}\right)\exp\left({\pm i}{{2\pi ls}\over{p}}\right) -\f] -for \f$j=0,1,\ldots,n-1\hbox{ and } k=0,1,\ldots,m-1\hbox{ and } l=0,1,\ldots,p-1\f$, where \f$x_{rqs}\f$ are the complex data to be transformed, \f$\tilde{x}_{jkl}\f$ are the transformed data, and the sign \f$\pm\f$ determines the direction of the transform. By default, the scale is set to 1 for forward transforms and \f${{1}\over{MNP}}\f$ for backward transforms, where *M*, *N*, and *P* are the 3D size of the transform. +\tilde{x}_{jkl} = +{{1}\over{scale}}\sum_{s=0}^{p-1}\sum_{q=0}^{m-1}\sum_{r=0}^{n-1} +x_{rqs}\exp\left({\pm i} {{2\pi jr}\over{n}}\right)\exp\left({\pm i}{{2\pi +kq}\over{m}}\right)\exp\left({\pm i}{{2\pi ls}\over{p}}\right) \f] for +\f$j=0,1,\ldots,n-1\hbox{ and } k=0,1,\ldots,m-1\hbox{ and } +l=0,1,\ldots,p-1\f$, where \f$x_{rqs}\f$ are the complex data to be transformed, +\f$\tilde{x}_{jkl}\f$ are the transformed data, and the sign \f$\pm\f$ +determines the direction of the transform. By default, the scale is set to 1 for +forward transforms and \f${{1}\over{MNP}}\f$ for backward transforms, where *M*, +*N*, and *P* are the 3D size of the transform. @subsection InitLibrary Setup and Teardown of clFFT -clFFT is initialized by the API @ref clfftSetup(), which must be called before any other API of -clFFT. This allows the library to create resources needed to manage the plans that you create and -destroy. This API also takes a structure @ref clfftInitSetupData() that is initialized by the -client to control the behavior of the library. +clFFT is initialized by the API @ref clfftSetup(), which must be called before +any other API of clFFT. This allows the library to create resources needed to +manage the plans that you create and destroy. This API also takes a structure +@ref clfftInitSetupData() that is initialized by the client to control the +behavior of the library. -After you use the library, the @ref clfftTeardown() method must be called. This function instructs clFFT to release all resources allocated internally, and resets acquired references to any OpenCL objects. +After you use the library, the @ref clfftTeardown() method must be called. This +function instructs clFFT to release all resources allocated internally, and +resets acquired references to any OpenCL objects. @subsection ThreadSafety Thread safety -The clFFT API is designed to be thread-safe. It is safe to create plans from multiple threads and to -destroy those plans in separate threads. Multiple threads can call @ref clfftEnqueueTransform() to place work in a command queue at the same time. clFFT does not provide a single-threaded version of the library. The overhead of the synchronization mechanisms inside a clFFT thread-safe is expected to be minor. - -Currently, you must manage the multi-device operation. You can create OpenCL contexts that are -associated with multiple devices, but clFFT only uses a single device from that context to transform -the data. You can manage a multi-device operation by creating multiple contexts, in which each -context contains a different device; you are responsible for scheduling and partitioning the work +The clFFT API is designed to be thread-safe. It is safe to create plans from +multiple threads and to destroy those plans in separate threads. Multiple +threads can call @ref clfftEnqueueTransform() to place work in a command queue +at the same time. clFFT does not provide a single-threaded version of the +library. The overhead of the synchronization mechanisms inside a clFFT +thread-safe is expected to be minor. + +Currently, you must manage the multi-device operation. You can create OpenCL +contexts that are associated with multiple devices, but clFFT only uses a single +device from that context to transform the data. You can manage a multi-device +operation by creating multiple contexts, in which each context contains a +different device; you are responsible for scheduling and partitioning the work across multiple devices and contexts. @subsection MajorFormat Row major formats -clFFT expects all multi-dimensional input passed to it to be in row-major format. This is compatible -with C-based languages. However, clFFT is very flexible in the organization of the input and output data, and it accepts input data by letting you specify a stride for each dimension. This feature can be used to process data in column major arrays and other non-contiguous data formats. See @ref clfftSetPlanInStride() and +clFFT expects all multi-dimensional input passed to it to be in row-major +format. This is compatible with C-based languages. However, clFFT is very +flexible in the organization of the input and output data, and it accepts input +data by letting you specify a stride for each dimension. This feature can be +used to process data in column major arrays and other non-contiguous data +formats. See @ref clfftSetPlanInStride() and @ref clfftSetPlanOutStride(). @subsection Object OpenCL object creation -Your application must allocate and manage OpenCL objects, such as contexts, *cl_mem* buffers and command queues. All the clFFT interfaces that interact with OpenCL objects take those objects as references through the API. -Specifically, the plan creation function @ref clfftCreateDefaultPlan() takes an OpenCL context as a parameter reference, increments the reference count on that object, and keeps the object alive until the corresponding plan is destroyed by the call @ref clfftDestroyPlan(). +Your application must allocate and manage OpenCL objects, such as contexts, +*cl_mem* buffers and command queues. All the clFFT interfaces that interact with +OpenCL objects take those objects as references through the API. Specifically, +the plan creation function @ref clfftCreateDefaultPlan() takes an OpenCL context +as a parameter reference, increments the reference count on that object, and +keeps the object alive until the corresponding plan is destroyed by the call +@ref clfftDestroyPlan(). @subsection FlushQueue Flushing of command queues -The clFFT API operates asynchronously; with the exception of thread safety locking with multiple -threads, all APIs return immediately. Specifically, the @ref clfftEnqueueTransform() API does not -explicitly flush the command queues that are passed by reference to it. It pushes the transform work onto the command queues and returns the modified queues to the client. The client is free to issue its own blocking logic by using OpenCL synchronization mechanisms or push further work onto the queue to continue processing. +The clFFT API operates asynchronously; with the exception of thread safety +locking with multiple threads, all APIs return immediately. Specifically, the +@ref clfftEnqueueTransform() API does not explicitly flush the command queues +that are passed by reference to it. It pushes the transform work onto the +command queues and returns the modified queues to the client. The client is free +to issue its own blocking logic by using OpenCL synchronization mechanisms or +push further work onto the queue to continue processing. @subsection EnvVariables Environment variables -The clFFT library looks for definition of two environment variables: CLFFT_CACHE_PATH and CLFFT_REQUEST_LIB_NOMEMALLOC. -If the variable CLFFT_CACHE_PATH is defined, the library caches OpenCL binaries. This enables a subsequent run of the application with the same type of transforms to avoid the expensive compilation step. Instead, the stored binaries are loaded and executed. The CLFFT_CACHE_PATH must point to a folder location where the library can store binaries. -The other variable CLFFT_REQUEST_LIB_NOMEMALLOC when defined, requests the library to do all computations in-place and avoid allocating extra device memory whenever possible. This feature is experimental and currently works only for certain types of transforms when the library decomposes the input into square matrices or rectangular matrices with dimensions in the ratio 1:2. Currently, it works for 1D complex transforms of size of powers of 2. +The clFFT library looks for definition of two environment variables: +CLFFT_CACHE_PATH and CLFFT_REQUEST_LIB_NOMEMALLOC. If the variable +CLFFT_CACHE_PATH is defined, the library caches OpenCL binaries. This enables a +subsequent run of the application with the same type of transforms to avoid the +expensive compilation step. Instead, the stored binaries are loaded and +executed. The CLFFT_CACHE_PATH must point to a folder location where the library +can store binaries. The other variable CLFFT_REQUEST_LIB_NOMEMALLOC when +defined, requests the library to do all computations in-place and avoid +allocating extra device memory whenever possible. This feature is experimental +and currently works only for certain types of transforms when the library +decomposes the input into square matrices or rectangular matrices with +dimensions in the ratio 1:2. Currently, it works for 1D complex transforms of +size of powers of 2. @section clFFTPlans clFFT plans -A plan is the collection of (almost) all the parameters needed to specify an FFT computation. -A clFFT plan includes the following parameters: -

    -
  • The OpenCL context that executes the transform -
  • Dimension of the transform (1D, 2D or 3D) -
  • Length or extent of data in each dimension -
  • Number of datasets that are transformed -
  • Precision of the data -
  • Scaling factor to the transformed data -
  • In-place or Out-of-place transform -
  • Format of the input data - interleaved, planar or real -
  • Format of the output data - interleaved, planar or real +A plan is the collection of (almost) all the parameters needed to specify an FFT +computation. A clFFT plan includes the following parameters:
    • The +OpenCL context that executes the transform
    • Dimension of the transform (1D, +2D or 3D)
    • Length or extent of data in each dimension
    • Number of +datasets that are transformed
    • Precision of the data
    • Scaling factor to +the transformed data
    • In-place or Out-of-place transform
    • Format of the +input data - interleaved, planar or real
    • Format of the output data - +interleaved, planar or real
    The clFFT plan does not include the following parameters: @@ -127,8 +192,8 @@ These parameters are specified when the plan is executed. @subsection Default Default plan values -When a new plan is created by calling @ref clfftCreateDefaultPlan(), its parameters are initialized as -follows: +When a new plan is created by calling @ref clfftCreateDefaultPlan(), its +parameters are initialized as follows:
    • Dimensions: as provided by the caller @@ -137,142 +202,217 @@ When a new plan is created by calling @ref clfftCreateDefaultPlan(), its paramet
    • Precision: *CLFFT_SINGLE*
    • Scaling factors:
        -
      1. for the forward transform, the default is 1.0, or no scale factor is applied -
      2. for the reverse transform, the default is 1.0 / P, where P is the product of the FFT lengths +
      3. for the forward transform, the default is 1.0, or no scale factor is +applied
      4. for the reverse transform, the default is 1.0 / P, where P is the +product of the FFT lengths
    • Location: *CLFFT_INPLACE*
    • Input layout: *CLFFT_COMPLEX_INTERLEAVED* -
    • Input strides: the strides of a multidimensional array of the lengths specified, where the data is -compactly stored using the row-major convention +
    • Input strides: the strides of a multidimensional array of the lengths +specified, where the data is compactly stored using the row-major convention
    • Output layout: *CLFFT_COMPLEX_INTERLEAVED*
    • Output strides: same as input strides
    -Writing client programs that depend on these initial values is not recommended. +Writing client programs that depend on these initial values is not +recommended. @subsection EnumLayout Supported memory layouts There are two main types of Discrete Fourier Transform (DFT) in clFFT:
      -
    1. Transformation of complex data - clFFT supports the following two layouts to store complex numbers: -
        -
      • Planar format - where the real and imaginary components are kept in separate arrays: \n - Buffer1: **RRRRR** \n - Buffer2: **IIIII** -
      • Interleaved format - where the real and imaginary components are stored as contiguous pairs: \n - Buffer1: **RIRIRIRIRIRI** +
      • Transformation of complex data - clFFT supports the following two layouts +to store complex numbers:
        • Planar format - where the real and imaginary +components are kept in separate arrays: \n Buffer1: **RRRRR** \n Buffer2: +**IIIII**
        • Interleaved format - where the real and imaginary components are +stored as contiguous pairs: \n Buffer1: **RIRIRIRIRIRI**
        -
      • Transformation of real to complex data and vice versa - clFFT provides enums to define these formats. -For transforms involving real data, there are two possibilities: -
          -
        • Real data being subject to forward FFT transform that results in complex data. -
        • Complex data being subject to backward FFT transform that results in -real data. See the section \ref RealFFT. +
        • Transformation of real to complex data and vice versa - clFFT provides +enums to define these formats. For transforms involving real data, there are two +possibilities:
          • Real data being subject to forward FFT transform that +results in complex data.
          • Complex data being subject to backward FFT +transform that results in real data. See the section \ref RealFFT.
    @subsubsection DistanceStridesandPitches Strides and Distances -For one-dimensional data, if clStrides[0] = strideX = 1, successive elements in the first dimension are stored contiguously in memory. If strideX is an integral value greater than 1, gaps in memory exist between each element of the vectors. -For multi-dimensional data, if clStrides[1] = strideY = LenX for 2 dimensional data and clStrides[2] = strideZ = LenX*LenY for 3 dimensional data, no gaps exist in memory between each element, and all vectors are stored tightly packed in memory. Here, LenX, LenY, and LenZ denote the transform lengths clLengths[0], clLengths[1], and clLengths[2], respectively, which are used to set up the plan. - -By specifying non-default strides, it is possible to process either row-major or column-major arrays. Data can be extracted from arrays of structures. Almost any regular data storage pattern can be accommodated. - -Distance is the amount of memory that exists between corresponding elements in an FFT primitive in a batch. Distance is measured in units of the FFT primitive; complex data measures in complex units, and real data measures in real units. Stride between tightly packed elements is 1 in either case. Typically, one can measure the distance between any two elements in a batch primitive, be it 1D, 2D, or 3D data. For tightly packed data, the distance between FFT primitives is the size of the FFT primitive, such that dist=LenX for 1D data, dist=LenX*LenY for 2D data, and dist=LenX*LenY*LenZ for 3D data. It is possible to set the distance of a plan to be less than the size of the FFT vector; most often 1 for this case. When computing a batch of 1D FFT vectors, if distance == 1, and strideX == length(vector), a transposed output is produced for a batch of 1D vectors. You must verify that the distance and strides are valid (not intersecting); if not valid, undefined results may occur. -A simple example would be to perform a 1D length 4096 on each row of an array of 1024 rows x 4096 columns of values stored in a column-major array, such as a FORTRAN program might provide. (This would be equivalent to a C or C++ program that has an array of 4096 rows x 1024 columns stored in a row-major manner, on which you want to perform a 1-D length 4096 transform on each column.) In this case, specify the strides as [1024, 1]. - -A more complex example would be to compute a 2D FFT for each 64 x 64 subtile of the grid that has an input buffer with a raster grid of 1024 x 1024 monochrome pixel values. Specifying strides allows you to treat each horizontal band of 1024 x 64 pixels as an array of 16 64 x 64 matrixes, and process an entire band with a single call @ref clfftEnqueueTransform(). (Specifying strides is not quite flexible enough to transform the entire grid of this example with a single kernel execution.) It is possible to create a Plan to compute arrays of 64 x 64 2D FFTs, then specify three strides: [1, 1024, 64]. The first stride, 1, indicates that the rows of each matrix are stored consecutively; the second stride, 1024, gives the distance between rows, and the third stride, 64, defines the distance between two matrices. Then call @ref clfftEnqueueTransform() 16 times – once for each horizontal band of pixels. +For one-dimensional data, if clStrides[0] = strideX = 1, successive elements in +the first dimension are stored contiguously in memory. If strideX is an integral +value greater than 1, gaps in memory exist between each element of the vectors. +For multi-dimensional data, if clStrides[1] = strideY = LenX for 2 dimensional +data and clStrides[2] = strideZ = LenX*LenY for 3 dimensional data, no gaps +exist in memory between each element, and all vectors are stored tightly packed +in memory. Here, LenX, LenY, and LenZ denote the transform lengths clLengths[0], +clLengths[1], and clLengths[2], respectively, which are used to set up the plan. + +By specifying non-default strides, it is possible to process either row-major or +column-major arrays. Data can be extracted from arrays of structures. Almost any +regular data storage pattern can be accommodated. + +Distance is the amount of memory that exists between corresponding elements in +an FFT primitive in a batch. Distance is measured in units of the FFT primitive; +complex data measures in complex units, and real data measures in real units. +Stride between tightly packed elements is 1 in either case. Typically, one can +measure the distance between any two elements in a batch primitive, be it 1D, +2D, or 3D data. For tightly packed data, the distance between FFT primitives is +the size of the FFT primitive, such that dist=LenX for 1D data, dist=LenX*LenY +for 2D data, and dist=LenX*LenY*LenZ for 3D data. It is possible to set the +distance of a plan to be less than the size of the FFT vector; most often 1 for +this case. When computing a batch of 1D FFT vectors, if distance == 1, and +strideX == length(vector), a transposed output is produced for a batch of 1D +vectors. You must verify that the distance and strides are valid (not +intersecting); if not valid, undefined results may occur. A simple example would +be to perform a 1D length 4096 on each row of an array of 1024 rows x 4096 +columns of values stored in a column-major array, such as a FORTRAN program +might provide. (This would be equivalent to a C or C++ program that has an array +of 4096 rows x 1024 columns stored in a row-major manner, on which you want to +perform a 1-D length 4096 transform on each column.) In this case, specify the +strides as [1024, 1]. + +A more complex example would be to compute a 2D FFT for each 64 x 64 subtile of +the grid that has an input buffer with a raster grid of 1024 x 1024 monochrome +pixel values. Specifying strides allows you to treat each horizontal band of +1024 x 64 pixels as an array of 16 64 x 64 matrixes, and process an entire band +with a single call @ref clfftEnqueueTransform(). (Specifying strides is not +quite flexible enough to transform the entire grid of this example with a single +kernel execution.) It is possible to create a Plan to compute arrays of 64 x 64 +2D FFTs, then specify three strides: [1, 1024, 64]. The first stride, 1, +indicates that the rows of each matrix are stored consecutively; the second +stride, 1024, gives the distance between rows, and the third stride, 64, defines +the distance between two matrices. Then call @ref clfftEnqueueTransform() 16 +times – once for each horizontal band of pixels. @subsection EnumPrecision Supported precisions in clFFT -Both *CLFFT_SINGLE* and *CLFFT_DOUBLE* precisions are supported by the library for all supported radices. For both these enums the math functions of the host computer are used to produce the sine and cosine tables that are used by the OpenCL kernel. -Both *CLFFT_SINGLE_FAST* and *CLFFT_DOUBLE_FAST* generate faster kernels with reduced accuracy, but are disabled in the current build. -See @ref clfftPrecision, @ref clfftSetPlanPrecision(), and @ref clfftGetPlanPrecision(). +Both *CLFFT_SINGLE* and *CLFFT_DOUBLE* precisions are supported by the library +for all supported radices. For both these enums the math functions of the host +computer are used to produce the sine and cosine tables that are used by the +OpenCL kernel. Both *CLFFT_SINGLE_FAST* and *CLFFT_DOUBLE_FAST* generate faster +kernels with reduced accuracy, but are disabled in the current build. See @ref +clfftPrecision, @ref clfftSetPlanPrecision(), and @ref clfftGetPlanPrecision(). @subsection FftDirection clfftDirection -For complex transforms, the direction of the transform is not baked into the plan; the same plan can be used to specify both forward and backward transforms. To specify the direction, @ref clfftDirection is passed as a parameter into @ref clfftEnqueueTransform(). -For real transforms, the input and output layouts of the plan determine the direction. +For complex transforms, the direction of the transform is not baked into the +plan; the same plan can be used to specify both forward and backward transforms. +To specify the direction, @ref clfftDirection is passed as a parameter into @ref +clfftEnqueueTransform(). For real transforms, the input and output layouts of +the plan determine the direction. @subsection EnumResultLocation In-place and out-of-place transforms -The clFFT API supports both in-place and out-of-place transforms. With in-place transforms, only the input buffers are provided to the @ref clfftEnqueueTransform() API, and the resulting data is written in the same buffer, overwriting the input data. With out-of-place transforms, distinct output buffers are provided to the @ref clfftEnqueueTransform() API, and the input data is preserved. -In-place transforms require that the *cl_mem* objects created by the client application, have both read and write permissions. This is given in the nature of the in-place algorithm. Out-of-place transforms require that the destination buffers have read and write permissions, but input buffers can still be created with read-only permissions. This is a clFFT requirement because internally the algorithms may go back and forth between the destination buffers and internally allocated temp buffers. For out-of-place transforms, clFFT never writes back to input buffers. +The clFFT API supports both in-place and out-of-place transforms. With in-place +transforms, only the input buffers are provided to the @ref +clfftEnqueueTransform() API, and the resulting data is written in the same +buffer, overwriting the input data. With out-of-place transforms, distinct +output buffers are provided to the @ref clfftEnqueueTransform() API, and the +input data is preserved. In-place transforms require that the *cl_mem* objects +created by the client application, have both read and write permissions. This is +given in the nature of the in-place algorithm. Out-of-place transforms require +that the destination buffers have read and write permissions, but input buffers +can still be created with read-only permissions. This is a clFFT requirement +because internally the algorithms may go back and forth between the destination +buffers and internally allocated temp buffers. For out-of-place transforms, +clFFT never writes back to input buffers. @subsection clFFTEff Batches -The efficiency of clFFT is improved by utilizing transforms in batches. Sending as much data as possible in a single transform call leverages the parallel compute capabilities of OpenCL devices (and GPU devices in particular), and minimizes the penalty of transfer overhead. It is best to think of an OpenCL device as a high-throughput, high-latency device. Using a networking analogy as an example, this approach is similar to having a massively high-bandwidth pipe with very high ping response times. If the client is ready to send data to the device for compute, it should be sent in as few API calls as possible and this can be done by batching. clFFT plans have a parameter @ref clfftSetPlanBatchSize() to describe the number of transforms being batched, and another parameter @ref clfftSetPlanDistance() to describe how those batches are laid out and spaced in memory. 1D, 2D, or 3D transforms can be batched. +The efficiency of clFFT is improved by utilizing transforms in batches. Sending +as much data as possible in a single transform call leverages the parallel +compute capabilities of OpenCL devices (and GPU devices in particular), and +minimizes the penalty of transfer overhead. It is best to think of an OpenCL +device as a high-throughput, high-latency device. Using a networking analogy as +an example, this approach is similar to having a massively high-bandwidth pipe +with very high ping response times. If the client is ready to send data to the +device for compute, it should be sent in as few API calls as possible and this +can be done by batching. clFFT plans have a parameter @ref +clfftSetPlanBatchSize() to describe the number of transforms being batched, and +another parameter @ref clfftSetPlanDistance() to describe how those batches are +laid out and spaced in memory. 1D, 2D, or 3D transforms can be batched. @section Outline Using clFFT in a client application -To perform FFT calculations using clFFT, the client program must perform the following tasks: -
      -
    • Initialize the library by calling @ref clfftSetup().
    • -
    • For each distinct type of FFT needed: -
        -
      1. Create an FFT Plan object. - To create an FFT Plan object, do either of the following. -
          -
        • Call the factory function @ref clfftCreateDefaultPlan() and specify the value - of the most fundamental parameters, such as plHandle, context, dim, and - clLengths, while other parameters assume default values. The - OpenCL context must be provided when the plan is created; it cannot be - changed.

        • Or -
        • Call @ref clfftCopyPlan().
        • -
        - Note: In both the cases, the function returns an opaque handle to the plan - object. -
      2. Complete the specification of all the Plan parameters by calling various parameter-setting - functions that have the prefix *clfftSet*.
      3. -
      4. Optionally, "bake" or finalize the plan by calling @ref clfftBakePlan() function. This signals - the library the end of the specification phase, and causes it to generate and compile the - exact OpenCL kernels that perform the specified FFT on the provided OpenCL device. - At this point, all performance-enhancing optimizations are applied, possibly including - executing benchmark kernels on the OpenCL device context to maximize the runtime - performance.

        -Although the previous step is optional, it is recommended to use it so that you can -have control on when to do this work. Usually, this time consuming step is done when the application is initialized. If you do not call @ref clfftBakePlan(), this work is done during the first call of @ref clfftEnqueueTransform(). -
      5. -
      - -
    • Execute the OpenCL FFT kernels as many times as needed.
    • -
        -
      1. Call @ref clfftEnqueueTransform(). At this point, specify whether you want to - execute a forward or reverse transform; also, provide the OpenCL *cl_mem* - handles for the input buffer(s), output buffer(s)--unless you want the transformed - data to overwrite the input buffers, and (optionally) scratch buffer. - @ref clfftEnqueueTransform() performs one or more calls to the OpenCL function - clEnqueueNDRangeKernel. Like clEnqueueNDRangeKernel, @ref - clfftEnqueueTransform() is a non-blocking call. The commands to execute the FFT - compute kernel(s) are added to the OpenCL context queue to be executed - asynchronously. - An OpenCL event handle is returned to the caller. If multiple NDRangeKernel - operations are queued, the final event handle is returned. -
      2. -
      3. Add any application OpenCL tasks to the OpenCL context queue. For example, if the next step in the application process is to apply a filter to the transformed data, the - application calls clEnqueueNDRangeKernel, and specifies its output buffer(s) as the - input to the filter kernel, and provides the transform's event handle to ensure - proper synchronization.
      4. -
      5. If the application accessed the transformed data directly, it calls one of the OpenCL - functions for synchronizing the host computer execution with the OpenCL device - (for example: clFinish()).
      6. -
      -
    • Terminate the library by calling @ref clfftTeardown(). +To perform FFT calculations using clFFT, the client program must perform the +following tasks:
      • Initialize the library by calling @ref clfftSetup(). +
      • For each distinct type of FFT needed:
        1. Create an FFT Plan +object. To create an FFT Plan object, do either of the following.
          • Call +the factory function @ref clfftCreateDefaultPlan() and specify the value of the +most fundamental parameters, such as plHandle, context, dim, and clLengths, +while other parameters assume default values. The OpenCL context must be +provided when the plan is created; it cannot be changed.

          • Or +
          • Call @ref clfftCopyPlan().
          • +
          + Note: In both the cases, the function returns an +opaque handle to the plan object.
        2. Complete the specification of all the +Plan parameters by calling various parameter-setting functions that have the +prefix *clfftSet*.
        3. Optionally, "bake" or finalize the plan by calling +@ref clfftBakePlan() function. This signals the library the end of the +specification phase, and causes it to generate and compile the exact OpenCL +kernels that perform the specified FFT on the provided OpenCL device. At this +point, all performance-enhancing optimizations are applied, possibly including + executing benchmark kernels on the OpenCL device context +to maximize the runtime performance.

          Although the previous step is +optional, it is recommended to use it so that you can have control on when to do +this work. Usually, this time consuming step is done when the application is +initialized. If you do not call @ref clfftBakePlan(), this work is done during +the first call of @ref clfftEnqueueTransform(). +
        4. +
        + +
      • Execute the OpenCL FFT kernels as many times as needed.
      • +
          +
        1. Call @ref clfftEnqueueTransform(). At this point, specify +whether you want to execute a forward or reverse transform; also, provide the +OpenCL *cl_mem* handles for the input buffer(s), output buffer(s)--unless you +want the transformed data to overwrite the input buffers, and (optionally) +scratch buffer. + @ref clfftEnqueueTransform() performs one or more calls +to the OpenCL function clEnqueueNDRangeKernel. Like clEnqueueNDRangeKernel, @ref + clfftEnqueueTransform() is a non-blocking +call. The commands to execute the FFT compute kernel(s) are added to the OpenCL +context queue to be executed asynchronously. An OpenCL event handle is returned +to the caller. If multiple NDRangeKernel operations are queued, the final event +handle is returned. +
        2. +
        3. Add any application OpenCL tasks to the OpenCL context +queue. For example, if the next step in the application +process is to apply a filter to the transformed data, the application calls +clEnqueueNDRangeKernel, and specifies its output buffer(s) as the input to the +filter kernel, and provides the transform's event handle to ensure proper +synchronization.
        4. If the application accessed the transformed data +directly, it calls one of the OpenCL functions for synchronizing the host +computer execution with the OpenCL device (for example: clFinish()).
        5. +
        +
      • Terminate the library by calling @ref clfftTeardown().
      @section RealFFT FFTs of real data -When real data is subject to DFT transformation, the resulting complex output data follows a special property. About half of the output is redundant because they are complex conjugates of the other half. This is called the Hermitian redundancy. So, for space and performance considerations, it is only necessary to store the non-redundant part of the data. Most FFT libraries use this property to offer specific storage layouts for FFTs involving real data. clFFT provides three enumerated types to deal with real data FFTs: -
        -
      • *CLFFT_REAL* -
      • *CLFFT_HERMITIAN_INTERLEAVED* -
      • *CLFFT_HERMITIAN_PLANAR* +When real data is subject to DFT transformation, the resulting complex output +data follows a special property. About half of the output is redundant because +they are complex conjugates of the other half. This is called the Hermitian +redundancy. So, for space and performance considerations, it is only necessary +to store the non-redundant part of the data. Most FFT libraries use this +property to offer specific storage layouts for FFTs involving real data. clFFT +provides three enumerated types to deal with real data FFTs:
        • +*CLFFT_REAL*
        • *CLFFT_HERMITIAN_INTERLEAVED*
        • *CLFFT_HERMITIAN_PLANAR*
        -The *CLFFT_REAL* enum specifies that the data is purely real. This can be used to feed real input or get back real output. The *CLFFT_HERMITIAN_INTERLEAVED* and *CLFFT_HERMITIAN_PLANAR* enums are similar to the corresponding full complex enums in the way they store real and imaginary components, but store only about half of the complex output. Client applications can do just a forward transform and analyze the output or they can process the output and do a backward transform to get back real data. This is illustrated in the following figure. +The *CLFFT_REAL* enum specifies that the data is purely real. This can be used +to feed real input or get back real output. The *CLFFT_HERMITIAN_INTERLEAVED* +and *CLFFT_HERMITIAN_PLANAR* enums are similar to the corresponding full complex +enums in the way they store real and imaginary components, but store only about +half of the complex output. Client applications can do just a forward transform +and analyze the output or they can process the output and do a backward +transform to get back real data. This is illustrated in the following figure. @image html realfft_fwdinv.jpg "Forward and Backward Transform Processes" -Let us consider a 1D real FFT of length N. The full output looks as shown in following figure. +Let us consider a 1D real FFT of length N. The full output looks as shown in +following figure. @image html realfft_1dlen.jpg "1D Real FFT of Length N" -Here, C* denotes the complex conjugate. Since the values at indices greater than N/2 can be deduced from the first half of the array, clFFT stores data only up to the index N/2. This means that the output contains only 1 + N/2 complex elements, where the division N/2 is rounded down. Examples for even -and odd lengths are given below. +Here, C* denotes the complex conjugate. Since the values at indices greater than +N/2 can be deduced from the first half of the array, clFFT stores data only up +to the index N/2. This means that the output contains only 1 + N/2 complex +elements, where the division N/2 is rounded down. Examples for even and odd +lengths are given below. Example for N = 8 is shown in following figure. @@ -283,34 +423,49 @@ Example for N = 7 is shown in following figure. @image html realfft_ex_n7.jpg "Example for N = 7" -For length 8, only (1 + 8/2) = 5 of the output complex numbers are stored, with the index ranging from 0 through 4. Similarly for length 7, only (1 + 7/2) = 4 of the output complex numbers are stored, with the index ranging from 0 through 3. -For 2D and 3D FFTs, the FFT length along the least dimension is used to compute the (1 + N/2) value. This is because the FFT along the least dimension is computed first and is logically a real-to-hermitian transform. The FFTs along other dimensions are computed afterwards; they are simply 'complex-to-complex' transforms. For example, assuming clLengths[2] is used to set up a 2D real FFT, let N1 = clLengths[1], and N0 = clLengths[0]. The output FFT has N1*(1 + N0/2) complex elements. Similarly, for a 3D FFT with clLengths[3] and N2 = clLengths[2], N1 = clLengths[1], and N0 = clLengths[0], the output has N2*N1*(1 + N0/2) complex elements. +For length 8, only (1 + 8/2) = 5 of the output complex numbers are stored, with +the index ranging from 0 through 4. Similarly for length 7, only (1 + 7/2) = 4 +of the output complex numbers are stored, with the index ranging from 0 +through 3. For 2D and 3D FFTs, the FFT length along the least dimension is used +to compute the (1 + N/2) value. This is because the FFT along the least +dimension is computed first and is logically a real-to-hermitian transform. The +FFTs along other dimensions are computed afterwards; they are simply +'complex-to-complex' transforms. For example, assuming clLengths[2] is used to +set up a 2D real FFT, let N1 = clLengths[1], and N0 = clLengths[0]. The output +FFT has N1*(1 + N0/2) complex elements. Similarly, for a 3D FFT with +clLengths[3] and N2 = clLengths[2], N1 = clLengths[1], and N0 = clLengths[0], +the output has N2*N1*(1 + N0/2) complex elements. @subsection RealModes Supported Modes Out-of-place transforms:
          -
        • *CLFFT_REAL* to *CLFFT_HERMITIAN_INTERLEAVED* -
        • *CLFFT_REAL* to *CLFFT_HERMITIAN_PLANAR* -
        • *CLFFT_HERMITIAN_INTERLEAVED* to *CLFFT_REAL* -
        • *CLFFT_ CLFFT_HERMITIAN_PLANAR* to *CLFFT_REAL* +
        • *CLFFT_REAL* to *CLFFT_HERMITIAN_INTERLEAVED* +
        • *CLFFT_REAL* to *CLFFT_HERMITIAN_PLANAR* +
        • *CLFFT_HERMITIAN_INTERLEAVED* to *CLFFT_REAL* +
        • *CLFFT_ CLFFT_HERMITIAN_PLANAR* to *CLFFT_REAL*
        In-place transforms:
          -
        • *CLFFT_REAL* to *CLFFT_HERMITIAN_INTERLEAVED* -
        • *CLFFT_HERMITIAN_INTERLEAVED* to *CLFFT_REAL* +
        • *CLFFT_REAL* to *CLFFT_HERMITIAN_INTERLEAVED* +
        • *CLFFT_HERMITIAN_INTERLEAVED* to *CLFFT_REAL*
        @subsection ExplicitStrides Setting strides -The library currently requires you to explicitly set input and output strides for real transforms. See the following examples to understand what values to use for input and output strides under different scenarios. These examples show typical usages, but you can allocate the buffers and layout data according to your need. +The library currently requires you to explicitly set input and output +strides for real transforms. See the following examples to understand what +values to use for input and output strides under different scenarios. These +examples show typical usages, but you can allocate the buffers and layout data +according to your need. @subsection RealExamples Examples -The following pages provide figures and examples to explain in detail the real FFT features of this library. +The following pages provide figures and examples to explain in detail the real +FFT features of this library. @image html realfft_expl_01.jpg "1D FFT - Real to Hermitian" @image html realfft_expl_02.jpg "1D FFT - Real to Hermitian, Example 1" @@ -323,102 +478,167 @@ The following pages provide figures and examples to explain in detail the real F @section Callbacks clFFT Callbacks -The callback feature of clFFT has the ability to invoke user provided OpenCLâ„¢ inline functions to pre-process or post-process data from within the FFT kernel. The inline OpenCL callback function is passed as a string to the library. It is then incorporated into the generated FFT kernel. This eliminates the need for an additional kernel launch to carry out the pre/post processing tasks, thus improving overall performance. -There are 2 types of callback; Pre-callback and Post-callback. Pre-callback invokes user callback function to perform custom pre-processing of the input data before FFT is executed. Post-callback invokes user callback function to perform custom post-processing of the output data after FFT is executed. +The callback feature of clFFT has the ability to invoke user provided OpenCLâ„¢ +inline functions to pre-process or post-process data from within the FFT kernel. +The inline OpenCL callback function is passed as a string to the library. It is +then incorporated into the generated FFT kernel. This eliminates the need for an +additional kernel launch to carry out the pre/post processing tasks, thus +improving overall performance. There are 2 types of callback; Pre-callback and +Post-callback. Pre-callback invokes user callback function to perform custom +pre-processing of the input data before FFT is executed. Post-callback invokes +user callback function to perform custom post-processing of the output data +after FFT is executed. @subsection CallbackWorkflow Callback Workflow The workflow of FFT execution using callback feature of clFFT is as follows:
          -
        1. Create the clFFT Plan and initialize the standard clFFT parameters. -
        2. Use @ref clfftSetPlanCallback() API to register the callback function with library - @code - clfftStatus clfftSetPlanCallback(clfftPlanHandle plHandle, - const char* funcName, - const char* funcString, - int localMemSize, - clfftCallbackType callbackType, - void *userdata, - int numUserdataBuffers) - @endcode - The library uses the arguments passed to this API, including callback function string, to stitch the callback code into the generated FFT kernel. The arguments for clfftSetPlanCallback are -
            -
          • clFFT plan handle -
          • Name of the callback function -
          • Callback function as character array; the character array can include custom datatype declaration if any custom type is used by callback function -
          • Size of local memory requested by callback, if any, in bytes -
          • Type of callback: ‘PRECALLBACK’ or ‘POSTCALLBACK’; this is an enumerator -
          • Supplementary user data, if any, used by callback function -
          • Number of user data buffers; the library currently supports only one user data buffer per callback registration -
          - Multiple callback registration calls to the same type of callback result in overwriting the previously registered callback function -
        3. Invoke Bake Plan step - Library inserts the callback code into the main FFT kernel during bake plan and compiles it. If there are any compilation errors caused by syntax or incompatible callback function prototype, the library reports failure. -
        4. Enqueue clFFT transform +
        5. Create the clFFT Plan and initialize the standard clFFT parameters. +
        6. Use @ref clfftSetPlanCallback() API to register the callback +function with library + @code + clfftStatus clfftSetPlanCallback(clfftPlanHandle plHandle, + const char* funcName, + const char* funcString, + int localMemSize, + clfftCallbackType callbackType, + void *userdata, + int numUserdataBuffers) + @endcode + The library uses the arguments passed to this API, including +callback function string, to stitch the callback code into the generated FFT +kernel. The arguments for clfftSetPlanCallback are
          • clFFT plan handle +
          • Name of the callback function +
          • Callback function as character array; the character +array can include custom datatype declaration if any custom type is used by +callback function
          • Size of local memory requested by callback, if any, in +bytes
          • Type of callback: ‘PRECALLBACK’ or ‘POSTCALLBACK’; this is an +enumerator
          • Supplementary user data, if any, used by callback function
          • +Number of user data buffers; the library currently supports only one user data +buffer per callback registration +
          + Multiple callback registration calls to the same type of +callback result in overwriting the previously registered callback function
        7. +Invoke Bake Plan step Library inserts the callback code into the main FFT kernel +during bake plan and compiles it. If there are any compilation errors caused by +syntax or incompatible callback function prototype, the library reports failure. +
        8. Enqueue clFFT transform
        -The caller is responsible to provide a callback function that matches the function prototype based on the type of -callback(pre/post), type of transform(real/complex) and whether LDS is used. The bake plan step checks the function prototype. +The caller is responsible to provide a callback function that matches the +function prototype based on the type of callback(pre/post), type of +transform(real/complex) and whether LDS is used. The bake plan step checks the +function prototype. @subsection CallbackFunctionPrototype Callback Function Prototypes -clFFT expects the callback function to be of a specific prototype depending on the type of callback(pre/post), type of transform(real/complex) and whether LDS is used. These are as follows: +clFFT expects the callback function to be of a specific prototype depending on +the type of callback(pre/post), type of transform(real/complex) and whether LDS +is used. These are as follows: @subsubsection PrecallbackProtyotype Pre-callback Prototypes FFT Type | Function Prototype ----------------------------------------| ------------- -C2C/C2R – Interleaved Single Precision | Without LDS
        float2 ( __global void *input, uint inoffset, __global void *userdata)
        With LDS
        float2 ( __global void *input, uint inoffset, __global void *userdata, __local void *localmem) -C2C/C2R – Interleaved Double Precision | Without LDS
        double2 ( __global void *input, uint inoffset, __global void *userdata)
        With LDS
        double2 ( __global void *input, uint inoffset, __global void *userdata, __local void *localmem) -C2C – Planar Single Precision | Without LDS
        float2 ( __global void *inputRe, __global void *inputIm, uint inoffset, __global void *userdata)
        With LDS
        float2 ( __global void *inputRe, __global void *inputIm, int inoffset, __global void *userdata, __local void *localmem) -C2C – Planar Double Precision | Without LDS
        double2 ( __global void *inputRe, __global void *inputIm, uint inoffset, __global void *userdata)
        With LDS
        double2 ( __global void *inputRe, __global void *inputIm, uint inoffset, __global void *userdata, __local void *localmem) -R2C Single Precision | Without LDS
        float ( __global void *input, uint inoffset, __global void *userdata)
        With LDS
        float ( __global void *input, uint inoffset, __global void *userdata, __local void *localmem) -R2C Double Precision | Without LDS
        double ( __global void *input, uint inoffset, __global void *userdata)
        With LDS
        double ( __global void *input, uint inoffset, __global void *userdata, __local void *localmem) +C2C/C2R – Interleaved Single Precision | Without LDS
        float2 + ( __global void *input, uint inoffset, __global void +*userdata)
        With LDS
        float2 ( __global void +*input, uint inoffset, __global void *userdata, __local void *localmem) C2C/C2R +– Interleaved Double Precision | Without LDS
        double2 +( __global void *input, uint inoffset, __global void *userdata)
        With LDS +
        double2 ( __global void *input, uint inoffset, +__global void *userdata, __local void *localmem) C2C – Planar Single Precision +| Without LDS
        float2 ( __global void *inputRe, +__global void *inputIm, uint inoffset, __global void *userdata)
        With LDS +
        float2 ( __global void *inputRe, __global void +*inputIm, int inoffset, __global void *userdata, __local void *localmem) C2C – +Planar Double Precision | Without LDS
        double2 + ( __global void *inputRe, __global void *inputIm, uint +inoffset, __global void *userdata)
        With LDS
        double2 + ( __global void *inputRe, __global void *inputIm, uint +inoffset, __global void *userdata, __local void *localmem) R2C Single Precision +| Without LDS
        float ( __global void *input, uint +inoffset, __global void *userdata)
        With LDS
        float +( __global void *input, uint inoffset, __global void *userdata, __local void +*localmem) +R2C Double Precision | Without LDS
        double ( __global void *input, uint inoffset, __global +void *userdata)
        With LDS
        double ( __global +void *input, uint inoffset, __global void *userdata, __local void *localmem) Parameters
          -
        • \c input : The base pointer of the input buffer for R2C and Interleaved C2C/C2R transforms -
        • \c inputRe : The base pointer of the “Real†input buffer for Planar C2C transforms -
        • \c inputIm : The base pointer of the “Imaginary†part input buffer for Planar C2C transforms -
        • \c inoffset : Index of the current element of the input buffer from the start -
        • \c userdata : Buffer containing optional caller specified data. The userdata pointer is useful - for passing any supplementary data to the callback function. For example, buffer having convolution - filter data or any scalar value. The userdata can be of any custom data type/structure, in which case, - you have to declare the custom data type and include it along with the callback function string.
        • -
        • \c localmem : Pointer to local memory. This memory is allocated by library based on the size you specify - and is subjected to local memory availability.
        • +
        • \c input : The base pointer of the input buffer for R2C and +Interleaved C2C/C2R transforms
        • \c inputRe : The base pointer of the “Real†+input buffer for Planar C2C transforms
        • \c inputIm : The base pointer of the +“Imaginary†part input buffer for Planar C2C transforms
        • \c inoffset : Index +of the current element of the input buffer from the start
        • \c userdata : +Buffer containing optional caller specified data. The userdata pointer is useful + for passing any supplementary data to the callback function. For +example, buffer having convolution filter data or any scalar value. The userdata +can be of any custom data type/structure, in which case, you have to declare the +custom data type and include it along with the callback function string.
        • +
        • \c localmem : Pointer to local memory. This memory is allocated by +library based on the size you specify and is subjected to local memory +availability.
        -For Planar C2C, the return type of callback is a vector (float2/double2) that contains the Real -and Imaginary elements as computed in the callback. +For Planar C2C, the return type of callback is a vector (float2/double2) that +contains the Real and Imaginary elements as computed in the callback. @subsubsection PostcallbackProtyotype Post-callback Prototypes FFT Type | Function Prototype ----------------------------------------| ------------------ -C2C/R2C – Interleaved Single Precision | Without LDS
        void ( __global void *output, uint outoffset, __global void *userdata, float2 fftoutput)
        With LDS
        void ( __global void *output, uint outoffset, __global void *userdata, float2 fftoutput, __local void *localmem) -C2C/R2C – Interleaved Double Precision | Without LDS
        void ( __global void *output, uint outoffset, __global void *userdata, double2 fftoutput)
        With LDS
        void ( __global void *output, uint outoffset, __global void *userdata, double2 fftoutput, __local void *localmem) -C2C/R2C – Planar Single Precision | Without LDS
        void ( __global void *outputRe, __global void *outputIm, uint outoffset, __global void *userdata, float fftoutputRe, float fftoutputIm)
        With LDS
        void ( __global void *outputRe, __global void *outputIm, uint outoffset, __global void *userdata, float fftoutputRe, float fftoutputIm, __local void *localmem) -C2C/R2C – Planar Double Precision | Without LDS
        void ( __global void *outputRe, __global void *outputIm, uint outoffset, __global void *userdata, double fftoutputRe, double fftoutputIm)
        With LDS
        void ( __global void *outputRe, __global void *outputIm, uint outoffset, __global void *userdata, double fftoutputRe, double fftoutputIm, __local void *localmem) -C2R Single Precision | Without LDS
        void ( __global void *output, uint outoffset, __global void *userdata, float fftoutput)
        With LDS
        void ( __global void *output, uint outoffset, __global void *userdata, float fftoutput, __local void *localmem) -C2R Double Precision | Without LDS
        void ( __global void *output, uint outoffset, __global void *userdata, double fftoutput)
        With LDS
        void ( __global void *output, uint outoffset, __global void *userdata, double fftoutput, __local void *localmem) +C2C/R2C – Interleaved Single Precision | Without LDS
        void + ( __global void *output, uint outoffset, __global void +*userdata, float2 fftoutput)
        With LDS
        void ( +__global void *output, uint outoffset, __global void *userdata, float2 +fftoutput, __local void *localmem) C2C/R2C – Interleaved Double Precision | +Without LDS
        void ( __global void *output, uint +outoffset, __global void *userdata, double2 fftoutput)
        With LDS
        void ( __global void *output, uint outoffset, __global +void *userdata, double2 fftoutput, __local void *localmem) C2C/R2C – Planar +Single Precision | Without LDS
        void ( +__global void *outputRe, __global void *outputIm, uint outoffset, __global void +*userdata, float fftoutputRe, float fftoutputIm)
        With LDS
        void + ( __global void *outputRe, __global void *outputIm, uint +outoffset, __global void *userdata, float fftoutputRe, float fftoutputIm, +__local void *localmem) C2C/R2C – Planar Double Precision | +Without LDS
        void ( __global void *outputRe, __global +void *outputIm, uint outoffset, __global void *userdata, double fftoutputRe, +double fftoutputIm)
        With LDS
        void ( __global +void *outputRe, __global void *outputIm, uint outoffset, __global void +*userdata, double fftoutputRe, double fftoutputIm, __local void *localmem) C2R +Single Precision | Without LDS
        void + ( __global void *output, uint outoffset, __global void +*userdata, float fftoutput)
        With LDS
        void ( +__global void *output, uint outoffset, __global void *userdata, float fftoutput, +__local void *localmem) C2R Double Precision +| Without LDS
        void ( __global void *output, uint +outoffset, __global void *userdata, double fftoutput)
        With LDS
        void + ( __global void *output, uint outoffset, __global void +*userdata, double fftoutput, __local void *localmem) Parameters
          -
        • \c output : The base pointer of the output buffer for C2R and Interleaved R2C/C2C transforms -
        • \c outputRe : The base pointer of the “Real†output buffer for Planar R2C/C2C transforms -
        • \c outputIm : The base pointer of the “Imaginary†part output buffer for Planar R2C/C2C transforms -
        • \c outoffset : Index of the current element of the output buffer from the start -
        • \c userdata : Buffer containing optional caller specified data. The userdata pointer is useful - for passing any supplementary data to the callback function. For example, buffer having convolution - filter data or any scalar value. The userdata can be of any custom data type/structure, in which case, - you have to declare the custom data type and include it along with the callback function string.
        • -
        • \c fftoutput : The result computed by clFFT for the element corresponding to outoffset argument -
        • \c localmem : Pointer to local memory. This memory is allocated by library based on the size you specify - and is subject to local memory availability.
        • +
        • \c output : The base pointer of the output buffer for C2R and +Interleaved R2C/C2C transforms
        • \c outputRe : The base pointer of the “Real†+output buffer for Planar R2C/C2C transforms
        • \c outputIm : The base pointer +of the “Imaginary†part output buffer for Planar R2C/C2C transforms
        • \c +outoffset : Index of the current element of the output buffer from the start +
        • \c userdata : Buffer containing optional caller specified data. The +userdata pointer is useful for passing any supplementary data to the callback +function. For example, buffer having convolution filter data or any scalar +value. The userdata can be of any custom data type/structure, in which case, you +have to declare the custom data type and include it along with the callback +function string.
        • \c fftoutput : The result computed by clFFT for the +element corresponding to outoffset argument
        • \c localmem : Pointer to local +memory. This memory is allocated by library based on the size you specify and is +subject to local memory availability.
        @subsection SampleCallbackCode Sample Callback Code @@ -431,38 +651,42 @@ const char* precallbackstr = "float2 pre_mulval(__global void* input, \n uint inoffset, \n __global void* userdata, \n __local void* localmem) \n - { \n - float scalar = *((__global float*)userdata + inoffset); \n - float2 ret = *((__global float2*)input + inoffset) * scalar; \n - return ret; \n - } \n"; + { \n float scalar = *((__global float*)userdata ++ inoffset); \n float2 ret = *((__global float2*)input + inoffset) * +scalar; \n return ret; \n } +\n"; const char* postcallbackstr = "void post_mulval(__global void* output, \n uint outoffset, \n __global void* userdata, \n - float2 fftoutput, \n + float2 +fftoutput, \n __local void* localmem) \n - { \n - float scalar = *((__global float*)userdata + outoffset); \n - *((__global float2*)output + outoffset) = fftoutput * scalar; \n - } \n"; - + { \n float scalar = *((__global float*)userdata ++ outoffset); \n + *((__global float2*)output + outoffset) = +fftoutput * scalar; \n } \n"; + //************************************************************************** //* Step 2 : Initialize arguments, if any, required by the callback. //************************************************************************** int h_preuserdata[N] = { }; -cl_mem preuserdata = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(float) * N, (void*)h_preuserdata, NULL); +cl_mem preuserdata = clCreateBuffer(context, CL_MEM_READ_ONLY | +CL_MEM_COPY_HOST_PTR, sizeof(float) * N, (void*)h_preuserdata, NULL); int h_postuserdata[N] = { }; -cl_mem postuserdata = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(float) * N, (void*)h_postuserdata, NULL); +cl_mem postuserdata = clCreateBuffer(context, CL_MEM_READ_ONLY | +CL_MEM_COPY_HOST_PTR, sizeof(float) * N, (void*)h_postuserdata, NULL); //************************************************************************** //* Step 3 : Register the callback. //************************************************************************** -status = clfftSetPlanCallback(plan_handle, "pre_mulval", precallbackstr, 0, PRECALLBACK, &preuserdata, 1); +status = clfftSetPlanCallback(plan_handle, "pre_mulval", precallbackstr, 0, +PRECALLBACK, &preuserdata, 1); -status = clfftSetPlanCallback(plan_handle, "post_mulval", postcallbackstr, 0, POSTCALLBACK, &postuserdata, 1); +status = clfftSetPlanCallback(plan_handle, "post_mulval", postcallbackstr, 0, +POSTCALLBACK, &postuserdata, 1); //************************************************************************** //* Step 4 : Bake plan and enqueue transform. @@ -470,17 +694,26 @@ status = clfftSetPlanCallback(plan_handle, "post_mulval", postcallbackstr, 0, PO status = clfftBakePlan( plan_handle, 1, &queue, NULL, NULL ); status = clfftEnqueueTransform( plan_handle, dir, 1, &queue, 0, NULL, &outEvent, - &input_buffers[ 0 ], buffersOut, clMedBuffer ); + &input_buffers[ 0 ], buffersOut, clMedBuffer ); @endcode @subsection CallbackNotes Important Notes on Callback
          -
        1. The caller is responsible to provide a callback function in string form that matches the function prototype based on the type of callback, type of transform(real/complex), and whether LDS is used. -
        2. clFFT considers the value returned by the pre-callback function as the new value of the input at the index corresponding to the *inoffset* argument. -
        3. Callback function can request for local memory for its own use. If the requested amount of local memory is available on the device, clFFT passes a pointer to the local memory when it invokes the callback function. -
        4. clFFT may invoke the FFT kernels several times depending on the input parameters. However, the pre-callback function provided by the caller is invoked only once for each point in the input. Similarly, it calls the post-callback function only once for each point in the output. -
        5. If clFFT is implementing a given FFT in multiple phases, it calls the pre-callback function only from the first phase kernel. Similarly, it calls the post-callback function only from the last phase kernel. +
        6. The caller is responsible to provide a callback function in string +form that matches the function prototype based on the type of callback, type of +transform(real/complex), and whether LDS is used.
        7. clFFT considers the value +returned by the pre-callback function as the new value of the input at the index +corresponding to the *inoffset* argument.
        8. Callback function can request for +local memory for its own use. If the requested amount of local memory is +available on the device, clFFT passes a pointer to the local memory when it +invokes the callback function.
        9. clFFT may invoke the FFT kernels several +times depending on the input parameters. However, the pre-callback function +provided by the caller is invoked only once for each point in the input. +Similarly, it calls the post-callback function only once for each point in the +output.
        10. If clFFT is implementing a given FFT in multiple phases, it calls +the pre-callback function only from the first phase kernel. Similarly, it calls +the post-callback function only from the last phase kernel.
        */ diff --git a/src/library/md5sum.c b/src/library/md5sum.c index 5ba6d7cc..44b2f391 100644 --- a/src/library/md5sum.c +++ b/src/library/md5sum.c @@ -40,14 +40,13 @@ #endif #include "md5sum.h" - + #ifndef HAVE_OPENSSL - -#include -#include + #include - - +#include +#include + /* * The basic MD5 functions. * @@ -55,20 +54,20 @@ * architectures that lack an AND-NOT instruction, just like in Colin Plumb's * implementation. */ -#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) -#define H(x, y, z) (((x) ^ (y)) ^ (z)) -#define H2(x, y, z) ((x) ^ ((y) ^ (z))) -#define I(x, y, z) ((y) ^ ((x) | ~(z))) - +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) +#define H(x, y, z) (((x) ^ (y)) ^ (z)) +#define H2(x, y, z) ((x) ^ ((y) ^ (z))) +#define I(x, y, z) ((y) ^ ((x) | ~(z))) + /* * The MD5 transformation for all four rounds. */ -#define STEP(f, a, b, c, d, x, t, s) \ - (a) += f((b), (c), (d)) + (x) + (t); \ - (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ - (a) += (b); - +#define STEP(f, a, b, c, d, x, t, s) \ + (a) += f((b), (c), (d)) + (x) + (t); \ + (a) = (((a) << (s)) | (((a)&0xffffffff) >> (32 - (s)))); \ + (a) += (b); + /* * SET reads 4 input bytes in little-endian byte order and stores them * in a properly aligned word in host byte order. @@ -78,240 +77,230 @@ * doesn't work. */ #if defined(__i386__) || defined(__x86_64__) || defined(__vax__) -#define SET(n) \ - (*(MD5_u32plus *)&ptr[(n) * 4]) -#define GET(n) \ - SET(n) +#define SET(n) (*(MD5_u32plus *)&ptr[(n)*4]) +#define GET(n) SET(n) #else -#define SET(n) \ - (ctx->block[(n)] = \ - (MD5_u32plus)ptr[(n) * 4] | \ - ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ - ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ - ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) -#define GET(n) \ - (ctx->block[(n)]) +#define SET(n) \ + (ctx->block[(n)] = (MD5_u32plus)ptr[(n)*4] | \ + ((MD5_u32plus)ptr[(n)*4 + 1] << 8) | \ + ((MD5_u32plus)ptr[(n)*4 + 2] << 16) | \ + ((MD5_u32plus)ptr[(n)*4 + 3] << 24)) +#define GET(n) (ctx->block[(n)]) #endif - + /* * This processes one or more 64-byte data blocks, but does NOT update * the bit counters. There are no alignment requirements. */ -static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) -{ - const unsigned char *ptr; - MD5_u32plus a, b, c, d; - MD5_u32plus saved_a, saved_b, saved_c, saved_d; - - ptr = (const unsigned char *)data; - - a = ctx->a; - b = ctx->b; - c = ctx->c; - d = ctx->d; - - do { - saved_a = a; - saved_b = b; - saved_c = c; - saved_d = d; - -/* Round 1 */ - STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) - STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) - STEP(F, c, d, a, b, SET(2), 0x242070db, 17) - STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) - STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) - STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) - STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) - STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) - STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) - STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) - STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) - STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) - STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) - STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) - STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) - STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) - -/* Round 2 */ - STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) - STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) - STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) - STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) - STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) - STEP(G, d, a, b, c, GET(10), 0x02441453, 9) - STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) - STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) - STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) - STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) - STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) - STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) - STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) - STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) - STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) - STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) - -/* Round 3 */ - STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) - STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) - STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) - STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) - STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) - STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) - STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) - STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) - STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) - STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) - STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) - STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) - STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) - STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) - STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) - STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) - -/* Round 4 */ - STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) - STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) - STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) - STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) - STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) - STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) - STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) - STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) - STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) - STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) - STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) - STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) - STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) - STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) - STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) - STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) - - a += saved_a; - b += saved_b; - c += saved_c; - d += saved_d; - - ptr += 64; - } while (size -= 64); - - ctx->a = a; - ctx->b = b; - ctx->c = c; - ctx->d = d; - - return ptr; +static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) { + const unsigned char *ptr; + MD5_u32plus a, b, c, d; + MD5_u32plus saved_a, saved_b, saved_c, saved_d; + + ptr = (const unsigned char *)data; + + a = ctx->a; + b = ctx->b; + c = ctx->c; + d = ctx->d; + + do { + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; + + /* Round 1 */ + STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) + STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) + STEP(F, c, d, a, b, SET(2), 0x242070db, 17) + STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) + STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) + STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) + STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) + STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) + STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) + STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) + STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) + STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) + STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) + STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) + STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) + STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) + + /* Round 2 */ + STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) + STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) + STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) + STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) + STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) + STEP(G, d, a, b, c, GET(10), 0x02441453, 9) + STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) + STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) + STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) + STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) + STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) + STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) + STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) + STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) + STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) + STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) + + /* Round 3 */ + STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) + STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) + STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) + STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) + STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) + STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) + STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) + STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) + STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) + STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) + STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) + STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) + STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) + STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) + STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) + STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) + + /* Round 4 */ + STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) + STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) + STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) + STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) + STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) + STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) + STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) + STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) + STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) + STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) + STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) + STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) + STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) + STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) + STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) + STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) + + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + + ptr += 64; + } while (size -= 64); + + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; + + return ptr; } - -void MD5_Init(MD5_CTX *ctx) -{ - ctx->a = 0x67452301; - ctx->b = 0xefcdab89; - ctx->c = 0x98badcfe; - ctx->d = 0x10325476; - - ctx->lo = 0; - ctx->hi = 0; + +void MD5_Init(MD5_CTX *ctx) { + ctx->a = 0x67452301; + ctx->b = 0xefcdab89; + ctx->c = 0x98badcfe; + ctx->d = 0x10325476; + + ctx->lo = 0; + ctx->hi = 0; } - -void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) -{ - MD5_u32plus saved_lo; - unsigned long used, available; - - saved_lo = ctx->lo; - if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) - ctx->hi++; - ctx->hi += size >> 29; - - used = saved_lo & 0x3f; - - if (used) { - available = 64 - used; - - if (size < available) { - memcpy(&ctx->buffer[used], data, size); - return; - } - - memcpy(&ctx->buffer[used], data, available); - data = (const unsigned char *)data + available; - size -= available; - body(ctx, ctx->buffer, 64); - } - - if (size >= 64) { - data = body(ctx, data, size & ~(unsigned long)0x3f); - size &= 0x3f; - } - - memcpy(ctx->buffer, data, size); + +void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) { + MD5_u32plus saved_lo; + unsigned long used, available; + + saved_lo = ctx->lo; + if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) + ctx->hi++; + ctx->hi += size >> 29; + + used = saved_lo & 0x3f; + + if (used) { + available = 64 - used; + + if (size < available) { + memcpy(&ctx->buffer[used], data, size); + return; + } + + memcpy(&ctx->buffer[used], data, available); + data = (const unsigned char *)data + available; + size -= available; + body(ctx, ctx->buffer, 64); + } + + if (size >= 64) { + data = body(ctx, data, size & ~(unsigned long)0x3f); + size &= 0x3f; + } + + memcpy(ctx->buffer, data, size); } - -void MD5_Final(unsigned char *result, MD5_CTX *ctx) -{ - unsigned long used, available; - - used = ctx->lo & 0x3f; - - ctx->buffer[used++] = 0x80; - - available = 64 - used; - - if (available < 8) { - memset(&ctx->buffer[used], 0, available); - body(ctx, ctx->buffer, 64); - used = 0; - available = 64; - } - - memset(&ctx->buffer[used], 0, available - 8); - - ctx->lo <<= 3; - ctx->buffer[56] = ctx->lo; - ctx->buffer[57] = ctx->lo >> 8; - ctx->buffer[58] = ctx->lo >> 16; - ctx->buffer[59] = ctx->lo >> 24; - ctx->buffer[60] = ctx->hi; - ctx->buffer[61] = ctx->hi >> 8; - ctx->buffer[62] = ctx->hi >> 16; - ctx->buffer[63] = ctx->hi >> 24; - - body(ctx, ctx->buffer, 64); - - result[0] = ctx->a; - result[1] = ctx->a >> 8; - result[2] = ctx->a >> 16; - result[3] = ctx->a >> 24; - result[4] = ctx->b; - result[5] = ctx->b >> 8; - result[6] = ctx->b >> 16; - result[7] = ctx->b >> 24; - result[8] = ctx->c; - result[9] = ctx->c >> 8; - result[10] = ctx->c >> 16; - result[11] = ctx->c >> 24; - result[12] = ctx->d; - result[13] = ctx->d >> 8; - result[14] = ctx->d >> 16; - result[15] = ctx->d >> 24; - - memset(ctx, 0, sizeof(*ctx)); + +void MD5_Final(unsigned char *result, MD5_CTX *ctx) { + unsigned long used, available; + + used = ctx->lo & 0x3f; + + ctx->buffer[used++] = 0x80; + + available = 64 - used; + + if (available < 8) { + memset(&ctx->buffer[used], 0, available); + body(ctx, ctx->buffer, 64); + used = 0; + available = 64; + } + + memset(&ctx->buffer[used], 0, available - 8); + + ctx->lo <<= 3; + ctx->buffer[56] = ctx->lo; + ctx->buffer[57] = ctx->lo >> 8; + ctx->buffer[58] = ctx->lo >> 16; + ctx->buffer[59] = ctx->lo >> 24; + ctx->buffer[60] = ctx->hi; + ctx->buffer[61] = ctx->hi >> 8; + ctx->buffer[62] = ctx->hi >> 16; + ctx->buffer[63] = ctx->hi >> 24; + + body(ctx, ctx->buffer, 64); + + result[0] = ctx->a; + result[1] = ctx->a >> 8; + result[2] = ctx->a >> 16; + result[3] = ctx->a >> 24; + result[4] = ctx->b; + result[5] = ctx->b >> 8; + result[6] = ctx->b >> 16; + result[7] = ctx->b >> 24; + result[8] = ctx->c; + result[9] = ctx->c >> 8; + result[10] = ctx->c >> 16; + result[11] = ctx->c >> 24; + result[12] = ctx->d; + result[13] = ctx->d >> 8; + result[14] = ctx->d >> 16; + result[15] = ctx->d >> 24; + + memset(ctx, 0, sizeof(*ctx)); } - + #endif // HAVE_OPENSSL -void md5sum(const void * data, unsigned long size, char * md5string) -{ - unsigned char digest[16]; - int i; - MD5_CTX context; - MD5_Init(&context); - MD5_Update(&context, data, size); - MD5_Final(digest, &context); - - for(i = 0; i < 16; ++i) - sprintf(&md5string[i*2], "%02x", (unsigned int)digest[i]); -} +void md5sum(const void *data, unsigned long size, char *md5string) { + unsigned char digest[16]; + int i; + MD5_CTX context; + MD5_Init(&context); + MD5_Update(&context, data, size); + MD5_Final(digest, &context); + for (i = 0; i < 16; ++i) + sprintf(&md5string[i * 2], "%02x", (unsigned int)digest[i]); +} diff --git a/src/library/md5sum.h b/src/library/md5sum.h index 2b93d217..bf924d91 100644 --- a/src/library/md5sum.h +++ b/src/library/md5sum.h @@ -34,10 +34,10 @@ typedef unsigned int MD5_u32plus; typedef struct { - MD5_u32plus lo, hi; - MD5_u32plus a, b, c, d; - unsigned char buffer[64]; - MD5_u32plus block[16]; + MD5_u32plus lo, hi; + MD5_u32plus a, b, c, d; + unsigned char buffer[64]; + MD5_u32plus block[16]; } MD5_CTX; extern void MD5_Init(MD5_CTX *ctx); @@ -46,6 +46,6 @@ extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); #endif // HAVE_OPENSSL -void md5sum (const void * data, unsigned long size, char * md5sum); +void md5sum(const void *data, unsigned long size, char *md5sum); #endif // _MD5_SUM_H diff --git a/src/library/plan.cpp b/src/library/plan.cpp index a3a1908f..d7830c43 100644 --- a/src/library/plan.cpp +++ b/src/library/plan.cpp @@ -19,266 +19,240 @@ // clfft.plan.cpp : Defines the entry point for the console application. // -#include "stdafx.h" -#include -#include "private.h" -#include "repo.h" #include "plan.h" -#include "generator.stockham.h" #include "../include/convenienceFunctions.h" #include "action.h" #include "fft_binary_lookup.h" +#include "generator.stockham.h" +#include "private.h" +#include "repo.h" +#include "stdafx.h" +#include using std::vector; -const std::string beginning_of_binary( "<[�_beginning_of_binary_�]>" ); -const std::string end_of_binary( "<[�_I_may_be_a_sorry_case,_but_I_don't_write_jokes_in_base_13_�]>" ); -const std::string end_of_file( "<[�_You're_off_the_edge_of_the_map,_mate._Here_there_be_monsters_�]>" ); - -static bool pow235(size_t num, size_t &pow2, size_t &pow3, size_t &pow5) -{ - //a helper function to decide if a number is only radix 2, 3 and 5 - if (num % 2 != 0 && num % 3 != 0 && num % 5 != 0) - return false; - - while (num > 1) - { - if (num % 5 == 0) - { - num /= 5; - pow5++; - continue; - } - if (num % 3 == 0) - { - num /= 3; - pow3++; - continue; - } - if (num % 2 == 0) - { - num /= 2; - pow2++; - continue; - } - return false; - } - return true; +const std::string beginning_of_binary("<[�_beginning_of_binary_�]>"); +const std::string end_of_binary( + "<[�_I_may_be_a_sorry_case,_but_I_don't_write_jokes_in_base_13_�]>"); +const std::string end_of_file( + "<[�_You're_off_the_edge_of_the_map,_mate._Here_there_be_monsters_�]>"); + +static bool pow235(size_t num, size_t &pow2, size_t &pow3, size_t &pow5) { + // a helper function to decide if a number is only radix 2, 3 and 5 + if (num % 2 != 0 && num % 3 != 0 && num % 5 != 0) + return false; + + while (num > 1) { + if (num % 5 == 0) { + num /= 5; + pow5++; + continue; + } + if (num % 3 == 0) { + num /= 3; + pow3++; + continue; + } + if (num % 2 == 0) { + num /= 2; + pow2++; + continue; + } + return false; + } + return true; +} + +static bool split1D_for_inplace(size_t num, vector> &splitNums, + clfftPrecision precision, size_t threshold) { + /* a helper function to split big 1D to friendly 2D sizes for inplace + transpose kernels currently only radix 2, 3 and 5 are supported the + algorithm looks for ways to split up the 1D into 2D such that one of the + dimensions is multiples of the other dimension. And this mupliple is + radix2, 3 or 5. each splited dimentsion should be further splited until + that it is smaller than 4096 + */ + if (num <= threshold) + return true; + if (num % 2 != 0 && num % 3 != 0 && num % 5 != 0) + return false; + + // let's figure out pow2, pow3 and pow5 such that num = 2^pow2 * 3^pow3 * + // 5^pow5 + size_t pow2, pow3, pow5; + pow2 = pow3 = pow5 = 0; + bool status = pow235(num, pow2, pow3, pow5); + if (!status) + return status; + + size_t divide_factor; + if (pow2 % 2 != 0) { + // pow2 is odd + if (pow3 % 2 != 0) { + // pow2 and pow3 are odd + if (pow5 % 2 != 0) { + // pow2, pow3 and pow5 are odd + // one dimension is 2*3*5 = 30 times bigger than the other dimension + divide_factor = 2 * 3 * 5; + } else { + // pow2 and pow3 are odd, pow 5 is even + // one dimension is 2*3 = 6 times bigger than the other dimension + divide_factor = 2 * 3; + } + } else { + // pow2 is odd, pow3 is even + if (pow5 % 2 != 0) { + // pow2, pow5 are odd pow3 is eve + divide_factor = 2 * 5; + } else { + // pow2 is odd, pow3 and pow5 are even + divide_factor = 2; + } + } + } else { + // pow2 is even + if (pow3 % 2 != 0) { + // pow3 is odd pow2 is even + if (pow5 % 2 != 0) { + // pow2 is even, pow3 and pow5 are odd + divide_factor = 3 * 5; + } else { + // pow2 and pow5 are even, pow3 is odd + divide_factor = 3; + } + } else { + // pow2 and are even + if (pow5 % 2 != 0) { + // pow5 is odd pow2 pow3 is eve + divide_factor = 5; + } else { + // all even + divide_factor = 1; + } + } + } + // add some special cases + if (num == 2687385600) + divide_factor = 2 * 2 * 3 * 3; + if (num == 2916000000) + divide_factor = 2 * 2 * 3 * 3 * 5 * 5; + if (num == 3057647616) + divide_factor = 2 * 2 * 3 * 3; + + num = num / divide_factor; + // now the remaining num should have even number of pow2, pow3 and pow5 and we + // can do sqrt + auto temp = (size_t)sqrt((double)num); + vector splitVec; + splitVec.push_back(temp * divide_factor); + splitVec.push_back(temp); + splitNums.push_back(splitVec); + + status = status && split1D_for_inplace(temp * divide_factor, splitNums, + precision, threshold); + status = status && split1D_for_inplace(temp, splitNums, precision, threshold); + return status; } -static bool split1D_for_inplace(size_t num, vector > &splitNums, clfftPrecision precision, size_t threshold) -{ - /* a helper function to split big 1D to friendly 2D sizes for inplace transpose kernels - currently only radix 2, 3 and 5 are supported - the algorithm looks for ways to split up the 1D into 2D such that one of the dimensions is multiples of the other dimension. - And this mupliple is radix2, 3 or 5. - each splited dimentsion should be further splited until that it is smaller than 4096 - */ - if (num <= threshold) - return true; - if (num % 2 != 0 && num % 3 != 0 && num % 5 != 0) - return false; - - //let's figure out pow2, pow3 and pow5 such that num = 2^pow2 * 3^pow3 * 5^pow5 - size_t pow2, pow3, pow5; - pow2 = pow3 = pow5 = 0; - bool status = pow235(num, pow2, pow3, pow5); - if (!status) - return status; - - size_t divide_factor; - if (pow2 % 2 != 0) - { - //pow2 is odd - if (pow3 % 2 != 0) - { - //pow2 and pow3 are odd - if (pow5 % 2 != 0) - { - //pow2, pow3 and pow5 are odd - //one dimension is 2*3*5 = 30 times bigger than the other dimension - divide_factor = 2 * 3 * 5; - } - else - { - //pow2 and pow3 are odd, pow 5 is even - //one dimension is 2*3 = 6 times bigger than the other dimension - divide_factor = 2 * 3; - } - } - else - { - //pow2 is odd, pow3 is even - if (pow5 % 2 != 0) - { - //pow2, pow5 are odd pow3 is eve - divide_factor = 2 * 5; - } - else - { - //pow2 is odd, pow3 and pow5 are even - divide_factor = 2; - } - - } - } - else - { - //pow2 is even - if (pow3 % 2 != 0) - { - //pow3 is odd pow2 is even - if (pow5 % 2 != 0) - { - //pow2 is even, pow3 and pow5 are odd - divide_factor = 3 * 5; - } - else - { - //pow2 and pow5 are even, pow3 is odd - divide_factor = 3; - } - } - else - { - //pow2 and are even - if (pow5 % 2 != 0) - { - //pow5 is odd pow2 pow3 is eve - divide_factor = 5; - } - else - { - //all even - divide_factor = 1; - } - - } - } - //add some special cases - if (num == 2687385600) - divide_factor = 2 * 2 * 3 * 3; - if (num == 2916000000) - divide_factor = 2 * 2 * 3 * 3 * 5 * 5; - if (num == 3057647616) - divide_factor = 2 * 2 * 3 * 3; - - num = num / divide_factor; - //now the remaining num should have even number of pow2, pow3 and pow5 and we can do sqrt - size_t temp = (size_t)sqrt((double)num); - vector splitVec; - splitVec.push_back(temp*divide_factor); - splitVec.push_back(temp); - splitNums.push_back(splitVec); - - status = status && split1D_for_inplace(temp*divide_factor, splitNums, precision, threshold); - status = status && split1D_for_inplace(temp, splitNums, precision, threshold); - return status; +// Returns CLFFT_SUCCESS if the fp64 is present, CLFFT_DEVICE_NO_DOUBLE if it is +// not found. +clfftStatus checkDevExt(std::string ext, const cl_device_id &device) { + size_t deviceExtSize = 0; + OPENCL_V( + ::clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, 0, nullptr, &deviceExtSize), + "Getting CL_DEVICE_EXTENSIONS Platform Info string size ( " + "::clGetDeviceInfo() )"); + + std::vector szDeviceExt(deviceExtSize); + OPENCL_V(::clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS, deviceExtSize, + &szDeviceExt[0], nullptr), + "Getting CL_DEVICE_EXTENSIONS Platform Info string ( " + "::clGetDeviceInfo() )"); + + std::string strDeviceExt = &szDeviceExt[0]; + if (strDeviceExt.find(ext.c_str(), 0) == std::string::npos) + return CLFFT_DEVICE_NO_DOUBLE; + + return CLFFT_SUCCESS; } -// Returns CLFFT_SUCCESS if the fp64 is present, CLFFT_DEVICE_NO_DOUBLE if it is not found. -clfftStatus checkDevExt( std::string ext, const cl_device_id &device ) -{ - size_t deviceExtSize = 0; - OPENCL_V( ::clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, 0, NULL, &deviceExtSize ), - "Getting CL_DEVICE_EXTENSIONS Platform Info string size ( ::clGetDeviceInfo() )" ); +clfftStatus clfftCreateDefaultPlanInternal(clfftPlanHandle *plHandle, + cl_context context, + const clfftDim dim, + const size_t *clLengths) { + if (clLengths == nullptr) + return CLFFT_INVALID_HOST_PTR; - std::vector< char > szDeviceExt( deviceExtSize ); - OPENCL_V( ::clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, deviceExtSize, &szDeviceExt[ 0 ], NULL ), - "Getting CL_DEVICE_EXTENSIONS Platform Info string ( ::clGetDeviceInfo() )" ); + size_t lenX = 1, lenY = 1, lenZ = 1; - std::string strDeviceExt = &szDeviceExt[ 0 ]; + switch (dim) { + case CLFFT_1D: { + // Minimum length size is 1 + if (clLengths[DimX] == 0) + return CLFFT_INVALID_ARG_VALUE; - if( strDeviceExt.find( ext.c_str( ), 0 ) == std::string::npos ) - return CLFFT_DEVICE_NO_DOUBLE; + if (!IsASupportedLength(clLengths[DimX])) { + return CLFFT_NOTIMPLEMENTED; + } + lenX = clLengths[DimX]; + } break; + case CLFFT_2D: { + // Minimum length size is 1 + if (clLengths[DimX] == 0 || clLengths[DimY] == 0) + return CLFFT_INVALID_ARG_VALUE; - return CLFFT_SUCCESS; -} + if (!IsASupportedLength(clLengths[DimX]) || + !IsASupportedLength(clLengths[DimY])) { + return CLFFT_NOTIMPLEMENTED; + } -clfftStatus clfftCreateDefaultPlanInternal( clfftPlanHandle* plHandle, cl_context context, const clfftDim dim, - const size_t* clLengths ) -{ - if( clLengths == NULL ) - return CLFFT_INVALID_HOST_PTR; - - size_t lenX = 1, lenY = 1, lenZ = 1; - - switch( dim ) - { - case CLFFT_1D: - { - // Minimum length size is 1 - if( clLengths[ DimX ] == 0 ) - return CLFFT_INVALID_ARG_VALUE; - - if( !IsASupportedLength( clLengths[ DimX ] ) ) - { - return CLFFT_NOTIMPLEMENTED; - } - - lenX = clLengths[ DimX ]; - } - break; - case CLFFT_2D: - { - // Minimum length size is 1 - if( clLengths[ DimX ] == 0 || clLengths[ DimY ] == 0 ) - return CLFFT_INVALID_ARG_VALUE; - - if( !IsASupportedLength( clLengths[ DimX ] ) || !IsASupportedLength( clLengths[ DimY ] ) ) - { - return CLFFT_NOTIMPLEMENTED; - } - - lenX = clLengths[ DimX ]; - lenY = clLengths[ DimY ]; - } - break; - case CLFFT_3D: - { - // Minimum length size is 1 - if( clLengths[ DimX ] == 0 || clLengths[ DimY ] == 0 || clLengths[ DimZ ] == 0 ) - return CLFFT_INVALID_ARG_VALUE; - - if( !IsASupportedLength( clLengths[ DimX ] ) || !IsASupportedLength( clLengths[ DimY ] ) || - !IsASupportedLength( clLengths[ DimZ ] )) - { - return CLFFT_NOTIMPLEMENTED; - } - - lenX = clLengths[ DimX ]; - lenY = clLengths[ DimY ]; - lenZ = clLengths[ DimZ ]; - } - break; - default: - return CLFFT_NOTIMPLEMENTED; - break; - } - - FFTPlan *fftPlan = NULL; - FFTRepo& fftRepo = FFTRepo::getInstance( ); - OPENCL_V( fftRepo.createPlan( plHandle, fftPlan ), _T( "fftRepo.insertPlan failed" ) ); - - fftPlan->baked = false; - fftPlan->dim = dim; - fftPlan->placeness = CLFFT_INPLACE; - fftPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - fftPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - fftPlan->precision = CLFFT_SINGLE; - fftPlan->context = context; - fftPlan->forwardScale = 1.0; - fftPlan->backwardScale = 1.0 / static_cast< double >( lenX * lenY * lenZ ); - fftPlan->batchsize = 1; - fftPlan->gen = Stockham; //default setting - fftPlan->offsetIn = 0; - fftPlan->offsetOut = 0; - - OPENCL_V(fftPlan->SetEnvelope(), _T("SetEnvelope failed")); - - clRetainContext( fftPlan->context ); + lenX = clLengths[DimX]; + lenY = clLengths[DimY]; + } break; + case CLFFT_3D: { + // Minimum length size is 1 + if (clLengths[DimX] == 0 || clLengths[DimY] == 0 || clLengths[DimZ] == 0) + return CLFFT_INVALID_ARG_VALUE; + + if (!IsASupportedLength(clLengths[DimX]) || + !IsASupportedLength(clLengths[DimY]) || + !IsASupportedLength(clLengths[DimZ])) { + return CLFFT_NOTIMPLEMENTED; + } + + lenX = clLengths[DimX]; + lenY = clLengths[DimY]; + lenZ = clLengths[DimZ]; + } break; + default: + return CLFFT_NOTIMPLEMENTED; + break; + } + + FFTPlan *fftPlan = nullptr; + FFTRepo &fftRepo = FFTRepo::getInstance(); + OPENCL_V(fftRepo.createPlan(plHandle, fftPlan), + _T( "fftRepo.insertPlan failed" )); + + fftPlan->baked = false; + fftPlan->dim = dim; + fftPlan->placeness = CLFFT_INPLACE; + fftPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + fftPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + fftPlan->precision = CLFFT_SINGLE; + fftPlan->context = context; + fftPlan->forwardScale = 1.0; + fftPlan->backwardScale = 1.0 / static_cast(lenX * lenY * lenZ); + fftPlan->batchsize = 1; + fftPlan->gen = Stockham; // default setting + fftPlan->offsetIn = 0; + fftPlan->offsetOut = 0; + + OPENCL_V(fftPlan->SetEnvelope(), _T("SetEnvelope failed")); + + clRetainContext(fftPlan->context); #if 0 ///////////////////////////////////////////////////////////////// @@ -297,4350 +271,4401 @@ clfftStatus clfftCreateDefaultPlanInternal( clfftPlanHandle* plHandle, cl_contex "Getting device array ( ::clGetContextInfo() )" ); #endif - // Need to devise a way to generate better names - tstringstream tstream; - tstream << _T( "plan_" ) << *plHandle; - - lockRAII* planLock = NULL; - OPENCL_V( fftRepo.getPlan( *plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - planLock->setName( tstream.str( ) ); - - // Set the lengths and default strides/pitches depending on the dim that the user passes to us - switch( dim ) - { - case CLFFT_1D: - { - fftPlan->length.push_back( lenX ); - fftPlan->inStride.push_back( 1 ); - fftPlan->outStride.push_back( 1 ); - fftPlan->iDist = lenX; - fftPlan->oDist = lenX; - } - break; - case CLFFT_2D: - { - fftPlan->length.push_back( lenX ); - fftPlan->length.push_back( lenY ); - fftPlan->inStride.push_back( 1 ); - fftPlan->inStride.push_back( lenX ); - fftPlan->outStride.push_back( 1 ); - fftPlan->outStride.push_back( lenX ); - fftPlan->iDist = lenX*lenY; - fftPlan->oDist = lenX*lenY; - } - break; - case CLFFT_3D: - { - fftPlan->length.push_back( lenX ); - fftPlan->length.push_back( lenY ); - fftPlan->length.push_back( lenZ ); - fftPlan->inStride.push_back( 1 ); - fftPlan->inStride.push_back( lenX ); - fftPlan->inStride.push_back( lenX*lenY ); - fftPlan->outStride.push_back( 1 ); - fftPlan->outStride.push_back( lenX ); - fftPlan->outStride.push_back( lenX*lenY ); - fftPlan->iDist = lenX*lenY*lenZ; - fftPlan->oDist = lenX*lenY*lenZ; - } - break; - } - - fftPlan->plHandle = *plHandle; - - return CLFFT_SUCCESS; + // Need to devise a way to generate better names + tstringstream tstream; + tstream << _T( "plan_" ) << *plHandle; + + lockRAII *planLock = nullptr; + OPENCL_V(fftRepo.getPlan(*plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + planLock->setName(tstream.str()); + + // Set the lengths and default strides/pitches depending on the dim that + //the user passes to us + switch (dim) { + case CLFFT_1D: { + fftPlan->length.push_back(lenX); + fftPlan->inStride.push_back(1); + fftPlan->outStride.push_back(1); + fftPlan->iDist = lenX; + fftPlan->oDist = lenX; + } break; + case CLFFT_2D: { + fftPlan->length.push_back(lenX); + fftPlan->length.push_back(lenY); + fftPlan->inStride.push_back(1); + fftPlan->inStride.push_back(lenX); + fftPlan->outStride.push_back(1); + fftPlan->outStride.push_back(lenX); + fftPlan->iDist = lenX * lenY; + fftPlan->oDist = lenX * lenY; + } break; + case CLFFT_3D: { + fftPlan->length.push_back(lenX); + fftPlan->length.push_back(lenY); + fftPlan->length.push_back(lenZ); + fftPlan->inStride.push_back(1); + fftPlan->inStride.push_back(lenX); + fftPlan->inStride.push_back(lenX * lenY); + fftPlan->outStride.push_back(1); + fftPlan->outStride.push_back(lenX); + fftPlan->outStride.push_back(lenX * lenY); + fftPlan->iDist = lenX * lenY * lenZ; + fftPlan->oDist = lenX * lenY * lenZ; + } break; + } + + fftPlan->plHandle = *plHandle; + + return CLFFT_SUCCESS; } -// This external entry-point should not be called from within the library. Use clfftCreateDefaultPlanInternal instead. -clfftStatus clfftCreateDefaultPlan( clfftPlanHandle* plHandle, cl_context context, const clfftDim dim, - const size_t* clLengths ) -{ - clfftStatus ret = clfftCreateDefaultPlanInternal(plHandle, context, dim, clLengths); - - if(ret == CLFFT_SUCCESS) - { - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan *fftPlan = NULL; - lockRAII* planLock = NULL; - OPENCL_V( fftRepo.getPlan( *plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - - fftPlan->userPlan = true; - } - - return ret; - +// This external entry-point should not be called from within the library. Use +// clfftCreateDefaultPlanInternal instead. +clfftStatus clfftCreateDefaultPlan(clfftPlanHandle *plHandle, + cl_context context, const clfftDim dim, + const size_t *clLengths) { + clfftStatus ret = + clfftCreateDefaultPlanInternal(plHandle, context, dim, clLengths); + + if (ret == CLFFT_SUCCESS) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + OPENCL_V(fftRepo.getPlan(*plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + + fftPlan->userPlan = true; + } + + return ret; } -std::string getKernelName(const clfftGenerators gen, const clfftPlanHandle plHandle, bool withPlHandle) -{ - // Logic to define a sensible filename - const std::string kernelPrefix( "clfft.kernel." ); - std::string generatorName; - std::stringstream kernelPath; - - switch( gen ) - { - - case Stockham: generatorName = "Stockham"; break; - case Transpose_GCN: generatorName = "Transpose"; break; - case Transpose_SQUARE: generatorName = "Transpose"; break; - case Transpose_NONSQUARE: generatorName = "TransposeNonSquare"; break; - case Copy: generatorName = "Copy"; break; - - } - - kernelPath << kernelPrefix << generatorName ; - - if (withPlHandle) - kernelPath << plHandle; - - kernelPath << ".cl"; - - return kernelPath.str(); +std::string getKernelName(const clfftGenerators gen, + const clfftPlanHandle plHandle, bool withPlHandle) { + // Logic to define a sensible filename + const std::string kernelPrefix("clfft.kernel."); + std::string generatorName; + std::stringstream kernelPath; + + switch (gen) { + + case Stockham: + generatorName = "Stockham"; + break; + case Transpose_GCN: + generatorName = "Transpose"; + break; + case Transpose_SQUARE: + generatorName = "Transpose"; + break; + case Transpose_NONSQUARE: + generatorName = "TransposeNonSquare"; + break; + case Copy: + generatorName = "Copy"; + break; + } + + kernelPath << kernelPrefix << generatorName; + + if (withPlHandle) + kernelPath << plHandle; + + kernelPath << ".cl"; + + return kernelPath.str(); } - -clfftStatus selectAction(FFTPlan * fftPlan, FFTAction *& action, cl_command_queue* commQueueFFT) -{ - // set the action we are baking a leaf - clfftStatus err; - - switch (fftPlan->gen) - { - case Stockham: - { - // Instantiate the default stockham generator - action = new FFTGeneratedStockhamAction (fftPlan->plHandle, fftPlan, *commQueueFFT, err); - OPENCL_V( err, "FFTGeneratedStockhamAction() failed"); - } - break; - - case Transpose_GCN: - { - action = new FFTGeneratedTransposeGCNAction(fftPlan->plHandle, fftPlan, *commQueueFFT, err); - OPENCL_V( err, "FFTGeneratedTransposeGCNAction() failed"); - } - break; - - - case Copy: - { - action = new FFTGeneratedCopyAction (fftPlan->plHandle, fftPlan, *commQueueFFT, err); - OPENCL_V( err, "FFTGeneratedCopyAction() failed"); - } - break; - - default: - { - assert(false); - OPENCL_V( CLFFT_NOTIMPLEMENTED, "selectAction() failed"); - } - } - - return CLFFT_SUCCESS; +clfftStatus selectAction(FFTPlan *fftPlan, FFTAction *&action, + cl_command_queue *commQueueFFT) { + // set the action we are baking a leaf + clfftStatus err; + + switch (fftPlan->gen) { + case Stockham: { + // Instantiate the default stockham generator + action = new FFTGeneratedStockhamAction(fftPlan->plHandle, fftPlan, + *commQueueFFT, err); + OPENCL_V(err, "FFTGeneratedStockhamAction() failed"); + } break; + + case Transpose_GCN: { + action = new FFTGeneratedTransposeGCNAction(fftPlan->plHandle, fftPlan, + *commQueueFFT, err); + OPENCL_V(err, "FFTGeneratedTransposeGCNAction() failed"); + } break; + + case Copy: { + action = new FFTGeneratedCopyAction(fftPlan->plHandle, fftPlan, + *commQueueFFT, err); + OPENCL_V(err, "FFTGeneratedCopyAction() failed"); + } break; + + default: { + assert(false); + OPENCL_V(CLFFT_NOTIMPLEMENTED, "selectAction() failed"); + } + } + + return CLFFT_SUCCESS; } - -inline size_t PrecisionWidth(clfftPrecision pr) -{ - switch(pr) - { - case CLFFT_SINGLE: return 1; - case CLFFT_DOUBLE: return 2; - default: assert(false); return 1; - } +inline size_t PrecisionWidth(clfftPrecision pr) { + switch (pr) { + case CLFFT_SINGLE: + return 1; + case CLFFT_DOUBLE: + return 2; + default: + assert(false); + return 1; + } } +clfftStatus clfftBakePlan( + clfftPlanHandle plHandle, cl_uint numQueues, cl_command_queue *commQueueFFT, + void(CL_CALLBACK *pfn_notify)(clfftPlanHandle plHandle, void *user_data), + void *user_data) { + // We do not currently support multi-GPU transforms + if (numQueues > 1) + return CLFFT_NOTIMPLEMENTED; + + // Notification mechanism is not set up yet; BakePlan can be called + //recursively to decompose higher dimension FFT's into arrays of 1d + //transforms, and this must be implemented to make only a single callback to + //the user. + if (pfn_notify != nullptr) + return CLFFT_NOTIMPLEMENTED; + + if (user_data != nullptr) + return CLFFT_NOTIMPLEMENTED; + + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftBakePlan" )); + + // if we have already baked the plan and nothing has changed since, we're done + // here + if (fftPlan->baked == true) { + return CLFFT_SUCCESS; + } + + // Store the device for which we are baking + clGetCommandQueueInfo(*commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), + &fftPlan->bakeDevice, nullptr); + + // find product of lengths + size_t maxLengthInAnyDim = 1; + switch (fftPlan->dim) { + case CLFFT_3D: + maxLengthInAnyDim = maxLengthInAnyDim > fftPlan->length[DimZ] + ? maxLengthInAnyDim + : fftPlan->length[DimZ]; + case CLFFT_2D: + maxLengthInAnyDim = maxLengthInAnyDim > fftPlan->length[DimY] + ? maxLengthInAnyDim + : fftPlan->length[DimY]; + case CLFFT_1D: + maxLengthInAnyDim = maxLengthInAnyDim > fftPlan->length[DimX] + ? maxLengthInAnyDim + : fftPlan->length[DimX]; + } + + const bool rc = (fftPlan->inputLayout == CLFFT_REAL) || + (fftPlan->outputLayout == CLFFT_REAL); + + // upper bounds on transfrom lengths - address this in the next release + size_t SP_MAX_LEN = 1 << 24; + size_t DP_MAX_LEN = 1 << 22; + if ((fftPlan->precision == CLFFT_SINGLE) && + (maxLengthInAnyDim > SP_MAX_LEN) && rc) + return CLFFT_NOTIMPLEMENTED; + if ((fftPlan->precision == CLFFT_DOUBLE) && + (maxLengthInAnyDim > DP_MAX_LEN) && rc) + return CLFFT_NOTIMPLEMENTED; + + // release buffers, as these will be created only in EnqueueTransform + if (nullptr != fftPlan->intBuffer) { + OPENCL_V(clReleaseMemObject(fftPlan->intBuffer), + _T( "Failed to release internal temporary buffer" )); + fftPlan->intBuffer = nullptr; + } + if (nullptr != fftPlan->intBufferRC) { + OPENCL_V(clReleaseMemObject(fftPlan->intBufferRC), + _T( "Failed to release internal temporary buffer" )); + fftPlan->intBufferRC = nullptr; + } + if (nullptr != fftPlan->intBufferC2R) { + OPENCL_V(clReleaseMemObject(fftPlan->intBufferC2R), + _T( "Failed to release internal temporary buffer" )); + fftPlan->intBufferC2R = nullptr; + } + + if (fftPlan->userPlan) // confirm it is top-level plan (user plan) + { + if (fftPlan->placeness == CLFFT_INPLACE) { + if ((fftPlan->inputLayout == CLFFT_HERMITIAN_PLANAR) || + (fftPlan->outputLayout == CLFFT_HERMITIAN_PLANAR)) + return CLFFT_INVALID_PLAN; + } + // Make sure strides & distance are same for C-C transforms + if (fftPlan->placeness == CLFFT_INPLACE) { + if ((fftPlan->inputLayout != CLFFT_REAL) && + (fftPlan->outputLayout != CLFFT_REAL)) { + // check strides + for (size_t i = 0; i < fftPlan->dim; i++) + if (fftPlan->inStride[i] != fftPlan->outStride[i]) + return CLFFT_INVALID_PLAN; + + // check distance + if (fftPlan->iDist != fftPlan->oDist) + return CLFFT_INVALID_PLAN; + } + } + } -clfftStatus clfftBakePlan( clfftPlanHandle plHandle, cl_uint numQueues, cl_command_queue* commQueueFFT, - void (CL_CALLBACK *pfn_notify)( clfftPlanHandle plHandle, void *user_data ), void* user_data ) -{ - // We do not currently support multi-GPU transforms - if( numQueues > 1 ) - return CLFFT_NOTIMPLEMENTED; - - // Notification mechanism is not set up yet; BakePlan can be called recursively to decompose higher dimension FFT's into - // arrays of 1d transforms, and this must be implemented to make only a single callback to the user. - if( pfn_notify != NULL ) - return CLFFT_NOTIMPLEMENTED; - - if( user_data != NULL ) - return CLFFT_NOTIMPLEMENTED; - - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftBakePlan" ) ); - - // if we have already baked the plan and nothing has changed since, we're done here - if( fftPlan->baked == true ) - { - return CLFFT_SUCCESS; - } - - // Store the device for which we are baking - clGetCommandQueueInfo(*commQueueFFT, CL_QUEUE_DEVICE, sizeof(cl_device_id), &fftPlan->bakeDevice, NULL); - - //find product of lengths - size_t maxLengthInAnyDim = 1; - switch(fftPlan->dim) - { - case CLFFT_3D: maxLengthInAnyDim = maxLengthInAnyDim > fftPlan->length[DimZ] ? maxLengthInAnyDim : fftPlan->length[DimZ]; - case CLFFT_2D: maxLengthInAnyDim = maxLengthInAnyDim > fftPlan->length[DimY] ? maxLengthInAnyDim : fftPlan->length[DimY]; - case CLFFT_1D: maxLengthInAnyDim = maxLengthInAnyDim > fftPlan->length[DimX] ? maxLengthInAnyDim : fftPlan->length[DimX]; - } - - const bool rc = (fftPlan->inputLayout == CLFFT_REAL) || (fftPlan->outputLayout == CLFFT_REAL); - - // upper bounds on transfrom lengths - address this in the next release - size_t SP_MAX_LEN = 1 << 24; - size_t DP_MAX_LEN = 1 << 22; - if((fftPlan->precision == CLFFT_SINGLE) && (maxLengthInAnyDim > SP_MAX_LEN) && rc) return CLFFT_NOTIMPLEMENTED; - if((fftPlan->precision == CLFFT_DOUBLE) && (maxLengthInAnyDim > DP_MAX_LEN) && rc) return CLFFT_NOTIMPLEMENTED; - - - // release buffers, as these will be created only in EnqueueTransform - if( NULL != fftPlan->intBuffer ) { OPENCL_V( clReleaseMemObject( fftPlan->intBuffer ), _T( "Failed to release internal temporary buffer" ) ); fftPlan->intBuffer = NULL; } - if( NULL != fftPlan->intBufferRC ) { OPENCL_V( clReleaseMemObject( fftPlan->intBufferRC ), _T( "Failed to release internal temporary buffer" ) ); fftPlan->intBufferRC = NULL; } - if( NULL != fftPlan->intBufferC2R ) { OPENCL_V( clReleaseMemObject( fftPlan->intBufferC2R ), _T( "Failed to release internal temporary buffer" ) ); fftPlan->intBufferC2R = NULL; } - - - if( fftPlan->userPlan ) // confirm it is top-level plan (user plan) - { - if(fftPlan->placeness == CLFFT_INPLACE) - { - if( (fftPlan->inputLayout == CLFFT_HERMITIAN_PLANAR) || (fftPlan->outputLayout == CLFFT_HERMITIAN_PLANAR) ) - return CLFFT_INVALID_PLAN; - } - - // Make sure strides & distance are same for C-C transforms - if(fftPlan->placeness == CLFFT_INPLACE) - { - if( (fftPlan->inputLayout != CLFFT_REAL) && (fftPlan->outputLayout != CLFFT_REAL) ) - { - // check strides - for(size_t i=0; idim; i++) - if(fftPlan->inStride[i] != fftPlan->outStride[i]) - return CLFFT_INVALID_PLAN; - - // check distance - if(fftPlan->iDist != fftPlan->oDist) - return CLFFT_INVALID_PLAN; - } - } - } - - if(fftPlan->gen == Copy) - { - clfftStatus err; - fftPlan->action = new FFTGeneratedCopyAction(plHandle, fftPlan, *commQueueFFT, err); - OPENCL_V( err, _T( "FFTGeneratedCopyAction() failed" ) ); - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - - if( fftPlan->userPlan ) - { - // If the user specifies double precision, check that the device supports double precision first - if( fftPlan->precision == CLFFT_DOUBLE || fftPlan->precision == CLFFT_DOUBLE_FAST ) - { - clfftStatus retAmdFp64 = checkDevExt( "cl_amd_fp64", fftPlan->bakeDevice ); - if( retAmdFp64 != CLFFT_SUCCESS ) - { - // If AMD's extention is not supported, check for Khronos extention - clfftStatus retKhrFp64 = checkDevExt( "cl_khr_fp64", fftPlan->bakeDevice ); - if( retKhrFp64 != CLFFT_SUCCESS ) - return retKhrFp64; - } - } - } - - // Compress the plan by discarding length '1' dimensions - // decision to pick generator - if( fftPlan->userPlan && !rc ) // confirm it is top-level plan (user plan) - { - size_t dmnsn = fftPlan->dim; - bool pow2flag = true; - - // switch case flows with no 'break' statements - switch(fftPlan->dim) - { - case CLFFT_3D: - - if(fftPlan->length[DimZ] == 1) - { - dmnsn -= 1; - fftPlan-> inStride.erase(fftPlan-> inStride.begin() + 2); - fftPlan->outStride.erase(fftPlan->outStride.begin() + 2); - fftPlan-> length.erase(fftPlan-> length.begin() + 2); - } - else - { - if( !IsPo2(fftPlan->length[DimZ])) pow2flag=false; - } - case CLFFT_2D: - - if(fftPlan->length[DimY] == 1) - { - dmnsn -= 1; - fftPlan-> inStride.erase(fftPlan-> inStride.begin() + 1); - fftPlan->outStride.erase(fftPlan->outStride.begin() + 1); - fftPlan-> length.erase(fftPlan-> length.begin() + 1); - } - else - { - if( !IsPo2(fftPlan->length[DimY])) pow2flag=false; - } - - case CLFFT_1D: - - if( (fftPlan->length[DimX] == 1) && (dmnsn > 1) ) - { - dmnsn -= 1; - fftPlan-> inStride.erase(fftPlan-> inStride.begin()); - fftPlan->outStride.erase(fftPlan->outStride.begin()); - fftPlan-> length.erase(fftPlan-> length.begin()); - } - else - { - if( !IsPo2(fftPlan->length[DimX])) pow2flag=false; - } - } - - fftPlan->dim = (clfftDim)dmnsn; - } - - // first time check transposed - if (fftPlan->transposed != CLFFT_NOTRANSPOSE && fftPlan->dim != CLFFT_2D && - fftPlan->dim == fftPlan->length.size()) - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - // The largest vector we can transform in a single pass - // depends on the GPU caps -- especially the amount of LDS - // available - // - size_t Large1DThreshold = 0; - - - OPENCL_V(fftPlan->GetMax1DLength (&Large1DThreshold), _T("GetMax1DLength failed")); - BUG_CHECK (Large1DThreshold > 1); - - // Verify that the data passed to us is packed - switch( fftPlan->dim ) - { - case CLFFT_1D: - { - if ( !Is1DPossible(fftPlan->length[0], Large1DThreshold) ) - { - size_t clLengths[] = { 1, 1, 0 }; - size_t in_1d, in_x, count; - - BUG_CHECK (IsPo2 (Large1DThreshold)) - - - if( IsPo2(fftPlan->length[0]) ) - { - // Enable block compute under these conditions - if( (fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) && !rc - && (fftPlan->length[0] <= 262144/PrecisionWidth(fftPlan->precision)) && (fftPlan->length.size() <= 1) - && (!clfftGetRequestLibNoMemAlloc() || (fftPlan->placeness == CLFFT_OUTOFPLACE)) ) - { - fftPlan->blockCompute = true; - - if(1 == PrecisionWidth(fftPlan->precision)) - { - switch(fftPlan->length[0]) - { - case 8192: clLengths[1] = 64; break; - case 16384: clLengths[1] = 64; break; - case 32768: clLengths[1] = 128; break; - case 65536: clLengths[1] = 256; break; - case 131072: clLengths[1] = 64; break; - case 262144: clLengths[1] = 64; break; - case 524288: clLengths[1] = 256; break; - case 1048576: clLengths[1] = 256; break; - default: assert(false); - } - } - else - { - switch(fftPlan->length[0]) - { - case 4096: clLengths[1] = 64; break; - case 8192: clLengths[1] = 64; break; - case 16384: clLengths[1] = 64; break; - case 32768: clLengths[1] = 128; break; - case 65536: clLengths[1] = 64; break; - case 131072: clLengths[1] = 64; break; - case 262144: clLengths[1] = 128; break; - case 524288: clLengths[1] = 256; break; - default: assert(false); - } - } - } - else - { - if( clfftGetRequestLibNoMemAlloc() && !rc && (fftPlan->placeness == CLFFT_INPLACE) ) - { - in_x = BitScanF(fftPlan->length[0]); - in_x /= 2; - clLengths[1] = (size_t)1 << in_x; - } - else if( fftPlan->length[0] > (Large1DThreshold * Large1DThreshold) ) - { - clLengths[1] = fftPlan->length[0] / Large1DThreshold; - } - else - { - in_1d = BitScanF (Large1DThreshold); // this is log2(LARGE1D_THRESHOLD) - in_x = BitScanF (fftPlan->length[0]); // this is log2(length) - BUG_CHECK (in_1d > 0) - count = in_x/in_1d; - if (count*in_1d < in_x) - { - count++; - in_1d = in_x / count; - if (in_1d * count < in_x) in_1d++; - } - clLengths[1] = (size_t)1 << in_1d; - } - } - } - else - { - // This array must be kept sorted in the ascending order - - size_t supported[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 22, 24, - 25, 26, 27, 28, 30, 32, 33, 35, 36, 39, 40, 42, 44, 45, 48, 49, 50, 52, 54, - 55, 56, 60, 63, 64, 65, 66, 70, 72, 75, 77, 78, 80, 81, 84, 88, 90, 91, 96, - 98, 99, 100, 104, 105, 108, 110, 112, 117, 120, 121, 125, 126, 128, 130, 132, - 135, 140, 143, 144, 147, 150, 154, 156, 160, 162, 165, 168, 169, 175, 176, - 180, 182, 189, 192, 195, 196, 198, 200, 208, 210, 216, 220, 224, 225, 231, - 234, 240, 242, 243, 245, 250, 252, 256, 260, 264, 270, 273, 275, 280, 286, - 288, 294, 297, 300, 308, 312, 315, 320, 324, 325, 330, 336, 338, 343, 350, - 351, 352, 360, 363, 364, 375, 378, 384, 385, 390, 392, 396, 400, 405, 416, - 420, 429, 432, 440, 441, 448, 450, 455, 462, 468, 480, 484, 486, 490, 495, - 500, 504, 507, 512, 520, 525, 528, 539, 540, 546, 550, 560, 567, 572, 576, - 585, 588, 594, 600, 605, 616, 624, 625, 630, 637, 640, 648, 650, 660, 672, - 675, 676, 686, 693, 700, 702, 704, 715, 720, 726, 728, 729, 735, 750, 756, - 768, 770, 780, 784, 792, 800, 810, 819, 825, 832, 840, 845, 847, 858, 864, - 875, 880, 882, 891, 896, 900, 910, 924, 936, 945, 960, 968, 972, 975, 980, - 990, 1000, 1001, 1008, 1014, 1024, 1029, 1040, 1050, 1053, 1056, 1078, 1080, - 1089, 1092, 1100, 1120, 1125, 1134, 1144, 1152, 1155, 1170, 1176, 1183, 1188, - 1200, 1210, 1215, 1225, 1232, 1248, 1250, 1260, 1274, 1280, 1287, 1296, 1300, - 1320, 1323, 1331, 1344, 1350, 1352, 1365, 1372, 1375, 1386, 1400, 1404, 1408, - 1430, 1440, 1452, 1456, 1458, 1470, 1485, 1500, 1512, 1521, 1536, 1540, 1560, - 1568, 1573, 1575, 1584, 1600, 1617, 1620, 1625, 1638, 1650, 1664, 1680, 1690, - 1694, 1701, 1715, 1716, 1728, 1750, 1755, 1760, 1764, 1782, 1792, 1800, 1815, - 1820, 1848, 1859, 1872, 1875, 1890, 1911, 1920, 1925, 1936, 1944, 1950, 1960, - 1980, 2000, 2002, 2016, 2025, 2028, 2048, 2058, 2079, 2080, 2100, 2106, 2112, - 2145, 2156, 2160, 2178, 2184, 2187, 2197, 2200, 2205, 2240, 2250, 2268, 2275, - 2288, 2304, 2310, 2340, 2352, 2366, 2376, 2400, 2401, 2420, 2430, 2450, 2457, - 2464, 2475, 2496, 2500, 2520, 2535, 2541, 2548, 2560, 2574, 2592, 2600, 2625, - 2640, 2646, 2662, 2673, 2688, 2695, 2700, 2704, 2730, 2744, 2750, 2772, 2800, - 2808, 2816, 2835, 2860, 2880, 2904, 2912, 2916, 2925, 2940, 2970, 3000, 3003, - 3024, 3025, 3042, 3072, 3080, 3087, 3120, 3125, 3136, 3146, 3150, 3159, 3168, - 3185, 3200, 3234, 3240, 3250, 3267, 3276, 3300, 3328, 3360, 3375, 3380, 3388, - 3402, 3430, 3432, 3456, 3465, 3500, 3510, 3520, 3528, 3549, 3564, 3575, 3584, - 3600, 3630, 3640, 3645, 3675, 3696, 3718, 3744, 3750, 3773, 3780, 3822, 3840, - 3850, 3861, 3872, 3888, 3900, 3920, 3960, 3969, 3993, 4000, 4004, 4032, 4050, - 4056, 4095, 4096 }; - - size_t lenSupported = sizeof(supported)/sizeof(supported[0]); - size_t maxFactoredLength = (supported[lenSupported-1] < Large1DThreshold) ? supported[lenSupported-1] : Large1DThreshold; - - size_t halfPowerLength = (size_t)1 << ( (StockhamGenerator::CeilPo2(fftPlan->length[0]) + 1) / 2 ); - size_t factoredLengthStart = (halfPowerLength < maxFactoredLength) ? halfPowerLength : maxFactoredLength; - - size_t indexStart = 0; - while(supported[indexStart] < factoredLengthStart) indexStart++; - - for(size_t i = indexStart; i >= 1; i--) - { - if( fftPlan->length[0] % supported[i] == 0 ) - { - if (Is1DPossible(supported[i], Large1DThreshold)) - { - clLengths[1] = supported[i]; - break; - } - } - } - } - // add some special cases - /* - if (fftPlan->length[0] == 10000) - clLengths[1] = 100;//100 x 100 - if (fftPlan->length[0] == 100000) - clLengths[1] = 100;//100 x 1,000 - if (fftPlan->length[0] == 10000000) - clLengths[1] = 1000;//1,000 x 10,000 - if (fftPlan->length[0] == 100000000) - clLengths[1] = 10000;//10,000 x 10,000 - if (fftPlan->length[0] == 1000000000) - clLengths[1] = 10000;//10,000 x 100,000 - - if (fftPlan->length[0] == 3099363912) - clLengths[1] = 78732;//39366 x 78732 - if (fftPlan->length[0] == 39366) - clLengths[1] = 81;//81*486 - if (fftPlan->length[0] == 78732) - clLengths[1] = 162;//162*486 - if (fftPlan->length[0] == 354294) - clLengths[1] = 243; - */ - size_t threshold = 4096; - if (fftPlan->precision == CLFFT_DOUBLE) - threshold = 2048; - if (clfftGetRequestLibNoMemAlloc() && - fftPlan->placeness == CLFFT_INPLACE && - (fftPlan->inputLayout == fftPlan->outputLayout) - && fftPlan->length[0] > threshold) - { - //for inplace fft with inplace transpose, the split logic is different - vector > splitNums; - bool implemented = split1D_for_inplace(fftPlan->length[0], splitNums, fftPlan->precision, threshold); - if (implemented) - clLengths[1] = splitNums[0][0]; - } - - clLengths[0] = fftPlan->length[0]/clLengths[1]; - - // Start of block where transposes are generated; 1D FFT - while (1 && (fftPlan->inputLayout != CLFFT_REAL) && (fftPlan->outputLayout != CLFFT_REAL)) - { - if (fftPlan->length[0] <= Large1DThreshold) break; - - if (fftPlan->inStride[0] != 1 || fftPlan->outStride[0] != 1) break; - - if ( IsPo2(fftPlan->length[0]) && - (fftPlan->length[0] <= 262144/PrecisionWidth(fftPlan->precision)) && (fftPlan->length.size() <= 1) && - (!clfftGetRequestLibNoMemAlloc() || (fftPlan->placeness == CLFFT_OUTOFPLACE)) ) break; - - if ( clLengths[0]<=32 && clLengths[1]<=32) break; - - - size_t biggerDim = clLengths[0] > clLengths[1] ? clLengths[0] : clLengths[1]; - size_t smallerDim = biggerDim == clLengths[0] ? clLengths[1] : clLengths[0]; - size_t padding = 0; - if( (smallerDim % 64 == 0) || (biggerDim % 64 == 0) ) - padding = 64; - - clfftGenerators transGen = Transpose_GCN; - - size_t dim_ratio = biggerDim / smallerDim; - size_t dim_residue = biggerDim % smallerDim; - // If this is an in-place transform the - // input and output layout, dimensions and strides - // *MUST* be the same. - // - bool inStrideEqualsOutStride = true; - for (size_t u = fftPlan->inStride.size(); u-- > 0; ) { - if (fftPlan->inStride[u] != fftPlan->outStride[u]) - { - inStrideEqualsOutStride = false; - break; - } - } - //packed data is required for inplace transpose - bool isDataPacked = true; - for (size_t u = 0; u < fftPlan->inStride.size(); u++) - { - if (u == 0) - { - if (fftPlan->inStride[0] == 1) - continue; - else - { - isDataPacked = false; - break; - } - } - else - { - size_t packDataSize = 1; - for (size_t i = 0; i < u; i++) - packDataSize *= fftPlan->length[i]; - if (fftPlan->inStride[u] == packDataSize) - continue; - else - { - isDataPacked = false; - break; - } - } - } - if (clfftGetRequestLibNoMemAlloc() && - dim_residue == 0 && - ((dim_ratio % 2 == 0) || - (dim_ratio % 3 == 0) || - (dim_ratio % 5 == 0) || - (dim_ratio % 10 == 0)) && - fftPlan->placeness == CLFFT_INPLACE && - (fftPlan->inputLayout == fftPlan->outputLayout) && - (inStrideEqualsOutStride) && (isDataPacked)) - { - padding = 0; - fftPlan->allOpsInplace = true; - transGen = Transpose_NONSQUARE; - //std::cout << "Transpose_NONSQUARE" << std::endl; - } - - if( clfftGetRequestLibNoMemAlloc() && - (clLengths[0] == clLengths[1]) && - fftPlan->placeness == CLFFT_INPLACE ) - { - padding = 0; - fftPlan->allOpsInplace = true; - transGen = Transpose_SQUARE; - } - - if (fftPlan->tmpBufSize != 0) - padding = 0; - - if ( (fftPlan->tmpBufSize==0 ) && !fftPlan->allOpsInplace) - { - fftPlan->tmpBufSize = (smallerDim + padding) * biggerDim * - fftPlan->batchsize * fftPlan->ElementSize(); - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - } - - //Transpose - //Input --> tmp buffer - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan Large1d transpose 1 failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->placeness = fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->inputLayout = fftPlan->inputLayout; - trans1Plan->outputLayout = fftPlan->allOpsInplace ? fftPlan->inputLayout : CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inStride[0] = fftPlan->inStride[0]; - trans1Plan->inStride[1] = clLengths[0]; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = clLengths[1] + padding; - trans1Plan->iDist = fftPlan->iDist; - trans1Plan->oDist = clLengths[0] * trans1Plan->outStride[1]; - trans1Plan->gen = transGen; - trans1Plan->transflag = true; - - if (trans1Plan->gen == Transpose_NONSQUARE || trans1Plan->gen == Transpose_SQUARE)// inplace transpose - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - //trans1Plan->length.push_back(fftPlan->length[index]); - /* - replacing the line above with the two lines below since: - fftPlan is still 1D, thus the broken down transpose should be 2D not 3D - the batchSize for the transpose should increase accordingly. - the iDist should decrease accordingly. Push back to length will cause a 3D transpose - */ - trans1Plan->batchsize = trans1Plan->batchsize * fftPlan->length[index]; - trans1Plan->iDist = trans1Plan->iDist / fftPlan->length[index]; - - trans1Plan->inStride.push_back(fftPlan->inStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - } - else - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - - trans1Plan->inStride.push_back(fftPlan->inStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - trans1Plan->hasPreCallback = true; - trans1Plan->preCallback = fftPlan->preCallback; - trans1Plan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans1 plan failed" ) ); - - //Row transform - //tmp->output - //size clLengths[1], batch clLengths[0], with length[0] twiddle factor multiplication - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &clLengths[1] ), - _T( "CreateDefaultPlan Large1d column failed" ) ); - - FFTPlan* row1Plan = NULL; - lockRAII* row1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, row1Plan, row1Lock ), _T( "fftRepo.getPlan failed" ) ); - - row1Plan->placeness = fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; - row1Plan->precision = fftPlan->precision; - row1Plan->forwardScale = 1.0f; - row1Plan->backwardScale = 1.0f; - row1Plan->tmpBufSize = 0; - row1Plan->batchsize = fftPlan->batchsize; - - row1Plan->gen = fftPlan->gen; - row1Plan->envelope = fftPlan->envelope; - - // twiddling is done in row2 - row1Plan->large1D = 0; - - row1Plan->length.push_back(clLengths[0]); - row1Plan->inputLayout = fftPlan->allOpsInplace ? fftPlan->inputLayout : CLFFT_COMPLEX_INTERLEAVED; - row1Plan->outputLayout = fftPlan->outputLayout; - row1Plan->inStride[0] = 1; - row1Plan->outStride[0] = fftPlan->outStride[0]; - row1Plan->inStride.push_back(clLengths[1]+padding); - row1Plan->outStride.push_back(clLengths[1]); - row1Plan->iDist = clLengths[0] * row1Plan->inStride[1]; - row1Plan->oDist = fftPlan->oDist; - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - row1Plan->length.push_back(fftPlan->length[index]); - row1Plan->inStride.push_back(row1Plan->iDist); - row1Plan->iDist *= fftPlan->length[index]; - row1Plan->outStride.push_back(fftPlan->outStride[index]); - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d first row plan failed" ) ); - - //Transpose 2 - //Output --> tmp buffer - clLengths[2] = clLengths[0]; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTY, fftPlan->context, CLFFT_2D, &clLengths[1] ), - _T( "CreateDefaultPlan Large1d transpose 2 failed" ) ); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTY, trans2Plan, trans2Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans2Plan->placeness = fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->inputLayout = fftPlan->outputLayout; - trans2Plan->outputLayout = fftPlan->allOpsInplace ? fftPlan->inputLayout : CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->inStride[0] = fftPlan->outStride[0]; - trans2Plan->inStride[1] = clLengths[1]; - trans2Plan->outStride[0] = 1; - trans2Plan->outStride[1] = clLengths[0] + padding; - trans2Plan->iDist = fftPlan->oDist; - trans2Plan->oDist = clLengths[1] * trans2Plan->outStride[1]; - trans2Plan->gen = transGen; - - //if (transGen != Transpose_NONSQUARE)//twiddle - trans2Plan->large1D = fftPlan->length[0]; - - trans2Plan->transflag = true; - - if (trans2Plan->gen == Transpose_NONSQUARE || trans2Plan->gen == Transpose_SQUARE)// inplace transpose - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - //trans2Plan->length.push_back(fftPlan->length[index]); - /* - replacing the line above with the two lines below since: - fftPlan is still 1D, thus the broken down transpose should be 2D not 3D - the batchSize for the transpose should increase accordingly. - the iDist should decrease accordingly. Push back to length will cause a 3D transpose - */ - trans2Plan->batchsize = trans2Plan->batchsize * fftPlan->length[index]; - trans2Plan->iDist = trans2Plan->iDist / fftPlan->length[index]; - trans2Plan->inStride.push_back(fftPlan->outStride[index]); - trans2Plan->outStride.push_back(trans2Plan->oDist); - trans2Plan->oDist *= fftPlan->length[index]; - } - } - else - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - trans2Plan->length.push_back(fftPlan->length[index]); - - trans2Plan->inStride.push_back(fftPlan->outStride[index]); - trans2Plan->outStride.push_back(trans2Plan->oDist); - trans2Plan->oDist *= fftPlan->length[index]; - } - } - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans2 plan failed" ) ); - - //Row transform 2 - //tmp->tmp - //size clLengths[0], batch clLengths[1] - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &clLengths[0] ), - _T( "CreateDefaultPlan Large1d second row plan failed" ) ); - - FFTPlan* row2Plan = NULL; - lockRAII* row2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, row2Plan, row2Lock ), _T( "fftRepo.getPlan failed" ) ); - - row2Plan->placeness = CLFFT_INPLACE; - row2Plan->precision = fftPlan->precision; - row2Plan->forwardScale = fftPlan->forwardScale; - row2Plan->backwardScale = fftPlan->backwardScale; - row2Plan->tmpBufSize = 0; - row2Plan->batchsize = fftPlan->batchsize; - - row2Plan->gen = fftPlan->gen; - row2Plan->envelope = fftPlan->envelope; - - - row2Plan->length.push_back(clLengths[1]); - row2Plan->inputLayout = fftPlan->allOpsInplace ? fftPlan->inputLayout : CLFFT_COMPLEX_INTERLEAVED; - row2Plan->outputLayout = fftPlan->allOpsInplace ? fftPlan->inputLayout : CLFFT_COMPLEX_INTERLEAVED; - row2Plan->inStride[0] = 1; - row2Plan->outStride[0] = 1; - row2Plan->inStride.push_back(clLengths[0] + padding); - row2Plan->outStride.push_back(clLengths[0] + padding); - row2Plan->iDist = clLengths[1] * row2Plan->inStride[1]; - row2Plan->oDist = clLengths[1] * row2Plan->outStride[1]; - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - row2Plan->length.push_back(fftPlan->length[index]); - row2Plan->inStride.push_back(row2Plan->iDist); - row2Plan->outStride.push_back(row2Plan->oDist); - row2Plan->iDist *= fftPlan->length[index]; - row2Plan->oDist *= fftPlan->length[index]; - } - - //if (transGen != Transpose_NONSQUARE)//twiddle in transform - //{ - // row2Plan->large1D = fftPlan->length[0]; - // row2Plan->twiddleFront = true; - //} - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d second row plan failed" ) ); - - //Transpose 3 - //tmp --> output - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTZ, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan Large1d transpose 3 failed" ) ); - - FFTPlan* trans3Plan = NULL; - lockRAII* trans3Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTZ, trans3Plan, trans3Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans3Plan->placeness = fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; - trans3Plan->precision = fftPlan->precision; - trans3Plan->tmpBufSize = 0; - trans3Plan->batchsize = fftPlan->batchsize; - trans3Plan->envelope = fftPlan->envelope; - trans3Plan->inputLayout = fftPlan->allOpsInplace ? fftPlan->inputLayout : CLFFT_COMPLEX_INTERLEAVED; - trans3Plan->outputLayout = fftPlan->outputLayout; - trans3Plan->inStride[0] = 1; - trans3Plan->inStride[1] = clLengths[0] + padding; - trans3Plan->outStride[0] = fftPlan->outStride[0]; - trans3Plan->outStride[1] = clLengths[1]; - trans3Plan->iDist = clLengths[1] * trans3Plan->inStride[1]; - trans3Plan->oDist = fftPlan->oDist; - trans3Plan->gen = transGen; - trans3Plan->transflag = true; - trans3Plan->transOutHorizontal = true; - - - if (trans3Plan->gen == Transpose_NONSQUARE)// inplace transpose - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - //trans3Plan->length.push_back(fftPlan->length[index]); - /* - replacing the line above with the two lines below since: - fftPlan is still 1D, thus the broken down transpose should be 2D not 3D - the batchSize for the transpose should increase accordingly. - the iDist should decrease accordingly. Push back to length will cause a 3D transpose - */ - trans3Plan->batchsize = trans3Plan->batchsize * fftPlan->length[index]; - //trans3Plan->iDist = trans3Plan->iDist / fftPlan->length[index]; - //trans3Plan->inStride.push_back(trans3Plan->iDist); - trans3Plan->inStride.push_back(fftPlan->inStride[index]); - //trans3Plan->iDist *= fftPlan->length[index]; - trans3Plan->outStride.push_back(fftPlan->outStride[index]); - } - } - else if (trans3Plan->gen == Transpose_SQUARE) - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - trans3Plan->batchsize = trans3Plan->batchsize * fftPlan->length[index]; - //trans3Plan->iDist = trans3Plan->iDist / fftPlan->length[index]; - //trans3Plan->inStride.push_back(trans3Plan->iDist); - trans3Plan->inStride.push_back(fftPlan->inStride[index]); - //trans3Plan->iDist *= fftPlan->length[index]; - trans3Plan->outStride.push_back(fftPlan->outStride[index]); - } - } - else - { - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - trans3Plan->length.push_back(fftPlan->length[index]); - - trans3Plan->inStride.push_back(trans3Plan->iDist); - trans3Plan->iDist *= fftPlan->length[index]; - trans3Plan->outStride.push_back(fftPlan->outStride[index]); - } - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - trans3Plan->hasPostCallback = true; - trans3Plan->postCallbackParam = fftPlan->postCallbackParam; - trans3Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans3 plan failed" ) ); - - fftPlan->transflag = true; - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - size_t length0 = clLengths[0]; - size_t length1 = clLengths[1]; - - - // For real transforms - // Special case optimization with 5-step algorithm - if( (fftPlan->inputLayout == CLFFT_REAL) && IsPo2(fftPlan->length[0]) - && (fftPlan->length.size() == 1) - && (fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) - && (fftPlan->length[0] > 4096) && (fftPlan->length.size() == 1) ) - { - - ARG_CHECK(clLengths[0] <= Large1DThreshold); - - - size_t biggerDim = clLengths[0] > clLengths[1] ? clLengths[0] : clLengths[1]; - size_t smallerDim = biggerDim == clLengths[0] ? clLengths[1] : clLengths[0]; - size_t padding = 0; - if( (smallerDim % 64 == 0) || (biggerDim % 64 == 0) ) - padding = 64; - - - if (fftPlan->tmpBufSize==0 ) - { - size_t Nf = (1 + smallerDim/2) * biggerDim; - fftPlan->tmpBufSize = (smallerDim + padding) * biggerDim / 2; - - if(fftPlan->tmpBufSize < Nf) - fftPlan->tmpBufSize = Nf; - - fftPlan->tmpBufSize *= ( fftPlan->batchsize * fftPlan->ElementSize() ); - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - } - - if (fftPlan->tmpBufSizeRC==0 ) - { - fftPlan->tmpBufSizeRC = fftPlan->tmpBufSize; - } - - //Transpose - //Input --> tmp buffer - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan Large1d transpose 1 failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->placeness = CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->inputLayout = fftPlan->inputLayout; - trans1Plan->outputLayout = CLFFT_REAL; - trans1Plan->inStride[0] = fftPlan->inStride[0]; - trans1Plan->inStride[1] = clLengths[0]; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = clLengths[1] + padding; - trans1Plan->iDist = fftPlan->iDist; - trans1Plan->oDist = clLengths[0] * trans1Plan->outStride[1]; - trans1Plan->gen = Transpose_GCN; - trans1Plan->transflag = true; - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - trans1Plan->hasPreCallback = true; - trans1Plan->preCallback = fftPlan->preCallback; - trans1Plan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans1 plan failed" ) ); - - //Row transform - //tmp->output - //size clLengths[1], batch clLengths[0], with length[0] twiddle factor multiplication - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &clLengths[1] ), - _T( "CreateDefaultPlan Large1d column failed" ) ); - - FFTPlan* row1Plan = NULL; - lockRAII* row1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, row1Plan, row1Lock ), _T( "fftRepo.getPlan failed" ) ); - - row1Plan->placeness = CLFFT_OUTOFPLACE; - row1Plan->precision = fftPlan->precision; - row1Plan->forwardScale = 1.0f; - row1Plan->backwardScale = 1.0f; - row1Plan->tmpBufSize = 0; - row1Plan->batchsize = fftPlan->batchsize; - - row1Plan->gen = fftPlan->gen; - row1Plan->envelope = fftPlan->envelope; - - // twiddling is done in row2 - row1Plan->large1D = 0; - - row1Plan->length.push_back(clLengths[0]); - row1Plan->inputLayout = CLFFT_REAL; - row1Plan->outputLayout = CLFFT_HERMITIAN_INTERLEAVED; - row1Plan->inStride[0] = 1; - row1Plan->outStride[0] = 1; - row1Plan->inStride.push_back(clLengths[1]+padding); - row1Plan->outStride.push_back(1 + clLengths[1]/2); - row1Plan->iDist = clLengths[0] * row1Plan->inStride[1]; - row1Plan->oDist = clLengths[0] * row1Plan->outStride[1]; - - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d first row plan failed" ) ); - - //Transpose 2 - //Output --> tmp buffer - clLengths[2] = clLengths[0]; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTY, fftPlan->context, CLFFT_2D, &clLengths[1] ), - _T( "CreateDefaultPlan Large1d transpose 2 failed" ) ); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTY, trans2Plan, trans2Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans2Plan->transflag = true; - - size_t transLengths[2]; - transLengths[0] = 1 + clLengths[1]/2; - transLengths[1] = clLengths[0]; - OPENCL_V(clfftSetPlanLength( fftPlan->planTY, CLFFT_2D, transLengths ), - _T( "clfftSetPlanLength for planTY transpose failed" ) ); - - - - trans2Plan->placeness = CLFFT_OUTOFPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->inStride[0] = 1; - trans2Plan->inStride[1] = 1 + clLengths[1]/2; - trans2Plan->outStride[0] = 1; - trans2Plan->outStride[1] = clLengths[0]; - trans2Plan->iDist = clLengths[0] * trans2Plan->inStride[1]; - trans2Plan->oDist = (1 + clLengths[1]/2) * trans2Plan->outStride[1]; - trans2Plan->gen = Transpose_GCN; - trans2Plan->transflag = true; - trans2Plan->transOutHorizontal = true; - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans2 plan failed" ) ); - - //Row transform 2 - //tmp->tmp - //size clLengths[0], batch clLengths[1] - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &clLengths[0] ), - _T( "CreateDefaultPlan Large1d second row plan failed" ) ); - - FFTPlan* row2Plan = NULL; - lockRAII* row2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, row2Plan, row2Lock ), _T( "fftRepo.getPlan failed" ) ); - - row2Plan->placeness = CLFFT_OUTOFPLACE; - row2Plan->precision = fftPlan->precision; - row2Plan->forwardScale = fftPlan->forwardScale; - row2Plan->backwardScale = fftPlan->backwardScale; - row2Plan->tmpBufSize = 0; - row2Plan->batchsize = fftPlan->batchsize; - - row2Plan->gen = fftPlan->gen; - row2Plan->envelope = fftPlan->envelope; - - - row2Plan->length.push_back(1+clLengths[1]/2); - row2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - row2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - row2Plan->inStride[0] = 1; - row2Plan->outStride[0] = 1; - row2Plan->inStride.push_back(clLengths[0]); - row2Plan->outStride.push_back(1 + clLengths[0]/2); - row2Plan->iDist = (1 + clLengths[1]/2) * row2Plan->inStride[1]; - row2Plan->oDist = clLengths[1] * row2Plan->outStride[1]; - - row2Plan->large1D = fftPlan->length[0]; - row2Plan->twiddleFront = true; - - row2Plan->realSpecial = true; - row2Plan->realSpecial_Nr = clLengths[1]; - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d second row plan failed" ) ); - - //Transpose 3 - //tmp --> output - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTZ, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan Large1d transpose 3 failed" ) ); - - FFTPlan* trans3Plan = NULL; - lockRAII* trans3Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTZ, trans3Plan, trans3Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans3Plan->transflag = true; - - transLengths[0] = 1 + clLengths[0]/2; - transLengths[1] = clLengths[1]; - OPENCL_V(clfftSetPlanLength( fftPlan->planTZ, CLFFT_2D, transLengths ), - _T( "clfftSetPlanLength for planTZ transpose failed" ) ); - - trans3Plan->placeness = CLFFT_OUTOFPLACE; - trans3Plan->precision = fftPlan->precision; - trans3Plan->tmpBufSize = 0; - trans3Plan->batchsize = fftPlan->batchsize; - trans3Plan->envelope = fftPlan->envelope; - trans3Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - if(fftPlan->outputLayout == CLFFT_HERMITIAN_PLANAR) - trans3Plan->outputLayout = CLFFT_COMPLEX_PLANAR; - else - trans3Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans3Plan->inStride[0] = 1; - trans3Plan->inStride[1] = 1 + clLengths[0]/2; - trans3Plan->outStride[0] = 1; - trans3Plan->outStride[1] = clLengths[1]; - trans3Plan->iDist = clLengths[1] * trans3Plan->inStride[1]; - trans3Plan->oDist = fftPlan->oDist; - trans3Plan->gen = Transpose_GCN; - trans3Plan->transflag = true; - trans3Plan->realSpecial = true; - trans3Plan->transOutHorizontal = true; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - trans3Plan->hasPostCallback = true; - trans3Plan->postCallbackParam = fftPlan->postCallbackParam; - trans3Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans3 plan failed" ) ); - - fftPlan->transflag = true; - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - else if (fftPlan->inputLayout == CLFFT_REAL) - { - if (fftPlan->tmpBufSizeRC == 0) - { - fftPlan->tmpBufSizeRC = length0 * length1 * - fftPlan->batchsize * fftPlan->ElementSize(); - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSizeRC *= fftPlan->length[index]; - } - } - - // column FFT, size clLengths[1], batch clLengths[0], with length[0] twiddle factor multiplication - // transposed output - OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, fftPlan->context, CLFFT_1D, &clLengths[1]), - _T("CreateDefaultPlan Large1d column failed")); - - FFTPlan* colTPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V(fftRepo.getPlan(fftPlan->planX, colTPlan, colLock), _T("fftRepo.getPlan failed")); - - // current plan is to create intermediate buffer, packed and interleave - // This is a column FFT, the first elements distance between each FFT is the distance of the first two - // elements in the original buffer. Like a transpose of the matrix - // we need to pass clLengths[0] and instride size to kernel, so kernel can tell the difference - - //this part are common for both passes - colTPlan->placeness = CLFFT_OUTOFPLACE; - colTPlan->precision = fftPlan->precision; - colTPlan->forwardScale = 1.0f; - colTPlan->backwardScale = 1.0f; - colTPlan->tmpBufSize = 0; - colTPlan->batchsize = fftPlan->batchsize; - - colTPlan->gen = fftPlan->gen; - colTPlan->envelope = fftPlan->envelope; - - //Pass large1D flag to confirm we need multiply twiddle factor - colTPlan->large1D = fftPlan->length[0]; - colTPlan->RCsimple = true; - - colTPlan->length.push_back(clLengths[0]); - - // first Pass - colTPlan->inputLayout = fftPlan->inputLayout; - colTPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colTPlan->inStride[0] = fftPlan->inStride[0] * clLengths[0]; - colTPlan->outStride[0] = 1; - colTPlan->iDist = fftPlan->iDist; - colTPlan->oDist = length0 * length1;//fftPlan->length[0]; - colTPlan->inStride.push_back(fftPlan->inStride[0]); - colTPlan->outStride.push_back(length1);//clLengths[1]); - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - colTPlan->length.push_back(fftPlan->length[index]); - colTPlan->inStride.push_back(fftPlan->inStride[index]); - // tmp buffer is tightly packed - colTPlan->outStride.push_back(colTPlan->oDist); - colTPlan->oDist *= fftPlan->length[index]; - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - colTPlan->hasPreCallback = true; - colTPlan->preCallback = fftPlan->preCallback; - colTPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL), _T("BakePlan large1d first column plan failed")); - - //another column FFT, size clLengths[0], batch clLengths[1], output without transpose - OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, fftPlan->context, CLFFT_1D, &clLengths[0]), - _T("CreateDefaultPlan large1D row failed")); - - FFTPlan* col2Plan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V(fftRepo.getPlan(fftPlan->planY, col2Plan, rowLock), _T("fftRepo.getPlan failed")); - - // This is second column fft, intermediate buffer is packed and interleaved - // we need to pass clLengths[1] and instride size to kernel, so kernel can tell the difference - - col2Plan->precision = fftPlan->precision; - col2Plan->forwardScale = fftPlan->forwardScale; - col2Plan->backwardScale = fftPlan->backwardScale; - col2Plan->tmpBufSize = 0; - col2Plan->batchsize = fftPlan->batchsize; - - col2Plan->gen = fftPlan->gen; - col2Plan->envelope = fftPlan->envelope; - - col2Plan->length.push_back(length1); - - col2Plan->inStride[0] = length1; - col2Plan->inStride.push_back(1); - col2Plan->iDist = length0 * length1; - - // make sure colTPlan (first column plan) does not recurse, otherwise large twiddle mul - // cannot be done with this algorithm sequence - assert(colTPlan->planX == 0); - - - col2Plan->placeness = CLFFT_INPLACE; - col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - - col2Plan->outStride[0] = length1; - col2Plan->outStride.push_back(1); - col2Plan->oDist = length0 * length1; - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - col2Plan->length.push_back(fftPlan->length[index]); - col2Plan->inStride.push_back(col2Plan->iDist); - col2Plan->outStride.push_back(col2Plan->oDist); - col2Plan->iDist *= fftPlan->length[index]; - col2Plan->oDist *= fftPlan->length[index]; - } - - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d second column plan failed" ) ); - - if ( (fftPlan->outputLayout == CLFFT_HERMITIAN_INTERLEAVED) || - (fftPlan->outputLayout == CLFFT_HERMITIAN_PLANAR) ) - { - // copy plan to get back to hermitian - OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planRCcopy, fftPlan->context, CLFFT_1D, &fftPlan->length[0]), - _T("CreateDefaultPlan RC copy failed")); - - FFTPlan* copyPlan = NULL; - lockRAII* copyLock = NULL; - OPENCL_V(fftRepo.getPlan(fftPlan->planRCcopy, copyPlan, copyLock), _T("fftRepo.getPlan failed")); - - // This is second column fft, intermediate buffer is packed and interleaved - // we need to pass clLengths[1] and instride size to kernel, so kernel can tell the difference - - // common part for both passes - copyPlan->placeness = CLFFT_OUTOFPLACE; - copyPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - copyPlan->outputLayout = fftPlan->outputLayout; - - copyPlan->precision = fftPlan->precision; - copyPlan->forwardScale = 1.0f; - copyPlan->backwardScale = 1.0f; - copyPlan->tmpBufSize = 0; - copyPlan->batchsize = fftPlan->batchsize; - - copyPlan->gen = Copy; - copyPlan->envelope = fftPlan->envelope; - - - copyPlan->inStride[0] = 1; - copyPlan->iDist = fftPlan->length[0]; - - copyPlan->outStride[0] = fftPlan->outStride[0]; - copyPlan->oDist = fftPlan->oDist; - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - copyPlan->length.push_back(fftPlan->length[index]); - copyPlan->inStride.push_back(copyPlan->inStride[index - 1] * fftPlan->length[index - 1]); - copyPlan->iDist *= fftPlan->length[index]; - copyPlan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - copyPlan->hasPostCallback = true; - copyPlan->postCallbackParam = fftPlan->postCallbackParam; - copyPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planRCcopy, numQueues, commQueueFFT, NULL, NULL), _T("BakePlan large1d RC copy plan failed")); - } - - } - else if(fftPlan->outputLayout == CLFFT_REAL) - { - if (fftPlan->tmpBufSizeRC==0 ) - { - fftPlan->tmpBufSizeRC = length0 * length1 * - fftPlan->batchsize * fftPlan->ElementSize(); - for (size_t index=1; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSizeRC *= fftPlan->length[index]; - } - } - - if ((fftPlan->inputLayout == CLFFT_HERMITIAN_INTERLEAVED) || - (fftPlan->inputLayout == CLFFT_HERMITIAN_PLANAR)) - { - // copy plan to from hermitian to full complex - OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planRCcopy, fftPlan->context, CLFFT_1D, &fftPlan->length[0]), - _T("CreateDefaultPlan RC copy failed")); - - FFTPlan* copyPlan = NULL; - lockRAII* copyLock = NULL; - OPENCL_V(fftRepo.getPlan(fftPlan->planRCcopy, copyPlan, copyLock), _T("fftRepo.getPlan failed")); - - // This is second column fft, intermediate buffer is packed and interleaved - // we need to pass clLengths[1] and instride size to kernel, so kernel can tell the difference - - // common part for both passes - copyPlan->placeness = CLFFT_OUTOFPLACE; - copyPlan->inputLayout = fftPlan->inputLayout; - copyPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - - copyPlan->precision = fftPlan->precision; - copyPlan->forwardScale = 1.0f; - copyPlan->backwardScale = 1.0f; - copyPlan->tmpBufSize = 0; - copyPlan->batchsize = fftPlan->batchsize; - - copyPlan->gen = Copy; - copyPlan->envelope = fftPlan->envelope; - - copyPlan->inStride[0] = fftPlan->inStride[0]; - copyPlan->iDist = fftPlan->iDist; - - copyPlan->outStride[0] = 1; - copyPlan->oDist = fftPlan->length[0]; - - for (size_t index = 1; index < fftPlan->length.size(); index++) - { - copyPlan->length.push_back(fftPlan->length[index]); - copyPlan->outStride.push_back(copyPlan->outStride[index - 1] * fftPlan->length[index - 1]); - copyPlan->oDist *= fftPlan->length[index]; - copyPlan->inStride.push_back(fftPlan->inStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - copyPlan->hasPreCallback = true; - copyPlan->preCallback = fftPlan->preCallback; - copyPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planRCcopy, numQueues, commQueueFFT, NULL, NULL), _T("BakePlan large1d RC copy plan failed")); - } - - // column FFT, size clLengths[1], batch clLengths[0], with length[0] twiddle factor multiplication - // transposed output - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &clLengths[1] ), - _T( "CreateDefaultPlan Large1d column failed" ) ); - - FFTPlan* colTPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, colTPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - // current plan is to create intermediate buffer, packed and interleave - // This is a column FFT, the first elements distance between each FFT is the distance of the first two - // elements in the original buffer. Like a transpose of the matrix - // we need to pass clLengths[0] and instride size to kernel, so kernel can tell the difference - - //this part are common for both passes - colTPlan->precision = fftPlan->precision; - colTPlan->forwardScale = 1.0f; - colTPlan->backwardScale = 1.0f; - colTPlan->tmpBufSize = 0; - colTPlan->batchsize = fftPlan->batchsize; - - colTPlan->gen = fftPlan->gen; - colTPlan->envelope = fftPlan->envelope; - - //Pass large1D flag to confirm we need multiply twiddle factor - colTPlan->large1D = fftPlan->length[0]; - - colTPlan->length.push_back(clLengths[0]); - - colTPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - colTPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - - colTPlan->inStride[0] = length0; - colTPlan->inStride.push_back(1); - colTPlan->iDist = length0 * length1; - - colTPlan->outStride[0] = length0; - colTPlan->outStride.push_back(1); - colTPlan->oDist = length0 * length1; - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - colTPlan->length.push_back(fftPlan->length[index]); - colTPlan->inStride.push_back(colTPlan->iDist); - colTPlan->outStride.push_back(colTPlan->oDist); - colTPlan->iDist *= fftPlan->length[index]; - colTPlan->oDist *= fftPlan->length[index]; - } - - if ((fftPlan->inputLayout == CLFFT_HERMITIAN_INTERLEAVED) || - (fftPlan->inputLayout == CLFFT_HERMITIAN_PLANAR)) - { - colTPlan->placeness = CLFFT_INPLACE; - } - else - { - colTPlan->placeness = CLFFT_OUTOFPLACE; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d first column plan failed" ) ); - - //another column FFT, size clLengths[0], batch clLengths[1], output without transpose - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &clLengths[0] ), - _T( "CreateDefaultPlan large1D row failed" ) ); - - FFTPlan* col2Plan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, col2Plan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - // This is second column fft, intermediate buffer is packed and interleaved - // we need to pass clLengths[1] and instride size to kernel, so kernel can tell the difference - - // common part for both passes - col2Plan->placeness = CLFFT_OUTOFPLACE; - col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->outputLayout = fftPlan->outputLayout; - - col2Plan->precision = fftPlan->precision; - col2Plan->forwardScale = fftPlan->forwardScale; - col2Plan->backwardScale = fftPlan->backwardScale; - col2Plan->tmpBufSize = 0; - col2Plan->batchsize = fftPlan->batchsize; - - col2Plan->gen = fftPlan->gen; - col2Plan->envelope = fftPlan->envelope; - - col2Plan->RCsimple = true; - col2Plan->length.push_back(length1); - - col2Plan->inStride[0] = 1; - col2Plan->inStride.push_back(length0); - col2Plan->iDist = length0 * length1; - - col2Plan->outStride[0] = length1 * fftPlan->outStride[0]; - col2Plan->outStride.push_back(fftPlan->outStride[0]); - col2Plan->oDist = fftPlan->oDist; - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - col2Plan->length.push_back(fftPlan->length[index]); - col2Plan->inStride.push_back(col2Plan->iDist); - col2Plan->iDist *= fftPlan->length[index]; - col2Plan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - col2Plan->hasPostCallback = true; - col2Plan->postCallbackParam = fftPlan->postCallbackParam; - col2Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d second column plan failed" ) ); - } - else - { - - if( (fftPlan->length[0] > 262144/PrecisionWidth(fftPlan->precision)) && fftPlan->blockCompute ) - { - assert(fftPlan->length[0] <= 1048576); - - - size_t padding = 64; - if (fftPlan->tmpBufSize==0 ) - { - fftPlan->tmpBufSize = (length1 + padding) * length0 * - fftPlan->batchsize * fftPlan->ElementSize(); - for (size_t index=1; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - } - - // Algorithm in this case is - // T(with pad, out_of_place), R (in_place), C(in_place), Unpad(out_of_place) - - size_t len[3] = { clLengths[1], clLengths[0], 1 }; - - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, len ), - _T( "CreateDefaultPlan Large1d trans1 failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->placeness = CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->inputLayout = fftPlan->inputLayout; - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inStride[0] = fftPlan->inStride[0]; - trans1Plan->inStride[1] = length1; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = length0 + padding; - trans1Plan->iDist = fftPlan->iDist; - trans1Plan->oDist = length1 * trans1Plan->outStride[1]; - trans1Plan->gen = Transpose_GCN; - trans1Plan->transflag = true; - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - trans1Plan->inStride.push_back(fftPlan->inStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - trans1Plan->hasPreCallback = true; - trans1Plan->preCallback = fftPlan->preCallback; - trans1Plan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans1 plan failed" ) ); - - - // row FFT - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &clLengths[0] ), - _T( "CreateDefaultPlan Large1d column failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - assert(fftPlan->large1D == 0); - - rowPlan->placeness = CLFFT_INPLACE; - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = 1.0f; - rowPlan->backwardScale = 1.0f; - rowPlan->tmpBufSize = 0; - rowPlan->batchsize = fftPlan->batchsize; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - - rowPlan->length.push_back(length1); - - - rowPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - rowPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - rowPlan->inStride[0] = 1; - rowPlan->outStride[0] = 1; - rowPlan->inStride.push_back(length0+padding); - rowPlan->outStride.push_back(length0+padding); - rowPlan->iDist = (length0+padding)*length1; - rowPlan->oDist = (length0+padding)*length1; - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - rowPlan->length.push_back(fftPlan->length[index]); - rowPlan->inStride.push_back(rowPlan->iDist); - rowPlan->iDist *= fftPlan->length[index]; - rowPlan->outStride.push_back(rowPlan->oDist); - rowPlan->oDist *= fftPlan->length[index]; - } - - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d first row plan failed" ) ); - - //column FFT - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &clLengths[1] ), - _T( "CreateDefaultPlan large1D column failed" ) ); - - FFTPlan* col2Plan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, col2Plan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - col2Plan->placeness = CLFFT_INPLACE; - col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->precision = fftPlan->precision; - col2Plan->forwardScale = fftPlan->forwardScale; - col2Plan->backwardScale = fftPlan->backwardScale; - col2Plan->tmpBufSize = 0; - col2Plan->batchsize = fftPlan->batchsize; - - col2Plan->gen = fftPlan->gen; - col2Plan->envelope = fftPlan->envelope; - - col2Plan->large1D = fftPlan->length[0]; - col2Plan->twiddleFront = true; - - col2Plan->length.push_back(clLengths[0]); - - - - col2Plan->blockCompute = true; - col2Plan->blockComputeType = BCT_C2C; - - col2Plan->inStride[0] = length0+padding; - col2Plan->outStride[0] = length0+padding; - col2Plan->iDist = (length0+padding) * length1; - col2Plan->oDist = (length0+padding) * length1; - col2Plan->inStride.push_back(1); - col2Plan->outStride.push_back(1); - - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - col2Plan->length.push_back(fftPlan->length[index]); - col2Plan->inStride.push_back(col2Plan->iDist); - col2Plan->outStride.push_back(col2Plan->oDist); - col2Plan->iDist *= fftPlan->length[index]; - col2Plan->oDist *= fftPlan->length[index]; - } - - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d second column plan failed" ) ); - - - // copy plan to get results back to packed output - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planCopy, fftPlan->context, CLFFT_1D, &clLengths[0] ), - _T( "CreateDefaultPlan Copy failed" ) ); - - FFTPlan* copyPlan = NULL; - lockRAII* copyLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planCopy, copyPlan, copyLock ), _T( "fftRepo.getPlan failed" ) ); - - - copyPlan->placeness = CLFFT_OUTOFPLACE; - copyPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - copyPlan->outputLayout = fftPlan->outputLayout; - - copyPlan->precision = fftPlan->precision; - copyPlan->forwardScale = 1.0f; - copyPlan->backwardScale = 1.0f; - copyPlan->tmpBufSize = 0; - copyPlan->batchsize = fftPlan->batchsize; - - copyPlan->gen = Copy; - copyPlan->envelope = fftPlan->envelope; - - copyPlan->length.push_back(length1); - - copyPlan->inStride[0] = 1; - copyPlan->inStride.push_back(length0+padding); - copyPlan->iDist = length1*(length0+padding); - - copyPlan->outStride[0] = fftPlan->outStride[0]; - copyPlan->outStride.push_back(length0); - copyPlan->oDist = fftPlan->oDist; - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - copyPlan->length.push_back(fftPlan->length[index]); - copyPlan->inStride.push_back(copyPlan->inStride[index] * copyPlan->length[index]); - copyPlan->iDist *= fftPlan->length[index]; - copyPlan->outStride.push_back(fftPlan->outStride[index]); - } - - OPENCL_V(clfftBakePlan(fftPlan->planCopy, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d copy plan failed" ) ); - } - else - { - - if (fftPlan->tmpBufSize==0 ) - { - fftPlan->tmpBufSize = length0 * length1 * - fftPlan->batchsize * fftPlan->ElementSize(); - for (size_t index=1; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - } + if (fftPlan->gen == Copy) { + clfftStatus err; + fftPlan->action = + new FFTGeneratedCopyAction(plHandle, fftPlan, *commQueueFFT, err); + OPENCL_V(err, _T( "FFTGeneratedCopyAction() failed" )); + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + + if (fftPlan->userPlan) { + // If the user specifies double precision, check that the device supports + //double precision first + if (fftPlan->precision == CLFFT_DOUBLE || + fftPlan->precision == CLFFT_DOUBLE_FAST) { + clfftStatus retAmdFp64 = checkDevExt("cl_amd_fp64", fftPlan->bakeDevice); + if (retAmdFp64 != CLFFT_SUCCESS) { + // If AMD's extention is not supported, check for Khronos extention + clfftStatus retKhrFp64 = + checkDevExt("cl_khr_fp64", fftPlan->bakeDevice); + if (retKhrFp64 != CLFFT_SUCCESS) + return retKhrFp64; + } + } + } + + // Compress the plan by discarding length '1' dimensions + // decision to pick generator + if (fftPlan->userPlan && !rc) // confirm it is top-level plan (user plan) + { + size_t dmnsn = fftPlan->dim; + bool pow2flag = true; + + // switch case flows with no 'break' statements + switch (fftPlan->dim) { + case CLFFT_3D: + + if (fftPlan->length[DimZ] == 1) { + dmnsn -= 1; + fftPlan->inStride.erase(fftPlan->inStride.begin() + 2); + fftPlan->outStride.erase(fftPlan->outStride.begin() + 2); + fftPlan->length.erase(fftPlan->length.begin() + 2); + } else { + if (!IsPo2(fftPlan->length[DimZ])) + pow2flag = false; + } + case CLFFT_2D: + + if (fftPlan->length[DimY] == 1) { + dmnsn -= 1; + fftPlan->inStride.erase(fftPlan->inStride.begin() + 1); + fftPlan->outStride.erase(fftPlan->outStride.begin() + 1); + fftPlan->length.erase(fftPlan->length.begin() + 1); + } else { + if (!IsPo2(fftPlan->length[DimY])) + pow2flag = false; + } + + case CLFFT_1D: + + if ((fftPlan->length[DimX] == 1) && (dmnsn > 1)) { + dmnsn -= 1; + fftPlan->inStride.erase(fftPlan->inStride.begin()); + fftPlan->outStride.erase(fftPlan->outStride.begin()); + fftPlan->length.erase(fftPlan->length.begin()); + } else { + if (!IsPo2(fftPlan->length[DimX])) + pow2flag = false; + } + } - // column FFT, size clLengths[1], batch clLengths[0], with length[0] twiddle factor multiplication - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &clLengths[1] ), - _T( "CreateDefaultPlan Large1d column failed" ) ); + fftPlan->dim = (clfftDim)dmnsn; + } + + // first time check transposed + if (fftPlan->transposed != CLFFT_NOTRANSPOSE && fftPlan->dim != CLFFT_2D && + fftPlan->dim == fftPlan->length.size()) + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + // The largest vector we can transform in a single pass + // depends on the GPU caps -- especially the amount of LDS + // available + // + size_t Large1DThreshold = 0; + + OPENCL_V(fftPlan->GetMax1DLength(&Large1DThreshold), + _T("GetMax1DLength failed")); + BUG_CHECK(Large1DThreshold > 1); + + // Verify that the data passed to us is packed + switch (fftPlan->dim) { + case CLFFT_1D: { + if (!Is1DPossible(fftPlan->length[0], Large1DThreshold)) { + size_t clLengths[] = {1, 1, 0}; + size_t in_1d, in_x, count; + + BUG_CHECK(IsPo2(Large1DThreshold)) + + if (IsPo2(fftPlan->length[0])) { + // Enable block compute under these conditions + if ((fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) && + !rc && + (fftPlan->length[0] <= + 262144 / PrecisionWidth(fftPlan->precision)) && + (fftPlan->length.size() <= 1) && + (!clfftGetRequestLibNoMemAlloc() || + (fftPlan->placeness == CLFFT_OUTOFPLACE))) { + fftPlan->blockCompute = true; + + if (1 == PrecisionWidth(fftPlan->precision)) { + switch (fftPlan->length[0]) { + case 8192: + clLengths[1] = 64; + break; + case 16384: + clLengths[1] = 64; + break; + case 32768: + clLengths[1] = 128; + break; + case 65536: + clLengths[1] = 256; + break; + case 131072: + clLengths[1] = 64; + break; + case 262144: + clLengths[1] = 64; + break; + case 524288: + clLengths[1] = 256; + break; + case 1048576: + clLengths[1] = 256; + break; + default: + assert(false); + } + } else { + switch (fftPlan->length[0]) { + case 4096: + clLengths[1] = 64; + break; + case 8192: + clLengths[1] = 64; + break; + case 16384: + clLengths[1] = 64; + break; + case 32768: + clLengths[1] = 128; + break; + case 65536: + clLengths[1] = 64; + break; + case 131072: + clLengths[1] = 64; + break; + case 262144: + clLengths[1] = 128; + break; + case 524288: + clLengths[1] = 256; + break; + default: + assert(false); + } + } + } else { + if (clfftGetRequestLibNoMemAlloc() && !rc && + (fftPlan->placeness == CLFFT_INPLACE)) { + in_x = BitScanF(fftPlan->length[0]); + in_x /= 2; + clLengths[1] = (size_t)1 << in_x; + } else if (fftPlan->length[0] > + (Large1DThreshold * Large1DThreshold)) { + clLengths[1] = fftPlan->length[0] / Large1DThreshold; + } else { + in_1d = + BitScanF(Large1DThreshold); // this is log2(LARGE1D_THRESHOLD) + in_x = BitScanF(fftPlan->length[0]); // this is log2(length) + BUG_CHECK(in_1d > 0) + count = in_x / in_1d; + if (count * in_1d < in_x) { + count++; + in_1d = in_x / count; + if (in_1d * count < in_x) + in_1d++; + } + clLengths[1] = (size_t)1 << in_1d; + } + } + } else { + // This array must be kept sorted in the ascending order + + size_t supported[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 18, 20, 21, 22, 24, 25, + 26, 27, 28, 30, 32, 33, 35, 36, 39, 40, 42, + 44, 45, 48, 49, 50, 52, 54, 55, 56, 60, 63, + 64, 65, 66, 70, 72, 75, 77, 78, 80, 81, 84, + 88, 90, 91, 96, 98, 99, 100, 104, 105, 108, 110, + 112, 117, 120, 121, 125, 126, 128, 130, 132, 135, 140, + 143, 144, 147, 150, 154, 156, 160, 162, 165, 168, 169, + 175, 176, 180, 182, 189, 192, 195, 196, 198, 200, 208, + 210, 216, 220, 224, 225, 231, 234, 240, 242, 243, 245, + 250, 252, 256, 260, 264, 270, 273, 275, 280, 286, 288, + 294, 297, 300, 308, 312, 315, 320, 324, 325, 330, 336, + 338, 343, 350, 351, 352, 360, 363, 364, 375, 378, 384, + 385, 390, 392, 396, 400, 405, 416, 420, 429, 432, 440, + 441, 448, 450, 455, 462, 468, 480, 484, 486, 490, 495, + 500, 504, 507, 512, 520, 525, 528, 539, 540, 546, 550, + 560, 567, 572, 576, 585, 588, 594, 600, 605, 616, 624, + 625, 630, 637, 640, 648, 650, 660, 672, 675, 676, 686, + 693, 700, 702, 704, 715, 720, 726, 728, 729, 735, 750, + 756, 768, 770, 780, 784, 792, 800, 810, 819, 825, 832, + 840, 845, 847, 858, 864, 875, 880, 882, 891, 896, 900, + 910, 924, 936, 945, 960, 968, 972, 975, 980, 990, 1000, + 1001, 1008, 1014, 1024, 1029, 1040, 1050, 1053, 1056, 1078, 1080, + 1089, 1092, 1100, 1120, 1125, 1134, 1144, 1152, 1155, 1170, 1176, + 1183, 1188, 1200, 1210, 1215, 1225, 1232, 1248, 1250, 1260, 1274, + 1280, 1287, 1296, 1300, 1320, 1323, 1331, 1344, 1350, 1352, 1365, + 1372, 1375, 1386, 1400, 1404, 1408, 1430, 1440, 1452, 1456, 1458, + 1470, 1485, 1500, 1512, 1521, 1536, 1540, 1560, 1568, 1573, 1575, + 1584, 1600, 1617, 1620, 1625, 1638, 1650, 1664, 1680, 1690, 1694, + 1701, 1715, 1716, 1728, 1750, 1755, 1760, 1764, 1782, 1792, 1800, + 1815, 1820, 1848, 1859, 1872, 1875, 1890, 1911, 1920, 1925, 1936, + 1944, 1950, 1960, 1980, 2000, 2002, 2016, 2025, 2028, 2048, 2058, + 2079, 2080, 2100, 2106, 2112, 2145, 2156, 2160, 2178, 2184, 2187, + 2197, 2200, 2205, 2240, 2250, 2268, 2275, 2288, 2304, 2310, 2340, + 2352, 2366, 2376, 2400, 2401, 2420, 2430, 2450, 2457, 2464, 2475, + 2496, 2500, 2520, 2535, 2541, 2548, 2560, 2574, 2592, 2600, 2625, + 2640, 2646, 2662, 2673, 2688, 2695, 2700, 2704, 2730, 2744, 2750, + 2772, 2800, 2808, 2816, 2835, 2860, 2880, 2904, 2912, 2916, 2925, + 2940, 2970, 3000, 3003, 3024, 3025, 3042, 3072, 3080, 3087, 3120, + 3125, 3136, 3146, 3150, 3159, 3168, 3185, 3200, 3234, 3240, 3250, + 3267, 3276, 3300, 3328, 3360, 3375, 3380, 3388, 3402, 3430, 3432, + 3456, 3465, 3500, 3510, 3520, 3528, 3549, 3564, 3575, 3584, 3600, + 3630, 3640, 3645, 3675, 3696, 3718, 3744, 3750, 3773, 3780, 3822, + 3840, 3850, 3861, 3872, 3888, 3900, 3920, 3960, 3969, 3993, 4000, + 4004, 4032, 4050, 4056, 4095, 4096}; + + size_t lenSupported = sizeof(supported) / sizeof(supported[0]); + size_t maxFactoredLength = + (supported[lenSupported - 1] < Large1DThreshold) + ? supported[lenSupported - 1] + : Large1DThreshold; + + size_t halfPowerLength = + (size_t)1 << ((StockhamGenerator::CeilPo2(fftPlan->length[0]) + 1) / + 2); + size_t factoredLengthStart = (halfPowerLength < maxFactoredLength) + ? halfPowerLength + : maxFactoredLength; + + size_t indexStart = 0; + while (supported[indexStart] < factoredLengthStart) + indexStart++; + + for (size_t i = indexStart; i >= 1; i--) { + if (fftPlan->length[0] % supported[i] == 0) { + if (Is1DPossible(supported[i], Large1DThreshold)) { + clLengths[1] = supported[i]; + break; + } + } + } + } + // add some special cases + /* + if (fftPlan->length[0] == 10000) + clLengths[1] = 100;//100 x 100 + if (fftPlan->length[0] == 100000) + clLengths[1] = 100;//100 x 1,000 + if (fftPlan->length[0] == 10000000) + clLengths[1] = 1000;//1,000 x 10,000 + if (fftPlan->length[0] == 100000000) + clLengths[1] = 10000;//10,000 x 10,000 + if (fftPlan->length[0] == 1000000000) + clLengths[1] = 10000;//10,000 x 100,000 + + if (fftPlan->length[0] == 3099363912) + clLengths[1] = 78732;//39366 x 78732 + if (fftPlan->length[0] == 39366) + clLengths[1] = 81;//81*486 + if (fftPlan->length[0] == 78732) + clLengths[1] = 162;//162*486 + if (fftPlan->length[0] == 354294) + clLengths[1] = 243; + */ + size_t threshold = 4096; + if (fftPlan->precision == CLFFT_DOUBLE) + threshold = 2048; + if (clfftGetRequestLibNoMemAlloc() && + fftPlan->placeness == CLFFT_INPLACE && + (fftPlan->inputLayout == fftPlan->outputLayout) && + fftPlan->length[0] > threshold) { + // for inplace fft with inplace transpose, the split logic is different + vector> splitNums; + bool implemented = split1D_for_inplace(fftPlan->length[0], splitNums, + fftPlan->precision, threshold); + if (implemented) + clLengths[1] = splitNums[0][0]; + } + + clLengths[0] = fftPlan->length[0] / clLengths[1]; + + // Start of block where transposes are generated; 1D FFT + while (true && (fftPlan->inputLayout != CLFFT_REAL) && + (fftPlan->outputLayout != CLFFT_REAL)) { + if (fftPlan->length[0] <= Large1DThreshold) + break; + + if (fftPlan->inStride[0] != 1 || fftPlan->outStride[0] != 1) + break; + + if (IsPo2(fftPlan->length[0]) && + (fftPlan->length[0] <= + 262144 / PrecisionWidth(fftPlan->precision)) && + (fftPlan->length.size() <= 1) && + (!clfftGetRequestLibNoMemAlloc() || + (fftPlan->placeness == CLFFT_OUTOFPLACE))) + break; + + if (clLengths[0] <= 32 && clLengths[1] <= 32) + break; + + size_t biggerDim = + clLengths[0] > clLengths[1] ? clLengths[0] : clLengths[1]; + size_t smallerDim = + biggerDim == clLengths[0] ? clLengths[1] : clLengths[0]; + size_t padding = 0; + if ((smallerDim % 64 == 0) || (biggerDim % 64 == 0)) + padding = 64; + + clfftGenerators transGen = Transpose_GCN; + + size_t dim_ratio = biggerDim / smallerDim; + size_t dim_residue = biggerDim % smallerDim; + // If this is an in-place transform the + // input and output layout, dimensions and strides + // *MUST* be the same. + // + bool inStrideEqualsOutStride = true; + for (size_t u = fftPlan->inStride.size(); u-- > 0;) { + if (fftPlan->inStride[u] != fftPlan->outStride[u]) { + inStrideEqualsOutStride = false; + break; + } + } + // packed data is required for inplace transpose + bool isDataPacked = true; + for (size_t u = 0; u < fftPlan->inStride.size(); u++) { + if (u == 0) { + if (fftPlan->inStride[0] == 1) + continue; + else { + isDataPacked = false; + break; + } + } else { + size_t packDataSize = 1; + for (size_t i = 0; i < u; i++) + packDataSize *= fftPlan->length[i]; + if (fftPlan->inStride[u] == packDataSize) + continue; + else { + isDataPacked = false; + break; + } + } + } + if (clfftGetRequestLibNoMemAlloc() && dim_residue == 0 && + ((dim_ratio % 2 == 0) || (dim_ratio % 3 == 0) || + (dim_ratio % 5 == 0) || (dim_ratio % 10 == 0)) && + fftPlan->placeness == CLFFT_INPLACE && + (fftPlan->inputLayout == fftPlan->outputLayout) && + (inStrideEqualsOutStride) && (isDataPacked)) { + padding = 0; + fftPlan->allOpsInplace = true; + transGen = Transpose_NONSQUARE; + // std::cout << "Transpose_NONSQUARE" << std::endl; + } + + if (clfftGetRequestLibNoMemAlloc() && (clLengths[0] == clLengths[1]) && + fftPlan->placeness == CLFFT_INPLACE) { + padding = 0; + fftPlan->allOpsInplace = true; + transGen = Transpose_SQUARE; + } + + if (fftPlan->tmpBufSize != 0) + padding = 0; + + if ((fftPlan->tmpBufSize == 0) && !fftPlan->allOpsInplace) { + fftPlan->tmpBufSize = (smallerDim + padding) * biggerDim * + fftPlan->batchsize * fftPlan->ElementSize(); + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + } + + // Transpose + // Input --> tmp buffer + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan Large1d transpose 1 failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->placeness = + fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->inputLayout = fftPlan->inputLayout; + trans1Plan->outputLayout = fftPlan->allOpsInplace + ? fftPlan->inputLayout + : CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inStride[0] = fftPlan->inStride[0]; + trans1Plan->inStride[1] = clLengths[0]; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = clLengths[1] + padding; + trans1Plan->iDist = fftPlan->iDist; + trans1Plan->oDist = clLengths[0] * trans1Plan->outStride[1]; + trans1Plan->gen = transGen; + trans1Plan->transflag = true; + + if (trans1Plan->gen == Transpose_NONSQUARE || + trans1Plan->gen == Transpose_SQUARE) // inplace transpose + { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + // trans1Plan->length.push_back(fftPlan->length[index]); + /* + replacing the line above with the two lines below since: + fftPlan is still 1D, thus the broken down transpose should be 2D not + 3D the batchSize for the transpose should increase accordingly. the + iDist should decrease accordingly. Push back to length will cause a + 3D transpose + */ + trans1Plan->batchsize = + trans1Plan->batchsize * fftPlan->length[index]; + trans1Plan->iDist = trans1Plan->iDist / fftPlan->length[index]; + + trans1Plan->inStride.push_back(fftPlan->inStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + } else { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + + trans1Plan->inStride.push_back(fftPlan->inStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + trans1Plan->hasPreCallback = true; + trans1Plan->preCallback = fftPlan->preCallback; + trans1Plan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d trans1 plan failed" )); + + // Row transform + // tmp->output + // size clLengths[1], batch clLengths[0], with length[0] twiddle factor + // multiplication + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &clLengths[1]), + _T( "CreateDefaultPlan Large1d column failed" )); + + FFTPlan *row1Plan = nullptr; + lockRAII *row1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, row1Plan, row1Lock), + _T( "fftRepo.getPlan failed" )); + + row1Plan->placeness = + fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; + row1Plan->precision = fftPlan->precision; + row1Plan->forwardScale = 1.0f; + row1Plan->backwardScale = 1.0f; + row1Plan->tmpBufSize = 0; + row1Plan->batchsize = fftPlan->batchsize; + + row1Plan->gen = fftPlan->gen; + row1Plan->envelope = fftPlan->envelope; + + // twiddling is done in row2 + row1Plan->large1D = 0; + + row1Plan->length.push_back(clLengths[0]); + row1Plan->inputLayout = fftPlan->allOpsInplace + ? fftPlan->inputLayout + : CLFFT_COMPLEX_INTERLEAVED; + row1Plan->outputLayout = fftPlan->outputLayout; + row1Plan->inStride[0] = 1; + row1Plan->outStride[0] = fftPlan->outStride[0]; + row1Plan->inStride.push_back(clLengths[1] + padding); + row1Plan->outStride.push_back(clLengths[1]); + row1Plan->iDist = clLengths[0] * row1Plan->inStride[1]; + row1Plan->oDist = fftPlan->oDist; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + row1Plan->length.push_back(fftPlan->length[index]); + row1Plan->inStride.push_back(row1Plan->iDist); + row1Plan->iDist *= fftPlan->length[index]; + row1Plan->outStride.push_back(fftPlan->outStride[index]); + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d first row plan failed" )); + + // Transpose 2 + // Output --> tmp buffer + clLengths[2] = clLengths[0]; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTY, + fftPlan->context, CLFFT_2D, + &clLengths[1]), + _T( "CreateDefaultPlan Large1d transpose 2 failed" )); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans2Plan, trans2Lock), + _T( "fftRepo.getPlan failed" )); + + trans2Plan->placeness = + fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->inputLayout = fftPlan->outputLayout; + trans2Plan->outputLayout = fftPlan->allOpsInplace + ? fftPlan->inputLayout + : CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->inStride[0] = fftPlan->outStride[0]; + trans2Plan->inStride[1] = clLengths[1]; + trans2Plan->outStride[0] = 1; + trans2Plan->outStride[1] = clLengths[0] + padding; + trans2Plan->iDist = fftPlan->oDist; + trans2Plan->oDist = clLengths[1] * trans2Plan->outStride[1]; + trans2Plan->gen = transGen; + + // if (transGen != Transpose_NONSQUARE)//twiddle + trans2Plan->large1D = fftPlan->length[0]; + + trans2Plan->transflag = true; + + if (trans2Plan->gen == Transpose_NONSQUARE || + trans2Plan->gen == Transpose_SQUARE) // inplace transpose + { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + // trans2Plan->length.push_back(fftPlan->length[index]); + /* + replacing the line above with the two lines below since: + fftPlan is still 1D, thus the broken down transpose should be 2D not + 3D the batchSize for the transpose should increase accordingly. the + iDist should decrease accordingly. Push back to length will cause a + 3D transpose + */ + trans2Plan->batchsize = + trans2Plan->batchsize * fftPlan->length[index]; + trans2Plan->iDist = trans2Plan->iDist / fftPlan->length[index]; + trans2Plan->inStride.push_back(fftPlan->outStride[index]); + trans2Plan->outStride.push_back(trans2Plan->oDist); + trans2Plan->oDist *= fftPlan->length[index]; + } + } else { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + trans2Plan->length.push_back(fftPlan->length[index]); + + trans2Plan->inStride.push_back(fftPlan->outStride[index]); + trans2Plan->outStride.push_back(trans2Plan->oDist); + trans2Plan->oDist *= fftPlan->length[index]; + } + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d trans2 plan failed" )); + + // Row transform 2 + // tmp->tmp + // size clLengths[0], batch clLengths[1] + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T( "CreateDefaultPlan Large1d second row plan failed" )); + + FFTPlan *row2Plan = nullptr; + lockRAII *row2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, row2Plan, row2Lock), + _T( "fftRepo.getPlan failed" )); + + row2Plan->placeness = CLFFT_INPLACE; + row2Plan->precision = fftPlan->precision; + row2Plan->forwardScale = fftPlan->forwardScale; + row2Plan->backwardScale = fftPlan->backwardScale; + row2Plan->tmpBufSize = 0; + row2Plan->batchsize = fftPlan->batchsize; + + row2Plan->gen = fftPlan->gen; + row2Plan->envelope = fftPlan->envelope; + + row2Plan->length.push_back(clLengths[1]); + row2Plan->inputLayout = fftPlan->allOpsInplace + ? fftPlan->inputLayout + : CLFFT_COMPLEX_INTERLEAVED; + row2Plan->outputLayout = fftPlan->allOpsInplace + ? fftPlan->inputLayout + : CLFFT_COMPLEX_INTERLEAVED; + row2Plan->inStride[0] = 1; + row2Plan->outStride[0] = 1; + row2Plan->inStride.push_back(clLengths[0] + padding); + row2Plan->outStride.push_back(clLengths[0] + padding); + row2Plan->iDist = clLengths[1] * row2Plan->inStride[1]; + row2Plan->oDist = clLengths[1] * row2Plan->outStride[1]; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + row2Plan->length.push_back(fftPlan->length[index]); + row2Plan->inStride.push_back(row2Plan->iDist); + row2Plan->outStride.push_back(row2Plan->oDist); + row2Plan->iDist *= fftPlan->length[index]; + row2Plan->oDist *= fftPlan->length[index]; + } + + // if (transGen != Transpose_NONSQUARE)//twiddle in transform + //{ + // row2Plan->large1D = fftPlan->length[0]; + // row2Plan->twiddleFront = true; + //} + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d second row plan failed" )); + + // Transpose 3 + // tmp --> output + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTZ, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan Large1d transpose 3 failed" )); + + FFTPlan *trans3Plan = nullptr; + lockRAII *trans3Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTZ, trans3Plan, trans3Lock), + _T( "fftRepo.getPlan failed" )); + + trans3Plan->placeness = + fftPlan->allOpsInplace ? CLFFT_INPLACE : CLFFT_OUTOFPLACE; + trans3Plan->precision = fftPlan->precision; + trans3Plan->tmpBufSize = 0; + trans3Plan->batchsize = fftPlan->batchsize; + trans3Plan->envelope = fftPlan->envelope; + trans3Plan->inputLayout = fftPlan->allOpsInplace + ? fftPlan->inputLayout + : CLFFT_COMPLEX_INTERLEAVED; + trans3Plan->outputLayout = fftPlan->outputLayout; + trans3Plan->inStride[0] = 1; + trans3Plan->inStride[1] = clLengths[0] + padding; + trans3Plan->outStride[0] = fftPlan->outStride[0]; + trans3Plan->outStride[1] = clLengths[1]; + trans3Plan->iDist = clLengths[1] * trans3Plan->inStride[1]; + trans3Plan->oDist = fftPlan->oDist; + trans3Plan->gen = transGen; + trans3Plan->transflag = true; + trans3Plan->transOutHorizontal = true; + + if (trans3Plan->gen == Transpose_NONSQUARE) // inplace transpose + { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + // trans3Plan->length.push_back(fftPlan->length[index]); + /* + replacing the line above with the two lines below since: + fftPlan is still 1D, thus the broken down transpose should be 2D not + 3D the batchSize for the transpose should increase accordingly. the + iDist should decrease accordingly. Push back to length will cause a + 3D transpose + */ + trans3Plan->batchsize = + trans3Plan->batchsize * fftPlan->length[index]; + // trans3Plan->iDist = trans3Plan->iDist / fftPlan->length[index]; + // trans3Plan->inStride.push_back(trans3Plan->iDist); + trans3Plan->inStride.push_back(fftPlan->inStride[index]); + // trans3Plan->iDist *= fftPlan->length[index]; + trans3Plan->outStride.push_back(fftPlan->outStride[index]); + } + } else if (trans3Plan->gen == Transpose_SQUARE) { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + trans3Plan->batchsize = + trans3Plan->batchsize * fftPlan->length[index]; + // trans3Plan->iDist = trans3Plan->iDist / fftPlan->length[index]; + // trans3Plan->inStride.push_back(trans3Plan->iDist); + trans3Plan->inStride.push_back(fftPlan->inStride[index]); + // trans3Plan->iDist *= fftPlan->length[index]; + trans3Plan->outStride.push_back(fftPlan->outStride[index]); + } + } else { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + trans3Plan->length.push_back(fftPlan->length[index]); + + trans3Plan->inStride.push_back(trans3Plan->iDist); + trans3Plan->iDist *= fftPlan->length[index]; + trans3Plan->outStride.push_back(fftPlan->outStride[index]); + } + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + trans3Plan->hasPostCallback = true; + trans3Plan->postCallbackParam = fftPlan->postCallbackParam; + trans3Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d trans3 plan failed" )); + + fftPlan->transflag = true; + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + + size_t length0 = clLengths[0]; + size_t length1 = clLengths[1]; + + // For real transforms + // Special case optimization with 5-step algorithm + if ((fftPlan->inputLayout == CLFFT_REAL) && IsPo2(fftPlan->length[0]) && + (fftPlan->length.size() == 1) && (fftPlan->inStride[0] == 1) && + (fftPlan->outStride[0] == 1) && (fftPlan->length[0] > 4096) && + (fftPlan->length.size() == 1)) { + + ARG_CHECK(clLengths[0] <= Large1DThreshold); + + size_t biggerDim = + clLengths[0] > clLengths[1] ? clLengths[0] : clLengths[1]; + size_t smallerDim = + biggerDim == clLengths[0] ? clLengths[1] : clLengths[0]; + size_t padding = 0; + if ((smallerDim % 64 == 0) || (biggerDim % 64 == 0)) + padding = 64; + + if (fftPlan->tmpBufSize == 0) { + size_t Nf = (1 + smallerDim / 2) * biggerDim; + fftPlan->tmpBufSize = (smallerDim + padding) * biggerDim / 2; + + if (fftPlan->tmpBufSize < Nf) + fftPlan->tmpBufSize = Nf; + + fftPlan->tmpBufSize *= (fftPlan->batchsize * fftPlan->ElementSize()); + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + } + + if (fftPlan->tmpBufSizeRC == 0) { + fftPlan->tmpBufSizeRC = fftPlan->tmpBufSize; + } + + // Transpose + // Input --> tmp buffer + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan Large1d transpose 1 failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->placeness = CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->inputLayout = fftPlan->inputLayout; + trans1Plan->outputLayout = CLFFT_REAL; + trans1Plan->inStride[0] = fftPlan->inStride[0]; + trans1Plan->inStride[1] = clLengths[0]; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = clLengths[1] + padding; + trans1Plan->iDist = fftPlan->iDist; + trans1Plan->oDist = clLengths[0] * trans1Plan->outStride[1]; + trans1Plan->gen = Transpose_GCN; + trans1Plan->transflag = true; + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + trans1Plan->hasPreCallback = true; + trans1Plan->preCallback = fftPlan->preCallback; + trans1Plan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d trans1 plan failed" )); + + // Row transform + // tmp->output + // size clLengths[1], batch clLengths[0], with length[0] twiddle factor + // multiplication + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &clLengths[1]), + _T( "CreateDefaultPlan Large1d column failed" )); + + FFTPlan *row1Plan = nullptr; + lockRAII *row1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, row1Plan, row1Lock), + _T( "fftRepo.getPlan failed" )); + + row1Plan->placeness = CLFFT_OUTOFPLACE; + row1Plan->precision = fftPlan->precision; + row1Plan->forwardScale = 1.0f; + row1Plan->backwardScale = 1.0f; + row1Plan->tmpBufSize = 0; + row1Plan->batchsize = fftPlan->batchsize; + + row1Plan->gen = fftPlan->gen; + row1Plan->envelope = fftPlan->envelope; + + // twiddling is done in row2 + row1Plan->large1D = 0; + + row1Plan->length.push_back(clLengths[0]); + row1Plan->inputLayout = CLFFT_REAL; + row1Plan->outputLayout = CLFFT_HERMITIAN_INTERLEAVED; + row1Plan->inStride[0] = 1; + row1Plan->outStride[0] = 1; + row1Plan->inStride.push_back(clLengths[1] + padding); + row1Plan->outStride.push_back(1 + clLengths[1] / 2); + row1Plan->iDist = clLengths[0] * row1Plan->inStride[1]; + row1Plan->oDist = clLengths[0] * row1Plan->outStride[1]; + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d first row plan failed" )); + + // Transpose 2 + // Output --> tmp buffer + clLengths[2] = clLengths[0]; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTY, + fftPlan->context, CLFFT_2D, + &clLengths[1]), + _T( "CreateDefaultPlan Large1d transpose 2 failed" )); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans2Plan, trans2Lock), + _T( "fftRepo.getPlan failed" )); + + trans2Plan->transflag = true; + + size_t transLengths[2]; + transLengths[0] = 1 + clLengths[1] / 2; + transLengths[1] = clLengths[0]; + OPENCL_V(clfftSetPlanLength(fftPlan->planTY, CLFFT_2D, transLengths), + _T( "clfftSetPlanLength for planTY transpose failed" )); + + trans2Plan->placeness = CLFFT_OUTOFPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->inStride[0] = 1; + trans2Plan->inStride[1] = 1 + clLengths[1] / 2; + trans2Plan->outStride[0] = 1; + trans2Plan->outStride[1] = clLengths[0]; + trans2Plan->iDist = clLengths[0] * trans2Plan->inStride[1]; + trans2Plan->oDist = (1 + clLengths[1] / 2) * trans2Plan->outStride[1]; + trans2Plan->gen = Transpose_GCN; + trans2Plan->transflag = true; + trans2Plan->transOutHorizontal = true; + + OPENCL_V( + clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d trans2 plan failed" )); + + // Row transform 2 + // tmp->tmp + // size clLengths[0], batch clLengths[1] + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T( "CreateDefaultPlan Large1d second row plan failed" )); + + FFTPlan *row2Plan = nullptr; + lockRAII *row2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, row2Plan, row2Lock), + _T( "fftRepo.getPlan failed" )); + + row2Plan->placeness = CLFFT_OUTOFPLACE; + row2Plan->precision = fftPlan->precision; + row2Plan->forwardScale = fftPlan->forwardScale; + row2Plan->backwardScale = fftPlan->backwardScale; + row2Plan->tmpBufSize = 0; + row2Plan->batchsize = fftPlan->batchsize; + + row2Plan->gen = fftPlan->gen; + row2Plan->envelope = fftPlan->envelope; + + row2Plan->length.push_back(1 + clLengths[1] / 2); + row2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + row2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + row2Plan->inStride[0] = 1; + row2Plan->outStride[0] = 1; + row2Plan->inStride.push_back(clLengths[0]); + row2Plan->outStride.push_back(1 + clLengths[0] / 2); + row2Plan->iDist = (1 + clLengths[1] / 2) * row2Plan->inStride[1]; + row2Plan->oDist = clLengths[1] * row2Plan->outStride[1]; + + row2Plan->large1D = fftPlan->length[0]; + row2Plan->twiddleFront = true; + + row2Plan->realSpecial = true; + row2Plan->realSpecial_Nr = clLengths[1]; + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d second row plan failed" )); + + // Transpose 3 + // tmp --> output + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTZ, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan Large1d transpose 3 failed" )); + + FFTPlan *trans3Plan = nullptr; + lockRAII *trans3Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTZ, trans3Plan, trans3Lock), + _T( "fftRepo.getPlan failed" )); + + trans3Plan->transflag = true; + + transLengths[0] = 1 + clLengths[0] / 2; + transLengths[1] = clLengths[1]; + OPENCL_V(clfftSetPlanLength(fftPlan->planTZ, CLFFT_2D, transLengths), + _T( "clfftSetPlanLength for planTZ transpose failed" )); + + trans3Plan->placeness = CLFFT_OUTOFPLACE; + trans3Plan->precision = fftPlan->precision; + trans3Plan->tmpBufSize = 0; + trans3Plan->batchsize = fftPlan->batchsize; + trans3Plan->envelope = fftPlan->envelope; + trans3Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + if (fftPlan->outputLayout == CLFFT_HERMITIAN_PLANAR) + trans3Plan->outputLayout = CLFFT_COMPLEX_PLANAR; + else + trans3Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans3Plan->inStride[0] = 1; + trans3Plan->inStride[1] = 1 + clLengths[0] / 2; + trans3Plan->outStride[0] = 1; + trans3Plan->outStride[1] = clLengths[1]; + trans3Plan->iDist = clLengths[1] * trans3Plan->inStride[1]; + trans3Plan->oDist = fftPlan->oDist; + trans3Plan->gen = Transpose_GCN; + trans3Plan->transflag = true; + trans3Plan->realSpecial = true; + trans3Plan->transOutHorizontal = true; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + trans3Plan->hasPostCallback = true; + trans3Plan->postCallbackParam = fftPlan->postCallbackParam; + trans3Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d trans3 plan failed" )); + + fftPlan->transflag = true; + fftPlan->baked = true; + return CLFFT_SUCCESS; + } else if (fftPlan->inputLayout == CLFFT_REAL) { + if (fftPlan->tmpBufSizeRC == 0) { + fftPlan->tmpBufSizeRC = + length0 * length1 * fftPlan->batchsize * fftPlan->ElementSize(); + for (size_t index = 1; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSizeRC *= fftPlan->length[index]; + } + } + + // column FFT, size clLengths[1], batch clLengths[0], with length[0] + // twiddle factor multiplication transposed output + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &clLengths[1]), + _T("CreateDefaultPlan Large1d column failed")); + + FFTPlan *colTPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, colTPlan, colLock), + _T("fftRepo.getPlan failed")); + + // current plan is to create intermediate buffer, packed and interleave + // This is a column FFT, the first elements distance between each FFT is + // the distance of the first two elements in the original buffer. Like a + // transpose of the matrix we need to pass clLengths[0] and instride + // size to kernel, so kernel can tell the difference + + // this part are common for both passes + colTPlan->placeness = CLFFT_OUTOFPLACE; + colTPlan->precision = fftPlan->precision; + colTPlan->forwardScale = 1.0f; + colTPlan->backwardScale = 1.0f; + colTPlan->tmpBufSize = 0; + colTPlan->batchsize = fftPlan->batchsize; + + colTPlan->gen = fftPlan->gen; + colTPlan->envelope = fftPlan->envelope; + + // Pass large1D flag to confirm we need multiply twiddle factor + colTPlan->large1D = fftPlan->length[0]; + colTPlan->RCsimple = true; + + colTPlan->length.push_back(clLengths[0]); + + // first Pass + colTPlan->inputLayout = fftPlan->inputLayout; + colTPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colTPlan->inStride[0] = fftPlan->inStride[0] * clLengths[0]; + colTPlan->outStride[0] = 1; + colTPlan->iDist = fftPlan->iDist; + colTPlan->oDist = length0 * length1; // fftPlan->length[0]; + colTPlan->inStride.push_back(fftPlan->inStride[0]); + colTPlan->outStride.push_back(length1); // clLengths[1]); + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + colTPlan->length.push_back(fftPlan->length[index]); + colTPlan->inStride.push_back(fftPlan->inStride[index]); + // tmp buffer is tightly packed + colTPlan->outStride.push_back(colTPlan->oDist); + colTPlan->oDist *= fftPlan->length[index]; + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + colTPlan->hasPreCallback = true; + colTPlan->preCallback = fftPlan->preCallback; + colTPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T("BakePlan large1d first column plan failed")); + + // another column FFT, size clLengths[0], batch clLengths[1], output + // without transpose + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T("CreateDefaultPlan large1D row failed")); + + FFTPlan *col2Plan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, col2Plan, rowLock), + _T("fftRepo.getPlan failed")); + + // This is second column fft, intermediate buffer is packed and + // interleaved we need to pass clLengths[1] and instride size to kernel, + // so kernel can tell the difference + + col2Plan->precision = fftPlan->precision; + col2Plan->forwardScale = fftPlan->forwardScale; + col2Plan->backwardScale = fftPlan->backwardScale; + col2Plan->tmpBufSize = 0; + col2Plan->batchsize = fftPlan->batchsize; + + col2Plan->gen = fftPlan->gen; + col2Plan->envelope = fftPlan->envelope; + + col2Plan->length.push_back(length1); + + col2Plan->inStride[0] = length1; + col2Plan->inStride.push_back(1); + col2Plan->iDist = length0 * length1; + + // make sure colTPlan (first column plan) does not recurse, otherwise + // large twiddle mul cannot be done with this algorithm sequence + assert(colTPlan->planX == 0); + + col2Plan->placeness = CLFFT_INPLACE; + col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + + col2Plan->outStride[0] = length1; + col2Plan->outStride.push_back(1); + col2Plan->oDist = length0 * length1; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + col2Plan->length.push_back(fftPlan->length[index]); + col2Plan->inStride.push_back(col2Plan->iDist); + col2Plan->outStride.push_back(col2Plan->oDist); + col2Plan->iDist *= fftPlan->length[index]; + col2Plan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d second column plan failed" )); + + if ((fftPlan->outputLayout == CLFFT_HERMITIAN_INTERLEAVED) || + (fftPlan->outputLayout == CLFFT_HERMITIAN_PLANAR)) { + // copy plan to get back to hermitian + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planRCcopy, + fftPlan->context, CLFFT_1D, + &fftPlan->length[0]), + _T("CreateDefaultPlan RC copy failed")); + + FFTPlan *copyPlan = nullptr; + lockRAII *copyLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planRCcopy, copyPlan, copyLock), + _T("fftRepo.getPlan failed")); + + // This is second column fft, intermediate buffer is packed and + // interleaved we need to pass clLengths[1] and instride size to + // kernel, so kernel can tell the difference + + // common part for both passes + copyPlan->placeness = CLFFT_OUTOFPLACE; + copyPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + copyPlan->outputLayout = fftPlan->outputLayout; + + copyPlan->precision = fftPlan->precision; + copyPlan->forwardScale = 1.0f; + copyPlan->backwardScale = 1.0f; + copyPlan->tmpBufSize = 0; + copyPlan->batchsize = fftPlan->batchsize; + + copyPlan->gen = Copy; + copyPlan->envelope = fftPlan->envelope; + + copyPlan->inStride[0] = 1; + copyPlan->iDist = fftPlan->length[0]; + + copyPlan->outStride[0] = fftPlan->outStride[0]; + copyPlan->oDist = fftPlan->oDist; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + copyPlan->length.push_back(fftPlan->length[index]); + copyPlan->inStride.push_back(copyPlan->inStride[index - 1] * + fftPlan->length[index - 1]); + copyPlan->iDist *= fftPlan->length[index]; + copyPlan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + copyPlan->hasPostCallback = true; + copyPlan->postCallbackParam = fftPlan->postCallbackParam; + copyPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planRCcopy, numQueues, commQueueFFT, + nullptr, nullptr), + _T("BakePlan large1d RC copy plan failed")); + } + + } else if (fftPlan->outputLayout == CLFFT_REAL) { + if (fftPlan->tmpBufSizeRC == 0) { + fftPlan->tmpBufSizeRC = + length0 * length1 * fftPlan->batchsize * fftPlan->ElementSize(); + for (size_t index = 1; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSizeRC *= fftPlan->length[index]; + } + } + + if ((fftPlan->inputLayout == CLFFT_HERMITIAN_INTERLEAVED) || + (fftPlan->inputLayout == CLFFT_HERMITIAN_PLANAR)) { + // copy plan to from hermitian to full complex + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planRCcopy, + fftPlan->context, CLFFT_1D, + &fftPlan->length[0]), + _T("CreateDefaultPlan RC copy failed")); + + FFTPlan *copyPlan = nullptr; + lockRAII *copyLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planRCcopy, copyPlan, copyLock), + _T("fftRepo.getPlan failed")); + + // This is second column fft, intermediate buffer is packed and + // interleaved we need to pass clLengths[1] and instride size to + // kernel, so kernel can tell the difference + + // common part for both passes + copyPlan->placeness = CLFFT_OUTOFPLACE; + copyPlan->inputLayout = fftPlan->inputLayout; + copyPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + + copyPlan->precision = fftPlan->precision; + copyPlan->forwardScale = 1.0f; + copyPlan->backwardScale = 1.0f; + copyPlan->tmpBufSize = 0; + copyPlan->batchsize = fftPlan->batchsize; + + copyPlan->gen = Copy; + copyPlan->envelope = fftPlan->envelope; + + copyPlan->inStride[0] = fftPlan->inStride[0]; + copyPlan->iDist = fftPlan->iDist; + + copyPlan->outStride[0] = 1; + copyPlan->oDist = fftPlan->length[0]; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + copyPlan->length.push_back(fftPlan->length[index]); + copyPlan->outStride.push_back(copyPlan->outStride[index - 1] * + fftPlan->length[index - 1]); + copyPlan->oDist *= fftPlan->length[index]; + copyPlan->inStride.push_back(fftPlan->inStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + copyPlan->hasPreCallback = true; + copyPlan->preCallback = fftPlan->preCallback; + copyPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planRCcopy, numQueues, commQueueFFT, + nullptr, nullptr), + _T("BakePlan large1d RC copy plan failed")); + } + + // column FFT, size clLengths[1], batch clLengths[0], with length[0] + // twiddle factor multiplication transposed output + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &clLengths[1]), + _T( "CreateDefaultPlan Large1d column failed" )); + + FFTPlan *colTPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, colTPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + // current plan is to create intermediate buffer, packed and interleave + // This is a column FFT, the first elements distance between each FFT is + // the distance of the first two elements in the original buffer. Like a + // transpose of the matrix we need to pass clLengths[0] and instride + // size to kernel, so kernel can tell the difference + + // this part are common for both passes + colTPlan->precision = fftPlan->precision; + colTPlan->forwardScale = 1.0f; + colTPlan->backwardScale = 1.0f; + colTPlan->tmpBufSize = 0; + colTPlan->batchsize = fftPlan->batchsize; + + colTPlan->gen = fftPlan->gen; + colTPlan->envelope = fftPlan->envelope; + + // Pass large1D flag to confirm we need multiply twiddle factor + colTPlan->large1D = fftPlan->length[0]; + + colTPlan->length.push_back(clLengths[0]); + + colTPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + colTPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + + colTPlan->inStride[0] = length0; + colTPlan->inStride.push_back(1); + colTPlan->iDist = length0 * length1; + + colTPlan->outStride[0] = length0; + colTPlan->outStride.push_back(1); + colTPlan->oDist = length0 * length1; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + colTPlan->length.push_back(fftPlan->length[index]); + colTPlan->inStride.push_back(colTPlan->iDist); + colTPlan->outStride.push_back(colTPlan->oDist); + colTPlan->iDist *= fftPlan->length[index]; + colTPlan->oDist *= fftPlan->length[index]; + } + + if ((fftPlan->inputLayout == CLFFT_HERMITIAN_INTERLEAVED) || + (fftPlan->inputLayout == CLFFT_HERMITIAN_PLANAR)) { + colTPlan->placeness = CLFFT_INPLACE; + } else { + colTPlan->placeness = CLFFT_OUTOFPLACE; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d first column plan failed" )); + + // another column FFT, size clLengths[0], batch clLengths[1], output + // without transpose + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T( "CreateDefaultPlan large1D row failed" )); + + FFTPlan *col2Plan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, col2Plan, rowLock), + _T( "fftRepo.getPlan failed" )); + + // This is second column fft, intermediate buffer is packed and + // interleaved we need to pass clLengths[1] and instride size to kernel, + // so kernel can tell the difference + + // common part for both passes + col2Plan->placeness = CLFFT_OUTOFPLACE; + col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->outputLayout = fftPlan->outputLayout; + + col2Plan->precision = fftPlan->precision; + col2Plan->forwardScale = fftPlan->forwardScale; + col2Plan->backwardScale = fftPlan->backwardScale; + col2Plan->tmpBufSize = 0; + col2Plan->batchsize = fftPlan->batchsize; + + col2Plan->gen = fftPlan->gen; + col2Plan->envelope = fftPlan->envelope; + + col2Plan->RCsimple = true; + col2Plan->length.push_back(length1); + + col2Plan->inStride[0] = 1; + col2Plan->inStride.push_back(length0); + col2Plan->iDist = length0 * length1; + + col2Plan->outStride[0] = length1 * fftPlan->outStride[0]; + col2Plan->outStride.push_back(fftPlan->outStride[0]); + col2Plan->oDist = fftPlan->oDist; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + col2Plan->length.push_back(fftPlan->length[index]); + col2Plan->inStride.push_back(col2Plan->iDist); + col2Plan->iDist *= fftPlan->length[index]; + col2Plan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + col2Plan->hasPostCallback = true; + col2Plan->postCallbackParam = fftPlan->postCallbackParam; + col2Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan large1d second column plan failed" )); + } else { + + if ((fftPlan->length[0] > + 262144 / PrecisionWidth(fftPlan->precision)) && + fftPlan->blockCompute) { + assert(fftPlan->length[0] <= 1048576); + + size_t padding = 64; + if (fftPlan->tmpBufSize == 0) { + fftPlan->tmpBufSize = (length1 + padding) * length0 * + fftPlan->batchsize * fftPlan->ElementSize(); + for (size_t index = 1; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + } + + // Algorithm in this case is + // T(with pad, out_of_place), R (in_place), C(in_place), + // Unpad(out_of_place) + + size_t len[3] = {clLengths[1], clLengths[0], 1}; + + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTX, fftPlan->context, CLFFT_2D, len), + _T( "CreateDefaultPlan Large1d trans1 failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->placeness = CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->inputLayout = fftPlan->inputLayout; + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inStride[0] = fftPlan->inStride[0]; + trans1Plan->inStride[1] = length1; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = length0 + padding; + trans1Plan->iDist = fftPlan->iDist; + trans1Plan->oDist = length1 * trans1Plan->outStride[1]; + trans1Plan->gen = Transpose_GCN; + trans1Plan->transflag = true; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + trans1Plan->inStride.push_back(fftPlan->inStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + trans1Plan->hasPreCallback = true; + trans1Plan->preCallback = fftPlan->preCallback; + trans1Plan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, + nullptr), + _T( "BakePlan large1d trans1 plan failed" )); + + // row FFT + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T( "CreateDefaultPlan Large1d column failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + assert(fftPlan->large1D == 0); + + rowPlan->placeness = CLFFT_INPLACE; + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = 1.0f; + rowPlan->backwardScale = 1.0f; + rowPlan->tmpBufSize = 0; + rowPlan->batchsize = fftPlan->batchsize; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + + rowPlan->length.push_back(length1); + + rowPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + rowPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + rowPlan->inStride[0] = 1; + rowPlan->outStride[0] = 1; + rowPlan->inStride.push_back(length0 + padding); + rowPlan->outStride.push_back(length0 + padding); + rowPlan->iDist = (length0 + padding) * length1; + rowPlan->oDist = (length0 + padding) * length1; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + rowPlan->length.push_back(fftPlan->length[index]); + rowPlan->inStride.push_back(rowPlan->iDist); + rowPlan->iDist *= fftPlan->length[index]; + rowPlan->outStride.push_back(rowPlan->oDist); + rowPlan->oDist *= fftPlan->length[index]; + } + + OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, + nullptr), + _T( "BakePlan large1d first row plan failed" )); + + // column FFT + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &clLengths[1]), + _T( "CreateDefaultPlan large1D column failed" )); + + FFTPlan *col2Plan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, col2Plan, colLock), + _T( "fftRepo.getPlan failed" )); + + col2Plan->placeness = CLFFT_INPLACE; + col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->precision = fftPlan->precision; + col2Plan->forwardScale = fftPlan->forwardScale; + col2Plan->backwardScale = fftPlan->backwardScale; + col2Plan->tmpBufSize = 0; + col2Plan->batchsize = fftPlan->batchsize; + + col2Plan->gen = fftPlan->gen; + col2Plan->envelope = fftPlan->envelope; + + col2Plan->large1D = fftPlan->length[0]; + col2Plan->twiddleFront = true; + + col2Plan->length.push_back(clLengths[0]); + + col2Plan->blockCompute = true; + col2Plan->blockComputeType = BCT_C2C; + + col2Plan->inStride[0] = length0 + padding; + col2Plan->outStride[0] = length0 + padding; + col2Plan->iDist = (length0 + padding) * length1; + col2Plan->oDist = (length0 + padding) * length1; + col2Plan->inStride.push_back(1); + col2Plan->outStride.push_back(1); + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + col2Plan->length.push_back(fftPlan->length[index]); + col2Plan->inStride.push_back(col2Plan->iDist); + col2Plan->outStride.push_back(col2Plan->oDist); + col2Plan->iDist *= fftPlan->length[index]; + col2Plan->oDist *= fftPlan->length[index]; + } + + OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, + nullptr), + _T( "BakePlan large1d second column plan failed" )); + + // copy plan to get results back to packed output + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planCopy, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T( "CreateDefaultPlan Copy failed" )); + + FFTPlan *copyPlan = nullptr; + lockRAII *copyLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planCopy, copyPlan, copyLock), + _T( "fftRepo.getPlan failed" )); + + copyPlan->placeness = CLFFT_OUTOFPLACE; + copyPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + copyPlan->outputLayout = fftPlan->outputLayout; + + copyPlan->precision = fftPlan->precision; + copyPlan->forwardScale = 1.0f; + copyPlan->backwardScale = 1.0f; + copyPlan->tmpBufSize = 0; + copyPlan->batchsize = fftPlan->batchsize; + + copyPlan->gen = Copy; + copyPlan->envelope = fftPlan->envelope; + + copyPlan->length.push_back(length1); + + copyPlan->inStride[0] = 1; + copyPlan->inStride.push_back(length0 + padding); + copyPlan->iDist = length1 * (length0 + padding); + + copyPlan->outStride[0] = fftPlan->outStride[0]; + copyPlan->outStride.push_back(length0); + copyPlan->oDist = fftPlan->oDist; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + copyPlan->length.push_back(fftPlan->length[index]); + copyPlan->inStride.push_back(copyPlan->inStride[index] * + copyPlan->length[index]); + copyPlan->iDist *= fftPlan->length[index]; + copyPlan->outStride.push_back(fftPlan->outStride[index]); + } + + OPENCL_V(clfftBakePlan(fftPlan->planCopy, numQueues, commQueueFFT, + nullptr, nullptr), + _T( "BakePlan large1d copy plan failed" )); + } else { + + if (fftPlan->tmpBufSize == 0) { + fftPlan->tmpBufSize = + length0 * length1 * fftPlan->batchsize * fftPlan->ElementSize(); + for (size_t index = 1; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + } + + // column FFT, size clLengths[1], batch clLengths[0], with length[0] + // twiddle factor multiplication + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &clLengths[1]), + _T( "CreateDefaultPlan Large1d column failed" )); + + FFTPlan *colTPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, colTPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + assert(fftPlan->large1D == 0); + + // current plan is to create intermediate buffer, packed and + // interleave This is a column FFT, the first elements distance + // between each FFT is the distance of the first two elements in the + // original buffer. Like a transpose of the matrix we need to pass + // clLengths[0] and instride size to kernel, so kernel can tell the + // difference + + // this part are common for both passes + colTPlan->placeness = CLFFT_OUTOFPLACE; + colTPlan->precision = fftPlan->precision; + colTPlan->forwardScale = 1.0f; + colTPlan->backwardScale = 1.0f; + colTPlan->tmpBufSize = 0; + colTPlan->batchsize = fftPlan->batchsize; + + colTPlan->gen = fftPlan->gen; + colTPlan->envelope = fftPlan->envelope; + + // Pass large1D flag to confirm we need multiply twiddle factor + colTPlan->large1D = fftPlan->length[0]; + + colTPlan->length.push_back(length0); + + colTPlan->inputLayout = fftPlan->inputLayout; + colTPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colTPlan->inStride[0] = fftPlan->inStride[0] * length0; + colTPlan->outStride[0] = length0; + colTPlan->iDist = fftPlan->iDist; + colTPlan->oDist = length0 * length1; + colTPlan->inStride.push_back(fftPlan->inStride[0]); + colTPlan->outStride.push_back(1); + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + colTPlan->hasPreCallback = true; + colTPlan->preCallback = fftPlan->preCallback; + colTPlan->precallUserData = fftPlan->precallUserData; + } + + // Enabling block column compute + if ((colTPlan->inStride[0] == length0) && IsPo2(fftPlan->length[0]) && + (fftPlan->length[0] < 524288)) { + colTPlan->blockCompute = true; + colTPlan->blockComputeType = BCT_C2C; + } + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + colTPlan->length.push_back(fftPlan->length[index]); + colTPlan->inStride.push_back(fftPlan->inStride[index]); + // tmp buffer is tightly packed + colTPlan->outStride.push_back(colTPlan->oDist); + colTPlan->oDist *= fftPlan->length[index]; + } + + OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, + nullptr), + _T( "BakePlan large1d first column plan failed" )); + + // another column FFT, size clLengths[0], batch clLengths[1], output + // with transpose + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &clLengths[0]), + _T( "CreateDefaultPlan large1D row failed" )); + + FFTPlan *col2Plan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, col2Plan, rowLock), + _T( "fftRepo.getPlan failed" )); + + // This is second column fft, intermediate buffer is packed and + // interleaved we need to pass clLengths[1] and instride size to + // kernel, so kernel can tell the difference + + // common part for both passes + col2Plan->outputLayout = fftPlan->outputLayout; + col2Plan->precision = fftPlan->precision; + col2Plan->forwardScale = fftPlan->forwardScale; + col2Plan->backwardScale = fftPlan->backwardScale; + col2Plan->tmpBufSize = 0; + col2Plan->batchsize = fftPlan->batchsize; + col2Plan->oDist = fftPlan->oDist; + + col2Plan->gen = fftPlan->gen; + col2Plan->envelope = fftPlan->envelope; + + col2Plan->length.push_back(clLengths[1]); + + bool integratedTranposes = true; + + if (colTPlan->blockCompute && (fftPlan->outStride[0] == 1) && + clLengths[0] <= 256) { + col2Plan->blockCompute = true; + col2Plan->blockComputeType = BCT_R2C; + + col2Plan->placeness = CLFFT_OUTOFPLACE; + col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->inStride[0] = 1; + col2Plan->outStride[0] = length1; + col2Plan->iDist = length0 * length1; + col2Plan->inStride.push_back(length0); + col2Plan->outStride.push_back(1); + } else if (colTPlan->blockCompute && (fftPlan->outStride[0] == 1)) { + integratedTranposes = false; + + col2Plan->placeness = CLFFT_INPLACE; + col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->inStride[0] = 1; + col2Plan->outStride[0] = 1; + col2Plan->iDist = length0 * length1; + col2Plan->oDist = length0 * length1; + col2Plan->inStride.push_back(length0); + col2Plan->outStride.push_back(length0); + } else { + // first layer, large 1D from tmp buffer to output buffer + col2Plan->placeness = CLFFT_OUTOFPLACE; + col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + col2Plan->inStride[0] = 1; + col2Plan->outStride[0] = fftPlan->outStride[0] * clLengths[1]; + col2Plan->iDist = length0 * length1; // fftPlan->length[0]; + col2Plan->inStride.push_back(length0); + col2Plan->outStride.push_back(fftPlan->outStride[0]); + } + + if (!integratedTranposes) { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + col2Plan->length.push_back(fftPlan->length[index]); + col2Plan->inStride.push_back(col2Plan->iDist); + col2Plan->outStride.push_back(col2Plan->oDist); + col2Plan->iDist *= fftPlan->length[index]; + col2Plan->oDist *= fftPlan->length[index]; + } + } else { + for (size_t index = 1; index < fftPlan->length.size(); index++) { + col2Plan->length.push_back(fftPlan->length[index]); + col2Plan->inStride.push_back(col2Plan->iDist); + col2Plan->outStride.push_back(fftPlan->outStride[index]); + col2Plan->iDist *= fftPlan->length[index]; + } + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback && integratedTranposes) { + col2Plan->hasPostCallback = true; + col2Plan->postCallbackParam = fftPlan->postCallbackParam; + col2Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, + nullptr), + _T( "BakePlan large1d second column plan failed" )); + + if (!integratedTranposes) { + // Transpose + // tmp --> output + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTZ, + fftPlan->context, CLFFT_2D, + clLengths), + _T( "CreateDefaultPlan Large1d transpose failed" )); + + FFTPlan *trans3Plan = nullptr; + lockRAII *trans3Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTZ, trans3Plan, trans3Lock), + _T( "fftRepo.getPlan failed" )); + + trans3Plan->placeness = CLFFT_OUTOFPLACE; + trans3Plan->precision = fftPlan->precision; + trans3Plan->tmpBufSize = 0; + trans3Plan->batchsize = fftPlan->batchsize; + trans3Plan->envelope = fftPlan->envelope; + trans3Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans3Plan->outputLayout = fftPlan->outputLayout; + trans3Plan->inStride[0] = 1; + trans3Plan->inStride[1] = clLengths[0]; + trans3Plan->outStride[0] = fftPlan->outStride[0]; + trans3Plan->outStride[1] = clLengths[1] * fftPlan->outStride[0]; + trans3Plan->iDist = fftPlan->length[0]; + trans3Plan->oDist = fftPlan->oDist; + trans3Plan->gen = Transpose_GCN; + trans3Plan->transflag = true; + + for (size_t index = 1; index < fftPlan->length.size(); index++) { + trans3Plan->length.push_back(fftPlan->length[index]); + trans3Plan->inStride.push_back(trans3Plan->iDist); + trans3Plan->iDist *= fftPlan->length[index]; + trans3Plan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + trans3Plan->hasPostCallback = true; + trans3Plan->postCallbackParam = fftPlan->postCallbackParam; + trans3Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, + nullptr, nullptr), + _T( "BakePlan large1d trans plan failed" )); + } + } + } + + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + } break; + case CLFFT_2D: { - FFTPlan* colTPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, colTPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); + if (fftPlan->transflag) // Transpose for 2D + { + clfftStatus err = CLFFT_SUCCESS; + if (fftPlan->gen == Transpose_GCN) + fftPlan->action = new FFTGeneratedTransposeGCNAction( + plHandle, fftPlan, *commQueueFFT, err); + else if (fftPlan->gen == Transpose_SQUARE) + fftPlan->action = new FFTGeneratedTransposeSquareAction( + plHandle, fftPlan, *commQueueFFT, err); + else if (fftPlan->gen == Transpose_NONSQUARE) { + if (fftPlan->nonSquareKernelType != NON_SQUARE_TRANS_PARENT) + fftPlan->action = new FFTGeneratedTransposeNonSquareAction( + plHandle, fftPlan, *commQueueFFT, err); + else { + size_t clLengths[] = {1, 1, 0}; + clLengths[0] = fftPlan->length[0]; + clLengths[1] = fftPlan->length[1]; + + // NON_SQUARE_KERNEL_ORDER currKernelOrder; + // controling the transpose and swap kernel order + // if leading dim is larger than the other dim it makes sense to swap + // and transpose + if (clLengths[0] > clLengths[1]) { + // Twiddling will be done in swap kernel, in regardless of the order + fftPlan->nonSquareKernelOrder = SWAP_AND_TRANSPOSE; + } else { + if (fftPlan->large1D != 0 && false) { + // this is not going to happen anymore + fftPlan->nonSquareKernelOrder = TRANSPOSE_LEADING_AND_SWAP; + } else { + // twiddling can be done in swap + fftPlan->nonSquareKernelOrder = TRANSPOSE_AND_SWAP; + } + } + + // std::cout << "currKernelOrder = " << fftPlan->nonSquareKernelOrder + // << std::endl; ends tranpose kernel order + + // Transpose stage 1 + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths), + _T("CreateDefaultPlan transpose_nsq_stage1 plan failed")); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), + _T("fftRepo.getPlan failed")); + + trans1Plan->placeness = CLFFT_INPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->inputLayout = fftPlan->inputLayout; + trans1Plan->outputLayout = fftPlan->outputLayout; + trans1Plan->inStride[0] = fftPlan->inStride[0]; + trans1Plan->outStride[0] = fftPlan->outStride[0]; + trans1Plan->inStride[1] = fftPlan->inStride[1]; + trans1Plan->outStride[1] = fftPlan->outStride[1]; + trans1Plan->iDist = fftPlan->iDist; + trans1Plan->oDist = fftPlan->oDist; + trans1Plan->gen = Transpose_NONSQUARE; + trans1Plan->nonSquareKernelOrder = fftPlan->nonSquareKernelOrder; + if (fftPlan->nonSquareKernelOrder == SWAP_AND_TRANSPOSE) + trans1Plan->nonSquareKernelType = NON_SQUARE_TRANS_SWAP; + else if (fftPlan->nonSquareKernelOrder == TRANSPOSE_AND_SWAP) + trans1Plan->nonSquareKernelType = + NON_SQUARE_TRANS_TRANSPOSE_BATCHED; + else if (fftPlan->nonSquareKernelOrder == TRANSPOSE_LEADING_AND_SWAP) + trans1Plan->nonSquareKernelType = + NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING; + trans1Plan->transflag = true; + trans1Plan->large1D = + fftPlan->large1D; // twiddling may happen in this kernel + + if (trans1Plan->nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED) { + // this should be in a function to avoide duplicate code TODO + // need to treat a non square matrix as a sqaure matrix with bigger + // batch size + size_t lengthX = trans1Plan->length[0]; + size_t lengthY = trans1Plan->length[1]; + + size_t BatchFactor = + (lengthX > lengthY) ? (lengthX / lengthY) : (lengthY / lengthX); + trans1Plan->transposeMiniBatchSize = BatchFactor; + trans1Plan->batchsize *= BatchFactor; + trans1Plan->iDist = trans1Plan->iDist / BatchFactor; + if (lengthX > lengthY) { + trans1Plan->length[0] = lengthX / BatchFactor; + trans1Plan->inStride[1] = lengthX / BatchFactor; + } else if (lengthX < lengthY) { + trans1Plan->length[1] = lengthY / BatchFactor; + trans1Plan->inStride[1] = lengthX; + } + } + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + trans1Plan->inStride.push_back(fftPlan->inStride[index]); + trans1Plan->outStride.push_back(fftPlan->outStride[index]); + } + + if (fftPlan->hasPreCallback) { + trans1Plan->hasPreCallback = true; + trans1Plan->preCallback = fftPlan->preCallback; + trans1Plan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, + nullptr), + _T("BakePlan transpose_nsq_stage1 plan failed")); + + // Transpose stage 2 + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTY, fftPlan->context, CLFFT_2D, clLengths), + _T("CreateDefaultPlan transpose_nsq_stage2 plan failed")); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans2Plan, trans2Lock), + _T("fftRepo.getPlan failed")); + + trans2Plan->placeness = CLFFT_INPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->inputLayout = fftPlan->inputLayout; + trans2Plan->outputLayout = fftPlan->outputLayout; + trans2Plan->inStride[0] = fftPlan->inStride[0]; + trans2Plan->outStride[0] = fftPlan->outStride[0]; + trans2Plan->inStride[1] = fftPlan->inStride[1]; + trans2Plan->outStride[1] = fftPlan->outStride[1]; + trans2Plan->iDist = fftPlan->iDist; + trans2Plan->oDist = fftPlan->oDist; + trans2Plan->gen = Transpose_NONSQUARE; + trans2Plan->nonSquareKernelOrder = fftPlan->nonSquareKernelOrder; + if (fftPlan->nonSquareKernelOrder == SWAP_AND_TRANSPOSE) + trans2Plan->nonSquareKernelType = + NON_SQUARE_TRANS_TRANSPOSE_BATCHED; + else if (fftPlan->nonSquareKernelOrder == TRANSPOSE_AND_SWAP) + trans2Plan->nonSquareKernelType = NON_SQUARE_TRANS_SWAP; + else if (fftPlan->nonSquareKernelOrder == TRANSPOSE_LEADING_AND_SWAP) + trans2Plan->nonSquareKernelType = NON_SQUARE_TRANS_SWAP; + trans2Plan->transflag = true; + trans2Plan->large1D = + fftPlan->large1D; // twiddling may happen in this kernel + + if (trans2Plan->nonSquareKernelType == + NON_SQUARE_TRANS_TRANSPOSE_BATCHED) { + // need to treat a non square matrix as a sqaure matrix with bigger + // batch size + size_t lengthX = trans2Plan->length[0]; + size_t lengthY = trans2Plan->length[1]; + + size_t BatchFactor = + (lengthX > lengthY) ? (lengthX / lengthY) : (lengthY / lengthX); + trans2Plan->transposeMiniBatchSize = BatchFactor; + trans2Plan->batchsize *= BatchFactor; + trans2Plan->iDist = trans2Plan->iDist / BatchFactor; + if (lengthX > lengthY) { + trans2Plan->length[0] = lengthX / BatchFactor; + trans2Plan->inStride[1] = lengthX / BatchFactor; + } else if (lengthX < lengthY) { + trans2Plan->length[1] = lengthY / BatchFactor; + trans2Plan->inStride[1] = lengthX; + } + } + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + trans2Plan->length.push_back(fftPlan->length[index]); + trans2Plan->inStride.push_back(fftPlan->inStride[index]); + trans2Plan->outStride.push_back(fftPlan->outStride[index]); + } + + if (fftPlan->hasPostCallback) { + trans2Plan->hasPostCallback = true; + trans2Plan->postCallbackParam = fftPlan->postCallbackParam; + trans2Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, + nullptr), + _T("BakePlan transpose_nsq_stage2 plan failed")); + } + } else + fftPlan->action = new FFTGeneratedTransposeGCNAction( + plHandle, fftPlan, *commQueueFFT, err); + + OPENCL_V(err, "FFTGeneratedTransposeXXXAction failed"); + + fftPlan->baked = true; + return CLFFT_SUCCESS; + } - assert(fftPlan->large1D == 0); - - // current plan is to create intermediate buffer, packed and interleave - // This is a column FFT, the first elements distance between each FFT is the distance of the first two - // elements in the original buffer. Like a transpose of the matrix - // we need to pass clLengths[0] and instride size to kernel, so kernel can tell the difference - - //this part are common for both passes - colTPlan->placeness = CLFFT_OUTOFPLACE; - colTPlan->precision = fftPlan->precision; - colTPlan->forwardScale = 1.0f; - colTPlan->backwardScale = 1.0f; - colTPlan->tmpBufSize = 0; - colTPlan->batchsize = fftPlan->batchsize; - - colTPlan->gen = fftPlan->gen; - colTPlan->envelope = fftPlan->envelope; - - //Pass large1D flag to confirm we need multiply twiddle factor - colTPlan->large1D = fftPlan->length[0]; - - colTPlan->length.push_back(length0); - - - colTPlan->inputLayout = fftPlan->inputLayout; - colTPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colTPlan->inStride[0] = fftPlan->inStride[0] * length0; - colTPlan->outStride[0] = length0; - colTPlan->iDist = fftPlan->iDist; - colTPlan->oDist = length0 * length1; - colTPlan->inStride.push_back(fftPlan->inStride[0]); - colTPlan->outStride.push_back(1); - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - colTPlan->hasPreCallback = true; - colTPlan->preCallback = fftPlan->preCallback; - colTPlan->precallUserData = fftPlan->precallUserData; - } - - // Enabling block column compute - if( (colTPlan->inStride[0] == length0) && IsPo2(fftPlan->length[0]) && (fftPlan->length[0] < 524288) ) - { - colTPlan->blockCompute = true; - colTPlan->blockComputeType = BCT_C2C; - } - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - colTPlan->length.push_back(fftPlan->length[index]); - colTPlan->inStride.push_back(fftPlan->inStride[index]); - // tmp buffer is tightly packed - colTPlan->outStride.push_back(colTPlan->oDist); - colTPlan->oDist *= fftPlan->length[index]; - } - - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d first column plan failed" ) ); - - //another column FFT, size clLengths[0], batch clLengths[1], output with transpose - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &clLengths[0] ), - _T( "CreateDefaultPlan large1D row failed" ) ); - - FFTPlan* col2Plan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, col2Plan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - // This is second column fft, intermediate buffer is packed and interleaved - // we need to pass clLengths[1] and instride size to kernel, so kernel can tell the difference - - // common part for both passes - col2Plan->outputLayout = fftPlan->outputLayout; - col2Plan->precision = fftPlan->precision; - col2Plan->forwardScale = fftPlan->forwardScale; - col2Plan->backwardScale = fftPlan->backwardScale; - col2Plan->tmpBufSize = 0; - col2Plan->batchsize = fftPlan->batchsize; - col2Plan->oDist = fftPlan->oDist; - - col2Plan->gen = fftPlan->gen; - col2Plan->envelope = fftPlan->envelope; - - - col2Plan->length.push_back(clLengths[1]); - - bool integratedTranposes = true; - - - if( colTPlan->blockCompute && (fftPlan->outStride[0] == 1) && clLengths[0] <= 256) - { - col2Plan->blockCompute = true; - col2Plan->blockComputeType = BCT_R2C; - - col2Plan->placeness = CLFFT_OUTOFPLACE; - col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->inStride[0] = 1; - col2Plan->outStride[0] = length1; - col2Plan->iDist = length0 * length1; - col2Plan->inStride.push_back(length0); - col2Plan->outStride.push_back(1); - } - else if( colTPlan->blockCompute && (fftPlan->outStride[0] == 1) ) - { - integratedTranposes = false; - - col2Plan->placeness = CLFFT_INPLACE; - col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->inStride[0] = 1; - col2Plan->outStride[0] = 1; - col2Plan->iDist = length0 * length1; - col2Plan->oDist = length0 * length1; - col2Plan->inStride.push_back(length0); - col2Plan->outStride.push_back(length0); - } - else - { - //first layer, large 1D from tmp buffer to output buffer - col2Plan->placeness = CLFFT_OUTOFPLACE; - col2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - col2Plan->inStride[0] = 1; - col2Plan->outStride[0] = fftPlan->outStride[0] * clLengths[1]; - col2Plan->iDist = length0 * length1; //fftPlan->length[0]; - col2Plan->inStride.push_back(length0); - col2Plan->outStride.push_back(fftPlan->outStride[0]); - } - - if(!integratedTranposes) - { - for (size_t index=1; index < fftPlan->length.size(); index++) - { - col2Plan->length.push_back(fftPlan->length[index]); - col2Plan->inStride.push_back(col2Plan->iDist); - col2Plan->outStride.push_back(col2Plan->oDist); - col2Plan->iDist *= fftPlan->length[index]; - col2Plan->oDist *= fftPlan->length[index]; - } - } - else - { - for (size_t index=1; index < fftPlan->length.size(); index++) - { - col2Plan->length.push_back(fftPlan->length[index]); - col2Plan->inStride.push_back(col2Plan->iDist); - col2Plan->outStride.push_back(fftPlan->outStride[index]); - col2Plan->iDist *= fftPlan->length[index]; - } - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback && integratedTranposes) - { - col2Plan->hasPostCallback = true; - col2Plan->postCallbackParam = fftPlan->postCallbackParam; - col2Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan large1d second column plan failed" ) ); - - if(!integratedTranposes) - { - //Transpose - //tmp --> output - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTZ, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan Large1d transpose failed" ) ); - - FFTPlan* trans3Plan = NULL; - lockRAII* trans3Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTZ, trans3Plan, trans3Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans3Plan->placeness = CLFFT_OUTOFPLACE; - trans3Plan->precision = fftPlan->precision; - trans3Plan->tmpBufSize = 0; - trans3Plan->batchsize = fftPlan->batchsize; - trans3Plan->envelope = fftPlan->envelope; - trans3Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans3Plan->outputLayout = fftPlan->outputLayout; - trans3Plan->inStride[0] = 1; - trans3Plan->inStride[1] = clLengths[0]; - trans3Plan->outStride[0] = fftPlan->outStride[0]; - trans3Plan->outStride[1] = clLengths[1] * fftPlan->outStride[0]; - trans3Plan->iDist = fftPlan->length[0]; - trans3Plan->oDist = fftPlan->oDist; - trans3Plan->gen = Transpose_GCN; - trans3Plan->transflag = true; - - for (size_t index=1; index < fftPlan->length.size(); index++) - { - trans3Plan->length.push_back(fftPlan->length[index]); - trans3Plan->inStride.push_back(trans3Plan->iDist); - trans3Plan->iDist *= fftPlan->length[index]; - trans3Plan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - trans3Plan->hasPostCallback = true; - trans3Plan->postCallbackParam = fftPlan->postCallbackParam; - trans3Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan large1d trans plan failed" ) ); - } - } - } - - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - } - break; - case CLFFT_2D: - { - - if (fftPlan->transflag) //Transpose for 2D - { - clfftStatus err = CLFFT_SUCCESS; - if(fftPlan->gen == Transpose_GCN) - fftPlan->action = new FFTGeneratedTransposeGCNAction(plHandle, fftPlan, *commQueueFFT, err); - else if (fftPlan->gen == Transpose_SQUARE) - fftPlan->action = new FFTGeneratedTransposeSquareAction(plHandle, fftPlan, *commQueueFFT, err); - else if (fftPlan->gen == Transpose_NONSQUARE) - { - if(fftPlan->nonSquareKernelType != NON_SQUARE_TRANS_PARENT) - fftPlan->action = new FFTGeneratedTransposeNonSquareAction(plHandle, fftPlan, *commQueueFFT, err); - else - { - size_t clLengths[] = { 1, 1, 0 }; - clLengths[0] = fftPlan->length[0]; - clLengths[1] = fftPlan->length[1]; - - //NON_SQUARE_KERNEL_ORDER currKernelOrder; - // controling the transpose and swap kernel order - // if leading dim is larger than the other dim it makes sense to swap and transpose - if (clLengths[0] > clLengths[1]) - { - //Twiddling will be done in swap kernel, in regardless of the order - fftPlan->nonSquareKernelOrder = SWAP_AND_TRANSPOSE; - } - else - { - if (fftPlan->large1D != 0 && 0) - { - //this is not going to happen anymore - fftPlan->nonSquareKernelOrder = TRANSPOSE_LEADING_AND_SWAP; - } - else - { - //twiddling can be done in swap - fftPlan->nonSquareKernelOrder = TRANSPOSE_AND_SWAP; - } - } - - //std::cout << "currKernelOrder = " << fftPlan->nonSquareKernelOrder << std::endl; - //ends tranpose kernel order - - //Transpose stage 1 - OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths), - _T("CreateDefaultPlan transpose_nsq_stage1 plan failed")); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), _T("fftRepo.getPlan failed")); - - trans1Plan->placeness = CLFFT_INPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->inputLayout = fftPlan->inputLayout; - trans1Plan->outputLayout = fftPlan->outputLayout; - trans1Plan->inStride[0] = fftPlan->inStride[0]; - trans1Plan->outStride[0] = fftPlan->outStride[0]; - trans1Plan->inStride[1] = fftPlan->inStride[1]; - trans1Plan->outStride[1] = fftPlan->outStride[1]; - trans1Plan->iDist = fftPlan->iDist; - trans1Plan->oDist = fftPlan->oDist; - trans1Plan->gen = Transpose_NONSQUARE; - trans1Plan->nonSquareKernelOrder = fftPlan->nonSquareKernelOrder; - if(fftPlan->nonSquareKernelOrder == SWAP_AND_TRANSPOSE) - trans1Plan->nonSquareKernelType = NON_SQUARE_TRANS_SWAP; - else if (fftPlan->nonSquareKernelOrder == TRANSPOSE_AND_SWAP) - trans1Plan->nonSquareKernelType = NON_SQUARE_TRANS_TRANSPOSE_BATCHED; - else if(fftPlan->nonSquareKernelOrder == TRANSPOSE_LEADING_AND_SWAP) - trans1Plan->nonSquareKernelType = NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING; - trans1Plan->transflag = true; - trans1Plan->large1D = fftPlan->large1D;//twiddling may happen in this kernel - - if (trans1Plan->nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED) - { - //this should be in a function to avoide duplicate code TODO - //need to treat a non square matrix as a sqaure matrix with bigger batch size - size_t lengthX = trans1Plan->length[0]; - size_t lengthY = trans1Plan->length[1]; - - size_t BatchFactor = (lengthX > lengthY) ? (lengthX / lengthY) : (lengthY / lengthX); - trans1Plan->transposeMiniBatchSize = BatchFactor; - trans1Plan->batchsize *= BatchFactor; - trans1Plan->iDist = trans1Plan->iDist / BatchFactor; - if (lengthX > lengthY) - { - trans1Plan->length[0] = lengthX / BatchFactor; - trans1Plan->inStride[1] = lengthX / BatchFactor; - } - else if (lengthX < lengthY) - { - trans1Plan->length[1] = lengthY / BatchFactor; - trans1Plan->inStride[1] = lengthX; - } - } - - for (size_t index = 2; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - trans1Plan->inStride.push_back(fftPlan->inStride[index]); - trans1Plan->outStride.push_back(fftPlan->outStride[index]); - } - - if (fftPlan->hasPreCallback) - { - trans1Plan->hasPreCallback = true; - trans1Plan->preCallback = fftPlan->preCallback; - trans1Plan->precallUserData = fftPlan->precallUserData; - } - - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL), - _T("BakePlan transpose_nsq_stage1 plan failed")); - - - //Transpose stage 2 - OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTY, fftPlan->context, CLFFT_2D, clLengths), - _T("CreateDefaultPlan transpose_nsq_stage2 plan failed")); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans2Plan, trans2Lock), _T("fftRepo.getPlan failed")); - - trans2Plan->placeness = CLFFT_INPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->inputLayout = fftPlan->inputLayout; - trans2Plan->outputLayout = fftPlan->outputLayout; - trans2Plan->inStride[0] = fftPlan->inStride[0]; - trans2Plan->outStride[0] = fftPlan->outStride[0]; - trans2Plan->inStride[1] = fftPlan->inStride[1]; - trans2Plan->outStride[1] = fftPlan->outStride[1]; - trans2Plan->iDist = fftPlan->iDist; - trans2Plan->oDist = fftPlan->oDist; - trans2Plan->gen = Transpose_NONSQUARE; - trans2Plan->nonSquareKernelOrder = fftPlan->nonSquareKernelOrder; - if (fftPlan->nonSquareKernelOrder == SWAP_AND_TRANSPOSE) - trans2Plan->nonSquareKernelType = NON_SQUARE_TRANS_TRANSPOSE_BATCHED; - else if(fftPlan->nonSquareKernelOrder == TRANSPOSE_AND_SWAP) - trans2Plan->nonSquareKernelType = NON_SQUARE_TRANS_SWAP; - else if(fftPlan->nonSquareKernelOrder == TRANSPOSE_LEADING_AND_SWAP) - trans2Plan->nonSquareKernelType = NON_SQUARE_TRANS_SWAP; - trans2Plan->transflag = true; - trans2Plan->large1D = fftPlan->large1D;//twiddling may happen in this kernel - - if (trans2Plan->nonSquareKernelType == NON_SQUARE_TRANS_TRANSPOSE_BATCHED) - { - //need to treat a non square matrix as a sqaure matrix with bigger batch size - size_t lengthX = trans2Plan->length[0]; - size_t lengthY = trans2Plan->length[1]; - - size_t BatchFactor = (lengthX > lengthY) ? (lengthX/lengthY) : (lengthY/lengthX); - trans2Plan->transposeMiniBatchSize = BatchFactor; - trans2Plan->batchsize *= BatchFactor; - trans2Plan->iDist = trans2Plan->iDist / BatchFactor; - if (lengthX > lengthY) - { - trans2Plan->length[0] = lengthX / BatchFactor; - trans2Plan->inStride[1] = lengthX / BatchFactor; - } - else if(lengthX < lengthY) - { - trans2Plan->length[1] = lengthY / BatchFactor; - trans2Plan->inStride[1] = lengthX; - } - } - - for (size_t index = 2; index < fftPlan->length.size(); index++) - { - trans2Plan->length.push_back(fftPlan->length[index]); - trans2Plan->inStride.push_back(fftPlan->inStride[index]); - trans2Plan->outStride.push_back(fftPlan->outStride[index]); - } - - if (fftPlan->hasPostCallback) - { - trans2Plan->hasPostCallback = true; - trans2Plan->postCallbackParam = fftPlan->postCallbackParam; - trans2Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL), - _T("BakePlan transpose_nsq_stage2 plan failed")); - } - } - else - fftPlan->action = new FFTGeneratedTransposeGCNAction(plHandle, fftPlan, *commQueueFFT, err); - - OPENCL_V( err, "FFTGeneratedTransposeXXXAction failed"); - - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - size_t length0 = fftPlan->length[0]; - size_t length1 = fftPlan->length[1]; - - - if (fftPlan->length[0] > Large1DThreshold || - fftPlan->length[1] > Large1DThreshold) - fftPlan->large2D = true; - - while (1 && (fftPlan->inputLayout != CLFFT_REAL) && (fftPlan->outputLayout != CLFFT_REAL)) - { - //break; - - - // TODO : Check for a better way to do this. - bool isnvidia = false; - for (size_t Idx = 0; !isnvidia && Idx < numQueues; Idx++) - { - cl_command_queue QIdx = commQueueFFT[Idx]; - cl_device_id Device; - clGetCommandQueueInfo(QIdx, CL_QUEUE_DEVICE, sizeof(Device), &Device, NULL); - char Vendor[256]; - clGetDeviceInfo(Device, CL_DEVICE_VENDOR, sizeof(Vendor), &Vendor, NULL); - isnvidia |= (strncmp(Vendor, "NVIDIA", 6) == 0); - } - // nvidia gpus are failing when doing transpose for 2D FFTs - if (isnvidia) break; - - if (fftPlan->length.size() != 2) break; - if (!(IsPo2(fftPlan->length[0])) || !(IsPo2(fftPlan->length[1]))) - break; - if (fftPlan->length[1] < 32) break; - //TBD: restrict the use large2D in x!=y case becase we will need two temp buffers - // (1) for 2D usage (2) for 1D large usage - //if (fftPlan->large2D) break; - //Performance show 512 is the good case with transpose - //if user want the result to be transposed, then we will. - - if (fftPlan->length[0] < 64) break; - //x!=y case, we need tmp buffer, currently temp buffer only support interleaved format - //if (fftPlan->length[0] != fftPlan->length[1] && fftPlan->outputLayout == CLFFT_COMPLEX_PLANAR) break; - if (fftPlan->inStride[0] != 1 || fftPlan->outStride[0] != 1 || - fftPlan->inStride[1] != fftPlan->length[0] || fftPlan->outStride[1] != fftPlan->length[0]) - break; - //if (fftPlan->placeness != CLFFT_INPLACE || fftPlan->inputLayout != CLFFT_COMPLEX_PLANAR) - // break; - //if (fftPlan->batchsize != 1) break; - //if (fftPlan->precision != CLFFT_SINGLE) break; - - fftPlan->transflag = true; - - //create row plan, - // x=y & x!=y, In->In for inplace, In->out for outofplace - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimX ] ), - _T( "CreateDefaultPlan for planX failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - rowPlan->inputLayout = fftPlan->inputLayout; - rowPlan->outputLayout = fftPlan->outputLayout; - rowPlan->placeness = fftPlan->placeness; - rowPlan->outStride[0] = fftPlan->outStride[0]; - rowPlan->outStride.push_back(fftPlan->outStride[1]); - rowPlan->oDist = fftPlan->oDist; - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = 1.0f; - rowPlan->backwardScale = 1.0f; - rowPlan->tmpBufSize = 0; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - rowPlan->batchsize = fftPlan->batchsize; - rowPlan->inStride[0] = fftPlan->inStride[0]; - rowPlan->length.push_back(fftPlan->length[1]); - rowPlan->inStride.push_back(fftPlan->inStride[1]); - rowPlan->iDist = fftPlan->iDist; - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - rowPlan->hasPreCallback = true; - rowPlan->preCallback = fftPlan->preCallback; - rowPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planX failed" ) ); - - //Create transpose plan for first transpose - //x=y: inplace. x!=y inplace: in->tmp, outofplace out->tmp - size_t clLengths[] = { 1, 1, 0 }; - clLengths[0] = fftPlan->length[0]; - clLengths[1] = fftPlan->length[1]; - - size_t biggerDim = clLengths[0] > clLengths[1] ? clLengths[0] : clLengths[1]; - size_t smallerDim = biggerDim == clLengths[0] ? clLengths[1] : clLengths[0]; - size_t padding = 0; - - fftPlan->transpose_in_2d_inplace = (clLengths[0]==clLengths[1]) ? true : false; - if ( (!fftPlan->transpose_in_2d_inplace) && fftPlan->tmpBufSize==0 && fftPlan->length.size()<=2 ) - { - if ((smallerDim % 64 == 0) || (biggerDim % 64 == 0)) - if(biggerDim > 512) - padding = 64; - - // we need tmp buffer for x!=y case - // we assume the tmp buffer is packed interleaved - fftPlan->tmpBufSize = (smallerDim + padding) * biggerDim * - fftPlan->batchsize * fftPlan->ElementSize(); - } - - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan for planT failed" ) ); - - FFTPlan* transPlanX = NULL; - lockRAII* transLockX = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, transPlanX, transLockX ), _T( "fftRepo.getPlan failed" ) ); - - transPlanX->inputLayout = fftPlan->outputLayout; - transPlanX->precision = fftPlan->precision; - transPlanX->tmpBufSize = 0; - - transPlanX->envelope = fftPlan->envelope; - transPlanX->batchsize = fftPlan->batchsize; - transPlanX->inStride[0] = fftPlan->outStride[0]; - transPlanX->inStride[1] = fftPlan->outStride[1]; - transPlanX->iDist = fftPlan->oDist; - transPlanX->transflag = true; - - if (!fftPlan->transpose_in_2d_inplace) - { - transPlanX->gen = Transpose_GCN; - transPlanX->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - transPlanX->placeness = CLFFT_OUTOFPLACE; - transPlanX->outStride[0] = 1; - transPlanX->outStride[1] = clLengths[1] + padding; - transPlanX->oDist = clLengths[0] * transPlanX->outStride[1]; - } - else - { - transPlanX->gen = Transpose_SQUARE; - transPlanX->outputLayout = fftPlan->outputLayout; - transPlanX->placeness = CLFFT_INPLACE; - transPlanX->outStride[0] = fftPlan->outStride[0]; - transPlanX->outStride[1] = fftPlan->outStride[1]; - transPlanX->oDist = fftPlan->oDist; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTX failed" ) ); - - //create second row plan - //x!=y: tmp->tmp, x=y case: In->In or Out->Out - //if Transposed result is a choice x!=y: tmp->In or out - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimY ] ), - _T( "CreateDefaultPlan for planY failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - if (!fftPlan->transpose_in_2d_inplace) - { - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inStride[0] = 1; - colPlan->inStride.push_back(clLengths[1] + padding); - colPlan->iDist = clLengths[0] * colPlan->inStride[1]; - - if (fftPlan->transposed == CLFFT_NOTRANSPOSE) - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->outStride[0] = 1; - colPlan->outStride.push_back(clLengths[1] + padding); - colPlan->oDist = clLengths[0] * colPlan->outStride[1]; - colPlan->placeness = CLFFT_INPLACE; - } - else - { - colPlan->outputLayout = fftPlan->outputLayout; - colPlan->outStride[0] = fftPlan->outStride[0]; - colPlan->outStride.push_back(clLengths[1] * fftPlan->outStride[0]); - colPlan->oDist = fftPlan->oDist; - colPlan->placeness = CLFFT_OUTOFPLACE; - } - } - else - { - colPlan->inputLayout = fftPlan->outputLayout; - colPlan->outputLayout = fftPlan->outputLayout; - colPlan->outStride[0] = fftPlan->outStride[0]; - colPlan->outStride.push_back(fftPlan->outStride[1]); - colPlan->oDist = fftPlan->oDist; - colPlan->inStride[0] = fftPlan->outStride[0]; - colPlan->inStride.push_back(fftPlan->outStride[1]); - colPlan->iDist = fftPlan->oDist; - colPlan->placeness = CLFFT_INPLACE; - } - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - colPlan->batchsize = fftPlan->batchsize; - colPlan->length.push_back(fftPlan->length[0]); - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planY failed" ) ); - - if (fftPlan->transposed == CLFFT_TRANSPOSED) - { - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - //Create transpose plan for second transpose - //x!=y case tmp->In or Out, x=y case In->In or Out->out - size_t clLengthsY[2] = { clLengths[1], clLengths[0] }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTY, fftPlan->context, CLFFT_2D, clLengthsY ), - _T( "CreateDefaultPlan for planTY failed" ) ); - - FFTPlan* transPlanY = NULL; - lockRAII* transLockY = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTY, transPlanY, transLockY ), _T( "fftRepo.getPlan failed" ) ); - - if (!fftPlan->transpose_in_2d_inplace) - { - transPlanY->gen = Transpose_GCN; - transPlanY->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - transPlanY->placeness = CLFFT_OUTOFPLACE; - transPlanY->inStride[0] = 1; - transPlanY->inStride[1] = clLengths[1] + padding; - transPlanY->iDist = clLengths[0] * transPlanY->inStride[1]; - transPlanY->transOutHorizontal = true; - } - else - { - transPlanY->gen = Transpose_SQUARE; - transPlanY->inputLayout = fftPlan->outputLayout; - transPlanY->placeness = CLFFT_INPLACE; - transPlanY->inStride[0] = fftPlan->outStride[0]; - transPlanY->inStride[1] = fftPlan->outStride[1]; - transPlanY->iDist = fftPlan->oDist; - } - transPlanY->outputLayout = fftPlan->outputLayout; - transPlanY->outStride[0] = fftPlan->outStride[0]; - transPlanY->outStride[1] = fftPlan->outStride[1]; - transPlanY->oDist = fftPlan->oDist; - transPlanY->precision = fftPlan->precision; - transPlanY->tmpBufSize = 0; - - transPlanY->envelope = fftPlan->envelope; - transPlanY->batchsize = fftPlan->batchsize; - transPlanY->transflag = true; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - transPlanY->hasPostCallback = true; - transPlanY->postCallbackParam = fftPlan->postCallbackParam; - transPlanY->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTY failed" ) ); - - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - //check transposed - if (fftPlan->transposed != CLFFT_NOTRANSPOSE) - return CLFFT_TRANSPOSED_NOTIMPLEMENTED; - - - if(fftPlan->inputLayout == CLFFT_REAL) - { - length0 = fftPlan->length[0]; - length1 = fftPlan->length[1]; - - size_t Nt = (1 + length0/2); - - - // create row plan - // real to hermitian - - //create row plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimX ] ), - _T( "CreateDefaultPlan for planX failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - - rowPlan->outputLayout = fftPlan->outputLayout; - rowPlan->inputLayout = fftPlan->inputLayout; - rowPlan->placeness = fftPlan->placeness; - rowPlan->length.push_back(length1); - - rowPlan->inStride[0] = fftPlan->inStride[0]; - rowPlan->inStride.push_back(fftPlan->inStride[1]); - rowPlan->iDist = fftPlan->iDist; - - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = 1.0f; - rowPlan->backwardScale = 1.0f; - rowPlan->tmpBufSize = 0; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - - rowPlan->batchsize = fftPlan->batchsize; - - rowPlan->outStride[0] = fftPlan->outStride[0]; - rowPlan->outStride.push_back(fftPlan->outStride[1]); - rowPlan->oDist = fftPlan->oDist; - - //this 2d is decomposed from 3d - for (size_t index=2; index < fftPlan->length.size(); index++) - { - rowPlan->length.push_back(fftPlan->length[index]); - rowPlan->inStride.push_back(fftPlan->inStride[index]); - rowPlan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - rowPlan->hasPreCallback = true; - rowPlan->preCallback = fftPlan->preCallback; - rowPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planX failed" ) ); - - if( (rowPlan->inStride[0] == 1) && (rowPlan->outStride[0] == 1) && - ( ((rowPlan->inStride[1] == Nt*2) && (rowPlan->placeness == CLFFT_INPLACE)) || - ((rowPlan->inStride[1] == length0) && (rowPlan->placeness == CLFFT_OUTOFPLACE)) ) - && (rowPlan->outStride[1] == Nt) ) - { - // calc temp buf size - if (fftPlan->tmpBufSize==0) - { - fftPlan->tmpBufSize = Nt * length1 * fftPlan->batchsize * fftPlan->ElementSize(); - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - } - - // create first transpose plan - - //Transpose - // output --> tmp - size_t transLengths[2] = { length0, length1 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, transLengths ), - _T( "CreateDefaultPlan for planTX transpose failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->transflag = true; - - transLengths[0] = Nt; - OPENCL_V(clfftSetPlanLength( fftPlan->planTX, CLFFT_2D, transLengths ), - _T( "clfftSetPlanLength for planTX transpose failed" ) ); - - switch(fftPlan->outputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - trans1Plan->placeness = CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->forwardScale = 1.0f; - trans1Plan->backwardScale = 1.0f; - - trans1Plan->inStride[0] = 1; - trans1Plan->inStride[1] = Nt; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = length1; - trans1Plan->iDist = rowPlan->oDist; - trans1Plan->oDist = Nt*length1; - trans1Plan->transOutHorizontal = true; - - trans1Plan->gen = Transpose_GCN; - - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - trans1Plan->inStride.push_back(rowPlan->outStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTX failed" ) ); - - - // Create column plan as a row plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimY ] ), - _T( "CreateDefaultPlan for planY failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - colPlan->outputLayout = trans1Plan->outputLayout; - colPlan->inputLayout = trans1Plan->outputLayout; - colPlan->placeness = CLFFT_INPLACE; - colPlan->length.push_back(Nt); - - colPlan->inStride[0] = 1; - colPlan->inStride.push_back(length1); - colPlan->iDist = Nt*length1; - - colPlan->outStride[0] = 1; - colPlan->outStride.push_back(length1); - colPlan->oDist = Nt*length1; - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - //this 2d is decomposed from 3d - for (size_t index=2; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(colPlan->iDist); - colPlan->outStride.push_back(colPlan->oDist); - colPlan->iDist *= fftPlan->length[index]; - colPlan->oDist *= fftPlan->length[index]; - } - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planY failed" ) ); - - if (fftPlan->transposed == CLFFT_TRANSPOSED) - { - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - // create second transpose plan - - //Transpose - //output --> tmp - size_t trans2Lengths[2] = { length1, length0 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTY, fftPlan->context, CLFFT_2D, trans2Lengths ), - _T( "CreateDefaultPlan for planTY transpose failed" ) ); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTY, trans2Plan, trans2Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans2Plan->transflag = true; - - trans2Lengths[1] = Nt; - OPENCL_V(clfftSetPlanLength( fftPlan->planTY, CLFFT_2D, trans2Lengths ), - _T( "clfftSetPlanLength for planTY transpose failed" ) ); - - switch(fftPlan->outputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - trans2Plan->outputLayout = CLFFT_COMPLEX_PLANAR; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - default: assert(false); - } - - trans2Plan->placeness = CLFFT_OUTOFPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->forwardScale = 1.0f; - trans2Plan->backwardScale = 1.0f; - - trans2Plan->inStride[0] = 1; - trans2Plan->inStride[1] = length1; - trans2Plan->outStride[0] = 1; - trans2Plan->outStride[1] = Nt; - trans2Plan->iDist = Nt*length1; - trans2Plan->oDist = fftPlan->oDist; - - trans2Plan->gen = Transpose_GCN; - trans2Plan->transflag = true; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - trans2Plan->length.push_back(fftPlan->length[index]); - trans2Plan->inStride.push_back(trans2Plan->iDist); - trans2Plan->iDist *= fftPlan->length[index]; - trans2Plan->outStride.push_back(fftPlan->outStride[index]); - - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - trans2Plan->hasPostCallback = true; - trans2Plan->postCallbackParam = fftPlan->postCallbackParam; - trans2Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTY failed" ) ); - - } - else - { - // create col plan - // complex to complex - - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimY ] ), - _T( "CreateDefaultPlan for planY failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - switch(fftPlan->outputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - colPlan->outputLayout = CLFFT_COMPLEX_PLANAR; - colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - colPlan->placeness = CLFFT_INPLACE; - colPlan->length.push_back(Nt); - - colPlan->outStride[0] = fftPlan->outStride[1]; - colPlan->outStride.push_back(fftPlan->outStride[0]); - colPlan->oDist = fftPlan->oDist; - - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = fftPlan->tmpBufSize; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - colPlan->inStride[0] = rowPlan->outStride[1]; - colPlan->inStride.push_back(rowPlan->outStride[0]); - colPlan->iDist = rowPlan->oDist; - - //this 2d is decomposed from 3d - for (size_t index=2; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->outStride.push_back(fftPlan->outStride[index]); - colPlan->inStride.push_back(rowPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - colPlan->hasPostCallback = true; - colPlan->postCallbackParam = fftPlan->postCallbackParam; - colPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planY failed" ) ); - } - - } - else if(fftPlan->outputLayout == CLFFT_REAL) - { - length0 = fftPlan->length[0]; - length1 = fftPlan->length[1]; - - size_t Nt = (1 + length0/2); - if (fftPlan->tmpBufSize==0) - { - fftPlan->tmpBufSize = Nt * length1 * fftPlan->batchsize * fftPlan->ElementSize(); - for (size_t index=2; index < fftPlan->length.size(); index++) - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - - if ((fftPlan->tmpBufSizeC2R==0) && (fftPlan->placeness == CLFFT_OUTOFPLACE) && (fftPlan->length.size() == 2)) - { - fftPlan->tmpBufSizeC2R = fftPlan->tmpBufSize; - } - - if( (fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) && - ( ((fftPlan->outStride[1] == Nt*2) && (fftPlan->oDist == Nt*2*length1) && (fftPlan->placeness == CLFFT_INPLACE)) || - ((fftPlan->outStride[1] == length0) && (fftPlan->oDist == length0*length1) && (fftPlan->placeness == CLFFT_OUTOFPLACE)) ) - && (fftPlan->inStride[1] == Nt) && (fftPlan->iDist == Nt*length1) ) - { - // create first transpose plan - - //Transpose - // input --> tmp - size_t transLengths[2] = { length0, length1 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTY, fftPlan->context, CLFFT_2D, transLengths ), - _T( "CreateDefaultPlan for planTY transpose failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTY, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->transflag = true; - - transLengths[0] = Nt; - OPENCL_V(clfftSetPlanLength( fftPlan->planTY, CLFFT_2D, transLengths ), - _T( "clfftSetPlanLength for planTY transpose failed" ) ); - - switch(fftPlan->inputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - trans1Plan->placeness = CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->forwardScale = 1.0f; - trans1Plan->backwardScale = 1.0f; - - trans1Plan->inStride[0] = 1; - trans1Plan->inStride[1] = Nt; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = length1; - trans1Plan->iDist = fftPlan->iDist; - trans1Plan->oDist = Nt*length1; - trans1Plan->transOutHorizontal = true; - - trans1Plan->gen = Transpose_GCN; - - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - trans1Plan->inStride.push_back(fftPlan->inStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - trans1Plan->hasPreCallback = true; - trans1Plan->preCallback = fftPlan->preCallback; - trans1Plan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTY failed" ) ); - - // create col plan - // complex to complex - - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimY ] ), - _T( "CreateDefaultPlan for planY failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - colPlan->length.push_back(Nt); - - colPlan->inStride[0] = 1; - colPlan->inStride.push_back(length1); - colPlan->iDist = trans1Plan->oDist; - - colPlan->placeness = CLFFT_INPLACE; - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - - colPlan->outStride[0] = colPlan->inStride[0]; - colPlan->outStride.push_back(colPlan->inStride[1]); - colPlan->oDist = colPlan->iDist; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(trans1Plan->outStride[index]); - colPlan->outStride.push_back(trans1Plan->outStride[index]); - } - - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = 1.0f; - colPlan->backwardScale = 1.0f; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planY failed" ) ); - - // create second transpose plan - - //Transpose - //tmp --> output - size_t trans2Lengths[2] = { length1, length0 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, trans2Lengths ), - _T( "CreateDefaultPlan for planTX transpose failed" ) ); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans2Plan, trans2Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans2Plan->transflag = true; - - trans2Lengths[1] = Nt; - OPENCL_V(clfftSetPlanLength( fftPlan->planTX, CLFFT_2D, trans2Lengths ), - _T( "clfftSetPlanLength for planTX transpose failed" ) ); - - - trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + size_t length0 = fftPlan->length[0]; + size_t length1 = fftPlan->length[1]; + + if (fftPlan->length[0] > Large1DThreshold || + fftPlan->length[1] > Large1DThreshold) + fftPlan->large2D = true; + + while (true && (fftPlan->inputLayout != CLFFT_REAL) && + (fftPlan->outputLayout != CLFFT_REAL)) { + // break; + + // TODO : Check for a better way to do this. + bool isnvidia = false; + for (size_t Idx = 0; !isnvidia && Idx < numQueues; Idx++) { + cl_command_queue QIdx = commQueueFFT[Idx]; + cl_device_id Device; + clGetCommandQueueInfo(QIdx, CL_QUEUE_DEVICE, sizeof(Device), &Device, + nullptr); + char Vendor[256]; + clGetDeviceInfo(Device, CL_DEVICE_VENDOR, sizeof(Vendor), &Vendor, + nullptr); + isnvidia |= (strncmp(Vendor, "NVIDIA", 6) == 0); + } + // nvidia gpus are failing when doing transpose for 2D FFTs + if (isnvidia) + break; + + if (fftPlan->length.size() != 2) + break; + if (!(IsPo2(fftPlan->length[0])) || !(IsPo2(fftPlan->length[1]))) + break; + if (fftPlan->length[1] < 32) + break; + // TBD: restrict the use large2D in x!=y case becase we will need two temp + // buffers + // (1) for 2D usage (2) for 1D large usage + // if (fftPlan->large2D) break; + // Performance show 512 is the good case with transpose + // if user want the result to be transposed, then we will. + + if (fftPlan->length[0] < 64) + break; + // x!=y case, we need tmp buffer, currently temp buffer only support + // interleaved format if (fftPlan->length[0] != fftPlan->length[1] && + // fftPlan->outputLayout == CLFFT_COMPLEX_PLANAR) break; + if (fftPlan->inStride[0] != 1 || fftPlan->outStride[0] != 1 || + fftPlan->inStride[1] != fftPlan->length[0] || + fftPlan->outStride[1] != fftPlan->length[0]) + break; + // if (fftPlan->placeness != CLFFT_INPLACE || fftPlan->inputLayout != + // CLFFT_COMPLEX_PLANAR) break; if (fftPlan->batchsize != 1) break; if + // (fftPlan->precision != CLFFT_SINGLE) break; + + fftPlan->transflag = true; + + // create row plan, + // x=y & x!=y, In->In for inplace, In->out for outofplace + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, fftPlan->context, + CLFFT_1D, &fftPlan->length[DimX]), + _T( "CreateDefaultPlan for planX failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + rowPlan->inputLayout = fftPlan->inputLayout; + rowPlan->outputLayout = fftPlan->outputLayout; + rowPlan->placeness = fftPlan->placeness; + rowPlan->outStride[0] = fftPlan->outStride[0]; + rowPlan->outStride.push_back(fftPlan->outStride[1]); + rowPlan->oDist = fftPlan->oDist; + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = 1.0f; + rowPlan->backwardScale = 1.0f; + rowPlan->tmpBufSize = 0; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + rowPlan->batchsize = fftPlan->batchsize; + rowPlan->inStride[0] = fftPlan->inStride[0]; + rowPlan->length.push_back(fftPlan->length[1]); + rowPlan->inStride.push_back(fftPlan->inStride[1]); + rowPlan->iDist = fftPlan->iDist; + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + rowPlan->hasPreCallback = true; + rowPlan->preCallback = fftPlan->preCallback; + rowPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planX failed" )); + + // Create transpose plan for first transpose + // x=y: inplace. x!=y inplace: in->tmp, outofplace out->tmp + size_t clLengths[] = {1, 1, 0}; + clLengths[0] = fftPlan->length[0]; + clLengths[1] = fftPlan->length[1]; + + size_t biggerDim = + clLengths[0] > clLengths[1] ? clLengths[0] : clLengths[1]; + size_t smallerDim = + biggerDim == clLengths[0] ? clLengths[1] : clLengths[0]; + size_t padding = 0; + + fftPlan->transpose_in_2d_inplace = + (clLengths[0] == clLengths[1]) ? true : false; + if ((!fftPlan->transpose_in_2d_inplace) && fftPlan->tmpBufSize == 0 && + fftPlan->length.size() <= 2) { + if ((smallerDim % 64 == 0) || (biggerDim % 64 == 0)) + if (biggerDim > 512) + padding = 64; + + // we need tmp buffer for x!=y case + // we assume the tmp buffer is packed interleaved + fftPlan->tmpBufSize = (smallerDim + padding) * biggerDim * + fftPlan->batchsize * fftPlan->ElementSize(); + } + + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTX, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan for planT failed" )); + + FFTPlan *transPlanX = nullptr; + lockRAII *transLockX = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, transPlanX, transLockX), + _T( "fftRepo.getPlan failed" )); + + transPlanX->inputLayout = fftPlan->outputLayout; + transPlanX->precision = fftPlan->precision; + transPlanX->tmpBufSize = 0; + + transPlanX->envelope = fftPlan->envelope; + transPlanX->batchsize = fftPlan->batchsize; + transPlanX->inStride[0] = fftPlan->outStride[0]; + transPlanX->inStride[1] = fftPlan->outStride[1]; + transPlanX->iDist = fftPlan->oDist; + transPlanX->transflag = true; + + if (!fftPlan->transpose_in_2d_inplace) { + transPlanX->gen = Transpose_GCN; + transPlanX->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + transPlanX->placeness = CLFFT_OUTOFPLACE; + transPlanX->outStride[0] = 1; + transPlanX->outStride[1] = clLengths[1] + padding; + transPlanX->oDist = clLengths[0] * transPlanX->outStride[1]; + } else { + transPlanX->gen = Transpose_SQUARE; + transPlanX->outputLayout = fftPlan->outputLayout; + transPlanX->placeness = CLFFT_INPLACE; + transPlanX->outStride[0] = fftPlan->outStride[0]; + transPlanX->outStride[1] = fftPlan->outStride[1]; + transPlanX->oDist = fftPlan->oDist; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTX failed" )); + + // create second row plan + // x!=y: tmp->tmp, x=y case: In->In or Out->Out + // if Transposed result is a choice x!=y: tmp->In or out + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, fftPlan->context, + CLFFT_1D, &fftPlan->length[DimY]), + _T( "CreateDefaultPlan for planY failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + if (!fftPlan->transpose_in_2d_inplace) { + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inStride[0] = 1; + colPlan->inStride.push_back(clLengths[1] + padding); + colPlan->iDist = clLengths[0] * colPlan->inStride[1]; + + if (fftPlan->transposed == CLFFT_NOTRANSPOSE) { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->outStride[0] = 1; + colPlan->outStride.push_back(clLengths[1] + padding); + colPlan->oDist = clLengths[0] * colPlan->outStride[1]; + colPlan->placeness = CLFFT_INPLACE; + } else { + colPlan->outputLayout = fftPlan->outputLayout; + colPlan->outStride[0] = fftPlan->outStride[0]; + colPlan->outStride.push_back(clLengths[1] * fftPlan->outStride[0]); + colPlan->oDist = fftPlan->oDist; + colPlan->placeness = CLFFT_OUTOFPLACE; + } + } else { + colPlan->inputLayout = fftPlan->outputLayout; + colPlan->outputLayout = fftPlan->outputLayout; + colPlan->outStride[0] = fftPlan->outStride[0]; + colPlan->outStride.push_back(fftPlan->outStride[1]); + colPlan->oDist = fftPlan->oDist; + colPlan->inStride[0] = fftPlan->outStride[0]; + colPlan->inStride.push_back(fftPlan->outStride[1]); + colPlan->iDist = fftPlan->oDist; + colPlan->placeness = CLFFT_INPLACE; + } + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + colPlan->batchsize = fftPlan->batchsize; + colPlan->length.push_back(fftPlan->length[0]); + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planY failed" )); + + if (fftPlan->transposed == CLFFT_TRANSPOSED) { + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + + // Create transpose plan for second transpose + // x!=y case tmp->In or Out, x=y case In->In or Out->out + size_t clLengthsY[2] = {clLengths[1], clLengths[0]}; + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planTY, fftPlan->context, CLFFT_2D, clLengthsY), + _T( "CreateDefaultPlan for planTY failed" )); + + FFTPlan *transPlanY = nullptr; + lockRAII *transLockY = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, transPlanY, transLockY), + _T( "fftRepo.getPlan failed" )); + + if (!fftPlan->transpose_in_2d_inplace) { + transPlanY->gen = Transpose_GCN; + transPlanY->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + transPlanY->placeness = CLFFT_OUTOFPLACE; + transPlanY->inStride[0] = 1; + transPlanY->inStride[1] = clLengths[1] + padding; + transPlanY->iDist = clLengths[0] * transPlanY->inStride[1]; + transPlanY->transOutHorizontal = true; + } else { + transPlanY->gen = Transpose_SQUARE; + transPlanY->inputLayout = fftPlan->outputLayout; + transPlanY->placeness = CLFFT_INPLACE; + transPlanY->inStride[0] = fftPlan->outStride[0]; + transPlanY->inStride[1] = fftPlan->outStride[1]; + transPlanY->iDist = fftPlan->oDist; + } + transPlanY->outputLayout = fftPlan->outputLayout; + transPlanY->outStride[0] = fftPlan->outStride[0]; + transPlanY->outStride[1] = fftPlan->outStride[1]; + transPlanY->oDist = fftPlan->oDist; + transPlanY->precision = fftPlan->precision; + transPlanY->tmpBufSize = 0; + + transPlanY->envelope = fftPlan->envelope; + transPlanY->batchsize = fftPlan->batchsize; + transPlanY->transflag = true; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + transPlanY->hasPostCallback = true; + transPlanY->postCallbackParam = fftPlan->postCallbackParam; + transPlanY->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTY failed" )); + + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + // check transposed + if (fftPlan->transposed != CLFFT_NOTRANSPOSE) + return CLFFT_TRANSPOSED_NOTIMPLEMENTED; + + if (fftPlan->inputLayout == CLFFT_REAL) { + length0 = fftPlan->length[0]; + length1 = fftPlan->length[1]; + + size_t Nt = (1 + length0 / 2); + + // create row plan + // real to hermitian + + // create row plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, fftPlan->context, + CLFFT_1D, &fftPlan->length[DimX]), + _T( "CreateDefaultPlan for planX failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + rowPlan->outputLayout = fftPlan->outputLayout; + rowPlan->inputLayout = fftPlan->inputLayout; + rowPlan->placeness = fftPlan->placeness; + rowPlan->length.push_back(length1); + + rowPlan->inStride[0] = fftPlan->inStride[0]; + rowPlan->inStride.push_back(fftPlan->inStride[1]); + rowPlan->iDist = fftPlan->iDist; + + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = 1.0f; + rowPlan->backwardScale = 1.0f; + rowPlan->tmpBufSize = 0; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + + rowPlan->batchsize = fftPlan->batchsize; + + rowPlan->outStride[0] = fftPlan->outStride[0]; + rowPlan->outStride.push_back(fftPlan->outStride[1]); + rowPlan->oDist = fftPlan->oDist; + + // this 2d is decomposed from 3d + for (size_t index = 2; index < fftPlan->length.size(); index++) { + rowPlan->length.push_back(fftPlan->length[index]); + rowPlan->inStride.push_back(fftPlan->inStride[index]); + rowPlan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + rowPlan->hasPreCallback = true; + rowPlan->preCallback = fftPlan->preCallback; + rowPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planX failed" )); + + if ((rowPlan->inStride[0] == 1) && (rowPlan->outStride[0] == 1) && + (((rowPlan->inStride[1] == Nt * 2) && + (rowPlan->placeness == CLFFT_INPLACE)) || + ((rowPlan->inStride[1] == length0) && + (rowPlan->placeness == CLFFT_OUTOFPLACE))) && + (rowPlan->outStride[1] == Nt)) { + // calc temp buf size + if (fftPlan->tmpBufSize == 0) { + fftPlan->tmpBufSize = + Nt * length1 * fftPlan->batchsize * fftPlan->ElementSize(); + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + } + + // create first transpose plan + + // Transpose + // output --> tmp + size_t transLengths[2] = {length0, length1}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTX, + fftPlan->context, CLFFT_2D, + transLengths), + _T( "CreateDefaultPlan for planTX transpose failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->transflag = true; + + transLengths[0] = Nt; + OPENCL_V(clfftSetPlanLength(fftPlan->planTX, CLFFT_2D, transLengths), + _T( "clfftSetPlanLength for planTX transpose failed" )); + + switch (fftPlan->outputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + trans1Plan->placeness = CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->forwardScale = 1.0f; + trans1Plan->backwardScale = 1.0f; + + trans1Plan->inStride[0] = 1; + trans1Plan->inStride[1] = Nt; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = length1; + trans1Plan->iDist = rowPlan->oDist; + trans1Plan->oDist = Nt * length1; + trans1Plan->transOutHorizontal = true; + + trans1Plan->gen = Transpose_GCN; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + trans1Plan->inStride.push_back(rowPlan->outStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTX failed" )); + + // Create column plan as a row plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimY]), + _T( "CreateDefaultPlan for planY failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + colPlan->outputLayout = trans1Plan->outputLayout; + colPlan->inputLayout = trans1Plan->outputLayout; + colPlan->placeness = CLFFT_INPLACE; + colPlan->length.push_back(Nt); + + colPlan->inStride[0] = 1; + colPlan->inStride.push_back(length1); + colPlan->iDist = Nt * length1; + + colPlan->outStride[0] = 1; + colPlan->outStride.push_back(length1); + colPlan->oDist = Nt * length1; + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + // this 2d is decomposed from 3d + for (size_t index = 2; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(colPlan->iDist); + colPlan->outStride.push_back(colPlan->oDist); + colPlan->iDist *= fftPlan->length[index]; + colPlan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planY failed" )); + + if (fftPlan->transposed == CLFFT_TRANSPOSED) { + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + + // create second transpose plan + + // Transpose + // output --> tmp + size_t trans2Lengths[2] = {length1, length0}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTY, + fftPlan->context, CLFFT_2D, + trans2Lengths), + _T( "CreateDefaultPlan for planTY transpose failed" )); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans2Plan, trans2Lock), + _T( "fftRepo.getPlan failed" )); + + trans2Plan->transflag = true; + + trans2Lengths[1] = Nt; + OPENCL_V(clfftSetPlanLength(fftPlan->planTY, CLFFT_2D, trans2Lengths), + _T( "clfftSetPlanLength for planTY transpose failed" )); + + switch (fftPlan->outputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + trans2Plan->outputLayout = CLFFT_COMPLEX_PLANAR; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + default: + assert(false); + } + + trans2Plan->placeness = CLFFT_OUTOFPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->forwardScale = 1.0f; + trans2Plan->backwardScale = 1.0f; + + trans2Plan->inStride[0] = 1; + trans2Plan->inStride[1] = length1; + trans2Plan->outStride[0] = 1; + trans2Plan->outStride[1] = Nt; + trans2Plan->iDist = Nt * length1; + trans2Plan->oDist = fftPlan->oDist; + + trans2Plan->gen = Transpose_GCN; + trans2Plan->transflag = true; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + trans2Plan->length.push_back(fftPlan->length[index]); + trans2Plan->inStride.push_back(trans2Plan->iDist); + trans2Plan->iDist *= fftPlan->length[index]; + trans2Plan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + trans2Plan->hasPostCallback = true; + trans2Plan->postCallbackParam = fftPlan->postCallbackParam; + trans2Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTY failed" )); + + } else { + // create col plan + // complex to complex + + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimY]), + _T( "CreateDefaultPlan for planY failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + switch (fftPlan->outputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + colPlan->outputLayout = CLFFT_COMPLEX_PLANAR; + colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + colPlan->placeness = CLFFT_INPLACE; + colPlan->length.push_back(Nt); + + colPlan->outStride[0] = fftPlan->outStride[1]; + colPlan->outStride.push_back(fftPlan->outStride[0]); + colPlan->oDist = fftPlan->oDist; + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = fftPlan->tmpBufSize; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + colPlan->inStride[0] = rowPlan->outStride[1]; + colPlan->inStride.push_back(rowPlan->outStride[0]); + colPlan->iDist = rowPlan->oDist; + + // this 2d is decomposed from 3d + for (size_t index = 2; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->outStride.push_back(fftPlan->outStride[index]); + colPlan->inStride.push_back(rowPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + colPlan->hasPostCallback = true; + colPlan->postCallbackParam = fftPlan->postCallbackParam; + colPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planY failed" )); + } + + } else if (fftPlan->outputLayout == CLFFT_REAL) { + length0 = fftPlan->length[0]; + length1 = fftPlan->length[1]; + + size_t Nt = (1 + length0 / 2); + if (fftPlan->tmpBufSize == 0) { + fftPlan->tmpBufSize = + Nt * length1 * fftPlan->batchsize * fftPlan->ElementSize(); + for (size_t index = 2; index < fftPlan->length.size(); index++) + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + + if ((fftPlan->tmpBufSizeC2R == 0) && + (fftPlan->placeness == CLFFT_OUTOFPLACE) && + (fftPlan->length.size() == 2)) { + fftPlan->tmpBufSizeC2R = fftPlan->tmpBufSize; + } + + if ((fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) && + (((fftPlan->outStride[1] == Nt * 2) && + (fftPlan->oDist == Nt * 2 * length1) && + (fftPlan->placeness == CLFFT_INPLACE)) || + ((fftPlan->outStride[1] == length0) && + (fftPlan->oDist == length0 * length1) && + (fftPlan->placeness == CLFFT_OUTOFPLACE))) && + (fftPlan->inStride[1] == Nt) && (fftPlan->iDist == Nt * length1)) { + // create first transpose plan + + // Transpose + // input --> tmp + size_t transLengths[2] = {length0, length1}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTY, + fftPlan->context, CLFFT_2D, + transLengths), + _T( "CreateDefaultPlan for planTY transpose failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->transflag = true; + + transLengths[0] = Nt; + OPENCL_V(clfftSetPlanLength(fftPlan->planTY, CLFFT_2D, transLengths), + _T( "clfftSetPlanLength for planTY transpose failed" )); + + switch (fftPlan->inputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + trans1Plan->placeness = CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->forwardScale = 1.0f; + trans1Plan->backwardScale = 1.0f; + + trans1Plan->inStride[0] = 1; + trans1Plan->inStride[1] = Nt; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = length1; + trans1Plan->iDist = fftPlan->iDist; + trans1Plan->oDist = Nt * length1; + trans1Plan->transOutHorizontal = true; + + trans1Plan->gen = Transpose_GCN; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + trans1Plan->inStride.push_back(fftPlan->inStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + trans1Plan->hasPreCallback = true; + trans1Plan->preCallback = fftPlan->preCallback; + trans1Plan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTY failed" )); + + // create col plan + // complex to complex + + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimY]), + _T( "CreateDefaultPlan for planY failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + colPlan->length.push_back(Nt); + + colPlan->inStride[0] = 1; + colPlan->inStride.push_back(length1); + colPlan->iDist = trans1Plan->oDist; + + colPlan->placeness = CLFFT_INPLACE; + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + + colPlan->outStride[0] = colPlan->inStride[0]; + colPlan->outStride.push_back(colPlan->inStride[1]); + colPlan->oDist = colPlan->iDist; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(trans1Plan->outStride[index]); + colPlan->outStride.push_back(trans1Plan->outStride[index]); + } + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = 1.0f; + colPlan->backwardScale = 1.0f; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planY failed" )); + + // create second transpose plan + + // Transpose + // tmp --> output + size_t trans2Lengths[2] = {length1, length0}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTX, + fftPlan->context, CLFFT_2D, + trans2Lengths), + _T( "CreateDefaultPlan for planTX transpose failed" )); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans2Plan, trans2Lock), + _T( "fftRepo.getPlan failed" )); + + trans2Plan->transflag = true; + + trans2Lengths[1] = Nt; + OPENCL_V(clfftSetPlanLength(fftPlan->planTX, CLFFT_2D, trans2Lengths), + _T( "clfftSetPlanLength for planTX transpose failed" )); + + trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + + trans2Plan->placeness = CLFFT_OUTOFPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->forwardScale = 1.0f; + trans2Plan->backwardScale = 1.0f; + + trans2Plan->inStride[0] = 1; + trans2Plan->inStride[1] = length1; + trans2Plan->outStride[0] = 1; + trans2Plan->outStride[1] = Nt; + trans2Plan->iDist = colPlan->oDist; + trans2Plan->oDist = Nt * length1; + + trans2Plan->gen = Transpose_GCN; + trans2Plan->transflag = true; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + trans2Plan->length.push_back(fftPlan->length[index]); + trans2Plan->inStride.push_back(colPlan->outStride[index]); + trans2Plan->outStride.push_back(trans2Plan->oDist); + trans2Plan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTX failed" )); + + // create row plan + // hermitian to real + + // create row plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimX]), + _T( "CreateDefaultPlan for planX failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + rowPlan->outputLayout = fftPlan->outputLayout; + rowPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; + + rowPlan->length.push_back(length1); + + rowPlan->outStride[0] = fftPlan->outStride[0]; + rowPlan->outStride.push_back(fftPlan->outStride[1]); + rowPlan->oDist = fftPlan->oDist; + + rowPlan->inStride[0] = trans2Plan->outStride[0]; + rowPlan->inStride.push_back(trans2Plan->outStride[1]); + rowPlan->iDist = trans2Plan->oDist; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + rowPlan->length.push_back(fftPlan->length[index]); + rowPlan->inStride.push_back(trans2Plan->outStride[index]); + rowPlan->outStride.push_back(fftPlan->outStride[index]); + } + + if (fftPlan->placeness == CLFFT_INPLACE) { + rowPlan->placeness = CLFFT_INPLACE; + } else { + rowPlan->placeness = CLFFT_OUTOFPLACE; + } + + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = fftPlan->forwardScale; + rowPlan->backwardScale = fftPlan->backwardScale; + rowPlan->tmpBufSize = 0; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + + rowPlan->batchsize = fftPlan->batchsize; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + rowPlan->hasPostCallback = true; + rowPlan->postCallbackParam = fftPlan->postCallbackParam; + rowPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planX failed" )); + } else { + + // create col plan + // complex to complex + + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimY]), + _T( "CreateDefaultPlan for planY failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + switch (fftPlan->inputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + colPlan->length.push_back(Nt); + + colPlan->inStride[0] = fftPlan->inStride[1]; + colPlan->inStride.push_back(fftPlan->inStride[0]); + colPlan->iDist = fftPlan->iDist; + + if (fftPlan->placeness == CLFFT_INPLACE) { + colPlan->placeness = CLFFT_INPLACE; + } else { + if (fftPlan->length.size() > 2) + colPlan->placeness = CLFFT_INPLACE; + else + colPlan->placeness = CLFFT_OUTOFPLACE; + } + + if (colPlan->placeness == CLFFT_INPLACE) { + colPlan->outStride[0] = colPlan->inStride[0]; + colPlan->outStride.push_back(colPlan->inStride[1]); + colPlan->oDist = colPlan->iDist; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(fftPlan->inStride[index]); + colPlan->outStride.push_back(fftPlan->inStride[index]); + } + } else { + colPlan->outStride[0] = Nt; + colPlan->outStride.push_back(1); + colPlan->oDist = Nt * length1; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(fftPlan->inStride[index]); + colPlan->outStride.push_back(colPlan->oDist); + colPlan->oDist *= fftPlan->length[index]; + } + } + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = 1.0f; + colPlan->backwardScale = 1.0f; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + colPlan->hasPreCallback = true; + colPlan->preCallback = fftPlan->preCallback; + colPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planY failed" )); + + // create row plan + // hermitian to real + + // create row plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimX]), + _T( "CreateDefaultPlan for planX failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + rowPlan->outputLayout = fftPlan->outputLayout; + rowPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; + + rowPlan->length.push_back(length1); + + rowPlan->outStride[0] = fftPlan->outStride[0]; + rowPlan->outStride.push_back(fftPlan->outStride[1]); + rowPlan->oDist = fftPlan->oDist; + + if (fftPlan->placeness == CLFFT_INPLACE) { + rowPlan->placeness = CLFFT_INPLACE; + + rowPlan->inStride[0] = colPlan->outStride[1]; + rowPlan->inStride.push_back(colPlan->outStride[0]); + rowPlan->iDist = colPlan->oDist; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + rowPlan->length.push_back(fftPlan->length[index]); + rowPlan->inStride.push_back(colPlan->outStride[index]); + rowPlan->outStride.push_back(fftPlan->outStride[index]); + } + } else { + rowPlan->placeness = CLFFT_OUTOFPLACE; + + rowPlan->inStride[0] = 1; + rowPlan->inStride.push_back(Nt); + rowPlan->iDist = Nt * length1; + + for (size_t index = 2; index < fftPlan->length.size(); index++) { + rowPlan->length.push_back(fftPlan->length[index]); + rowPlan->outStride.push_back(fftPlan->outStride[index]); + rowPlan->inStride.push_back(rowPlan->iDist); + rowPlan->iDist *= fftPlan->length[index]; + } + } + + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = fftPlan->forwardScale; + rowPlan->backwardScale = fftPlan->backwardScale; + rowPlan->tmpBufSize = 0; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + + rowPlan->batchsize = fftPlan->batchsize; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + rowPlan->hasPostCallback = true; + rowPlan->postCallbackParam = fftPlan->postCallbackParam; + rowPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planX failed" )); + } + } else { + if (fftPlan->tmpBufSize == 0 && fftPlan->length.size() <= 2) { + fftPlan->tmpBufSize = + length0 * length1 * fftPlan->batchsize * fftPlan->ElementSize(); + } + + // create row plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, fftPlan->context, + CLFFT_1D, &fftPlan->length[DimX]), + _T( "CreateDefaultPlan for planX failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + rowPlan->inputLayout = fftPlan->inputLayout; + if (fftPlan->large2D || fftPlan->length.size() > 2) { + rowPlan->outputLayout = fftPlan->outputLayout; + rowPlan->placeness = fftPlan->placeness; + rowPlan->outStride[0] = fftPlan->outStride[0]; + rowPlan->outStride.push_back(fftPlan->outStride[1]); + rowPlan->oDist = fftPlan->oDist; + } else { + rowPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + rowPlan->placeness = CLFFT_OUTOFPLACE; + rowPlan->outStride[0] = length1; // 1; + rowPlan->outStride.push_back(1); // length0); + rowPlan->oDist = length0 * length1; + } + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = 1.0f; + rowPlan->backwardScale = 1.0f; + rowPlan->tmpBufSize = fftPlan->tmpBufSize; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + + // This is the row fft, the first elements distance between the first two + // FFTs is the distance of the first elements of the first two rows in the + // original buffer. + rowPlan->batchsize = fftPlan->batchsize; + rowPlan->inStride[0] = fftPlan->inStride[0]; + + // pass length and other info to kernel, so the kernel knows this is + // decomposed from higher dimension + rowPlan->length.push_back(fftPlan->length[1]); + rowPlan->inStride.push_back(fftPlan->inStride[1]); + + // this 2d is decomposed from 3d + if (fftPlan->length.size() > 2) { + rowPlan->length.push_back(fftPlan->length[2]); + rowPlan->inStride.push_back(fftPlan->inStride[2]); + rowPlan->outStride.push_back(fftPlan->outStride[2]); + } + + rowPlan->iDist = fftPlan->iDist; + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + rowPlan->hasPreCallback = true; + rowPlan->preCallback = fftPlan->preCallback; + rowPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planX failed" )); + + // create col plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planY, fftPlan->context, + CLFFT_1D, &fftPlan->length[DimY]), + _T( "CreateDefaultPlan for planY failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planY, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + if (fftPlan->large2D || fftPlan->length.size() > 2) { + colPlan->inputLayout = fftPlan->outputLayout; + colPlan->placeness = CLFFT_INPLACE; + colPlan->inStride[0] = fftPlan->outStride[1]; + colPlan->inStride.push_back(fftPlan->outStride[0]); + colPlan->iDist = fftPlan->oDist; + } else { + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->placeness = CLFFT_OUTOFPLACE; + colPlan->inStride[0] = 1; // length0; + colPlan->inStride.push_back(length1); // 1); + colPlan->iDist = length0 * length1; + } + + colPlan->outputLayout = fftPlan->outputLayout; + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = fftPlan->tmpBufSize; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + // This is a column FFT, the first elements distance between each FFT is + // the distance of the first two elements in the original buffer. Like a + // transpose of the matrix + colPlan->batchsize = fftPlan->batchsize; + colPlan->outStride[0] = fftPlan->outStride[1]; + + // pass length and other info to kernel, so the kernel knows this is + // decomposed from higher dimension + colPlan->length.push_back(fftPlan->length[0]); + colPlan->outStride.push_back(fftPlan->outStride[0]); + colPlan->oDist = fftPlan->oDist; + + // this 2d is decomposed from 3d + if (fftPlan->length.size() > 2) { + // assert(fftPlan->large2D); + colPlan->length.push_back(fftPlan->length[2]); + colPlan->inStride.push_back(fftPlan->outStride[2]); + colPlan->outStride.push_back(fftPlan->outStride[2]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + colPlan->hasPostCallback = true; + colPlan->postCallbackParam = fftPlan->postCallbackParam; + colPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planY failed" )); + } - trans2Plan->placeness = CLFFT_OUTOFPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->forwardScale = 1.0f; - trans2Plan->backwardScale = 1.0f; + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + case CLFFT_3D: { + if (fftPlan->inputLayout == CLFFT_REAL) { + + size_t length0 = fftPlan->length[DimX]; + size_t length1 = fftPlan->length[DimY]; + size_t length2 = fftPlan->length[DimZ]; + + size_t Nt = (1 + length0 / 2); + + // create 2D xy plan + size_t clLengths[] = {length0, length1, 0}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, fftPlan->context, + CLFFT_2D, clLengths), + _T( "CreateDefaultPlan 2D planX failed" )); + + FFTPlan *xyPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, xyPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + xyPlan->inputLayout = fftPlan->inputLayout; + xyPlan->outputLayout = fftPlan->outputLayout; + xyPlan->placeness = fftPlan->placeness; + xyPlan->precision = fftPlan->precision; + xyPlan->forwardScale = 1.0f; + xyPlan->backwardScale = 1.0f; + xyPlan->tmpBufSize = fftPlan->tmpBufSize; + + xyPlan->gen = fftPlan->gen; + xyPlan->envelope = fftPlan->envelope; + + // This is the xy fft, the first elements distance between the first two + // FFTs is the distance of the first elements of the first two rows in the + // original buffer. + xyPlan->batchsize = fftPlan->batchsize; + xyPlan->inStride[0] = fftPlan->inStride[0]; + xyPlan->inStride[1] = fftPlan->inStride[1]; + xyPlan->outStride[0] = fftPlan->outStride[0]; + xyPlan->outStride[1] = fftPlan->outStride[1]; + + // pass length and other info to kernel, so the kernel knows this is + // decomposed from higher dimension + xyPlan->length.push_back(fftPlan->length[2]); + xyPlan->inStride.push_back(fftPlan->inStride[2]); + xyPlan->outStride.push_back(fftPlan->outStride[2]); + xyPlan->iDist = fftPlan->iDist; + xyPlan->oDist = fftPlan->oDist; + + // this 3d is decomposed from 4d + for (size_t index = 3; index < fftPlan->length.size(); index++) { + xyPlan->length.push_back(fftPlan->length[index]); + xyPlan->inStride.push_back(fftPlan->inStride[index]); + xyPlan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + xyPlan->hasPreCallback = true; + xyPlan->preCallback = fftPlan->preCallback; + xyPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan 3D->2D planX failed" )); + + if ((xyPlan->inStride[0] == 1) && (xyPlan->outStride[0] == 1) && + (xyPlan->outStride[2] == Nt * length1) && + (((xyPlan->inStride[2] == Nt * 2 * length1) && + (xyPlan->placeness == CLFFT_INPLACE)) || + ((xyPlan->inStride[2] == length0 * length1) && + (xyPlan->placeness == CLFFT_OUTOFPLACE)))) { + + if (fftPlan->tmpBufSize == 0) { + fftPlan->tmpBufSize = Nt * length1 * length2 * fftPlan->batchsize * + fftPlan->ElementSize(); + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + } + + // create first transpose plan + + // Transpose + // output --> tmp + size_t transLengths[2] = {length0 * length1, length2}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTX, + fftPlan->context, CLFFT_2D, + transLengths), + _T( "CreateDefaultPlan for planTX transpose failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->transflag = true; + + transLengths[0] = Nt * length1; + OPENCL_V(clfftSetPlanLength(fftPlan->planTX, CLFFT_2D, transLengths), + _T( "clfftSetPlanLength for planTX transpose failed" )); + + switch (fftPlan->outputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + trans1Plan->placeness = CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->forwardScale = 1.0f; + trans1Plan->backwardScale = 1.0f; + + trans1Plan->inStride[0] = 1; + trans1Plan->inStride[1] = Nt * length1; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = length2; + trans1Plan->iDist = xyPlan->oDist; + trans1Plan->oDist = Nt * length1 * length2; + trans1Plan->transOutHorizontal = true; + + trans1Plan->gen = Transpose_GCN; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + trans1Plan->inStride.push_back(xyPlan->outStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTX failed" )); + + // Create column plan as a row plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planZ, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimZ]), + _T( "CreateDefaultPlan for planZ failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planZ, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + colPlan->outputLayout = trans1Plan->outputLayout; + colPlan->inputLayout = trans1Plan->outputLayout; + colPlan->placeness = CLFFT_INPLACE; + colPlan->length.push_back(Nt * length1); + + colPlan->inStride[0] = 1; + colPlan->inStride.push_back(length2); + colPlan->iDist = Nt * length1 * length2; + + colPlan->outStride[0] = 1; + colPlan->outStride.push_back(length2); + colPlan->oDist = Nt * length1 * length2; + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + // this 2d is decomposed from 3d + for (size_t index = 3; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(colPlan->iDist); + colPlan->outStride.push_back(colPlan->oDist); + colPlan->iDist *= fftPlan->length[index]; + colPlan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planZ failed" )); + + if (fftPlan->transposed == CLFFT_TRANSPOSED) { + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + + // create second transpose plan + + // Transpose + // output --> tmp + size_t trans2Lengths[2] = {length2, length0 * length1}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTY, + fftPlan->context, CLFFT_2D, + trans2Lengths), + _T( "CreateDefaultPlan for planTY transpose failed" )); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTY, trans2Plan, trans2Lock), + _T( "fftRepo.getPlan failed" )); + + trans2Plan->transflag = true; + + trans2Lengths[1] = Nt * length1; + OPENCL_V(clfftSetPlanLength(fftPlan->planTY, CLFFT_2D, trans2Lengths), + _T( "clfftSetPlanLength for planTY transpose failed" )); + + switch (fftPlan->outputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + trans2Plan->outputLayout = CLFFT_COMPLEX_PLANAR; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + default: + assert(false); + } + + trans2Plan->placeness = CLFFT_OUTOFPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->forwardScale = 1.0f; + trans2Plan->backwardScale = 1.0f; + + trans2Plan->inStride[0] = 1; + trans2Plan->inStride[1] = length2; + trans2Plan->outStride[0] = 1; + trans2Plan->outStride[1] = Nt * length1; + trans2Plan->iDist = Nt * length1 * length2; + trans2Plan->oDist = fftPlan->oDist; + + trans2Plan->gen = Transpose_GCN; + trans2Plan->transflag = true; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + trans2Plan->length.push_back(fftPlan->length[index]); + trans2Plan->inStride.push_back(trans2Plan->iDist); + trans2Plan->iDist *= fftPlan->length[index]; + trans2Plan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + trans2Plan->hasPostCallback = true; + trans2Plan->postCallbackParam = fftPlan->postCallbackParam; + trans2Plan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTY failed" )); + + } else { + + clLengths[0] = fftPlan->length[DimZ]; + clLengths[1] = clLengths[2] = 0; + // create 1D col plan + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planZ, fftPlan->context, CLFFT_1D, clLengths), + _T( "CreateDefaultPlan for planZ failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planZ, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + switch (fftPlan->outputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + colPlan->outputLayout = CLFFT_COMPLEX_PLANAR; + colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + colPlan->placeness = CLFFT_INPLACE; + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = fftPlan->tmpBufSize; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + // This is a column FFT, the first elements distance between each FFT is + // the distance of the first two elements in the original buffer. Like a + // transpose of the matrix + colPlan->batchsize = fftPlan->batchsize; + colPlan->inStride[0] = fftPlan->outStride[2]; + colPlan->outStride[0] = fftPlan->outStride[2]; + + // pass length and other info to kernel, so the kernel knows this is + // decomposed from higher dimension + colPlan->length.push_back(1 + fftPlan->length[0] / 2); + colPlan->length.push_back(fftPlan->length[1]); + colPlan->inStride.push_back(fftPlan->outStride[0]); + colPlan->inStride.push_back(fftPlan->outStride[1]); + colPlan->outStride.push_back(fftPlan->outStride[0]); + colPlan->outStride.push_back(fftPlan->outStride[1]); + colPlan->iDist = fftPlan->oDist; + colPlan->oDist = fftPlan->oDist; + + // this 3d is decomposed from 4d + for (size_t index = 3; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(xyPlan->outStride[index]); + colPlan->outStride.push_back(fftPlan->outStride[index]); + } + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + colPlan->hasPostCallback = true; + colPlan->postCallbackParam = fftPlan->postCallbackParam; + colPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan 3D->1D planZ failed" )); + } + } else if (fftPlan->outputLayout == CLFFT_REAL) { + size_t length0 = fftPlan->length[DimX]; + size_t length1 = fftPlan->length[DimY]; + size_t length2 = fftPlan->length[DimZ]; + + size_t Nt = (1 + length0 / 2); + + if (fftPlan->tmpBufSize == 0) { + fftPlan->tmpBufSize = Nt * length1 * length2 * fftPlan->batchsize * + fftPlan->ElementSize(); + for (size_t index = 3; index < fftPlan->length.size(); index++) + fftPlan->tmpBufSize *= fftPlan->length[index]; + } + + if ((fftPlan->tmpBufSizeC2R == 0) && + (fftPlan->placeness == CLFFT_OUTOFPLACE)) { + fftPlan->tmpBufSizeC2R = fftPlan->tmpBufSize; + } + + if ((fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) && + (((fftPlan->outStride[2] == Nt * 2 * length1) && + (fftPlan->oDist == Nt * 2 * length1 * length2) && + (fftPlan->placeness == CLFFT_INPLACE)) || + ((fftPlan->outStride[2] == length0 * length1) && + (fftPlan->oDist == length0 * length1 * length2) && + (fftPlan->placeness == CLFFT_OUTOFPLACE))) && + (fftPlan->inStride[2] == Nt * length1) && + (fftPlan->iDist == Nt * length1 * length2)) { + // create first transpose plan + + // Transpose + // input --> tmp + size_t transLengths[2] = {length0 * length1, length2}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTZ, + fftPlan->context, CLFFT_2D, + transLengths), + _T( "CreateDefaultPlan for planTZ transpose failed" )); + + FFTPlan *trans1Plan = nullptr; + lockRAII *trans1Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTZ, trans1Plan, trans1Lock), + _T( "fftRepo.getPlan failed" )); + + trans1Plan->transflag = true; + + transLengths[0] = Nt * length1; + OPENCL_V(clfftSetPlanLength(fftPlan->planTZ, CLFFT_2D, transLengths), + _T( "clfftSetPlanLength for planTZ transpose failed" )); + + switch (fftPlan->inputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + trans1Plan->placeness = CLFFT_OUTOFPLACE; + trans1Plan->precision = fftPlan->precision; + trans1Plan->tmpBufSize = 0; + trans1Plan->batchsize = fftPlan->batchsize; + trans1Plan->envelope = fftPlan->envelope; + trans1Plan->forwardScale = 1.0f; + trans1Plan->backwardScale = 1.0f; + + trans1Plan->inStride[0] = 1; + trans1Plan->inStride[1] = Nt * length1; + trans1Plan->outStride[0] = 1; + trans1Plan->outStride[1] = length2; + trans1Plan->iDist = fftPlan->iDist; + trans1Plan->oDist = Nt * length1 * length2; + trans1Plan->transOutHorizontal = true; + + trans1Plan->gen = Transpose_GCN; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + trans1Plan->length.push_back(fftPlan->length[index]); + trans1Plan->inStride.push_back(fftPlan->inStride[index]); + trans1Plan->outStride.push_back(trans1Plan->oDist); + trans1Plan->oDist *= fftPlan->length[index]; + } + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + trans1Plan->hasPreCallback = true; + trans1Plan->preCallback = fftPlan->preCallback; + trans1Plan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTZ failed" )); + + // create col plan + // complex to complex + + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planZ, + fftPlan->context, CLFFT_1D, + &fftPlan->length[DimZ]), + _T( "CreateDefaultPlan for planZ failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planZ, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + colPlan->length.push_back(Nt * length1); + + colPlan->inStride[0] = 1; + colPlan->inStride.push_back(length2); + colPlan->iDist = trans1Plan->oDist; + + colPlan->placeness = CLFFT_INPLACE; + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + + colPlan->outStride[0] = colPlan->inStride[0]; + colPlan->outStride.push_back(colPlan->inStride[1]); + colPlan->oDist = colPlan->iDist; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(trans1Plan->outStride[index - 1]); + colPlan->outStride.push_back(trans1Plan->outStride[index - 1]); + } + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = 1.0f; + colPlan->backwardScale = 1.0f; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + OPENCL_V( + clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planZ failed" )); + + // create second transpose plan + + // Transpose + // tmp --> output + size_t trans2Lengths[2] = {length2, length0 * length1}; + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planTX, + fftPlan->context, CLFFT_2D, + trans2Lengths), + _T( "CreateDefaultPlan for planTX transpose failed" )); + + FFTPlan *trans2Plan = nullptr; + lockRAII *trans2Lock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planTX, trans2Plan, trans2Lock), + _T( "fftRepo.getPlan failed" )); + + trans2Plan->transflag = true; + + trans2Lengths[1] = Nt * length1; + OPENCL_V(clfftSetPlanLength(fftPlan->planTX, CLFFT_2D, trans2Lengths), + _T( "clfftSetPlanLength for planTX transpose failed" )); + + trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + + trans2Plan->placeness = CLFFT_OUTOFPLACE; + trans2Plan->precision = fftPlan->precision; + trans2Plan->tmpBufSize = 0; + trans2Plan->batchsize = fftPlan->batchsize; + trans2Plan->envelope = fftPlan->envelope; + trans2Plan->forwardScale = 1.0f; + trans2Plan->backwardScale = 1.0f; + + trans2Plan->inStride[0] = 1; + trans2Plan->inStride[1] = length2; + trans2Plan->outStride[0] = 1; + trans2Plan->outStride[1] = Nt * length1; + trans2Plan->iDist = colPlan->oDist; + trans2Plan->oDist = Nt * length1 * length2; + + trans2Plan->gen = Transpose_GCN; + trans2Plan->transflag = true; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + trans2Plan->length.push_back(fftPlan->length[index]); + trans2Plan->inStride.push_back(colPlan->outStride[index - 1]); + trans2Plan->outStride.push_back(trans2Plan->oDist); + trans2Plan->oDist *= fftPlan->length[index]; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planTX failed" )); + + // create row plan + // hermitian to real + + // create 2D xy plan + size_t clLengths[] = {length0, length1, 0}; + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planX, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan for 2D planX failed" )); + + FFTPlan *rowPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, rowPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + rowPlan->outputLayout = fftPlan->outputLayout; + rowPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; + + rowPlan->length.push_back(length2); + + rowPlan->outStride[0] = fftPlan->outStride[0]; + rowPlan->outStride[1] = fftPlan->outStride[1]; + rowPlan->outStride.push_back(fftPlan->outStride[2]); + rowPlan->oDist = fftPlan->oDist; + + rowPlan->inStride[0] = trans2Plan->outStride[0]; + rowPlan->inStride[1] = Nt; + rowPlan->inStride.push_back(Nt * length1); + rowPlan->iDist = trans2Plan->oDist; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + rowPlan->length.push_back(fftPlan->length[index]); + rowPlan->inStride.push_back(trans2Plan->outStride[index - 1]); + rowPlan->outStride.push_back(fftPlan->outStride[index]); + } + + if (fftPlan->placeness == CLFFT_INPLACE) { + rowPlan->placeness = CLFFT_INPLACE; + } else { + rowPlan->placeness = CLFFT_OUTOFPLACE; + } + + rowPlan->precision = fftPlan->precision; + rowPlan->forwardScale = fftPlan->forwardScale; + rowPlan->backwardScale = fftPlan->backwardScale; + rowPlan->tmpBufSize = 0; + + rowPlan->gen = fftPlan->gen; + rowPlan->envelope = fftPlan->envelope; + + rowPlan->batchsize = fftPlan->batchsize; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + rowPlan->hasPostCallback = true; + rowPlan->postCallbackParam = fftPlan->postCallbackParam; + rowPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan for planX failed" )); + } else { + + size_t clLengths[] = {1, 0, 0}; + + clLengths[0] = fftPlan->length[DimZ]; + + // create 1D col plan + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planZ, fftPlan->context, CLFFT_1D, clLengths), + _T( "CreateDefaultPlan for planZ failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planZ, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + switch (fftPlan->inputLayout) { + case CLFFT_HERMITIAN_INTERLEAVED: { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; + } break; + case CLFFT_HERMITIAN_PLANAR: { + colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; + colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; + } break; + default: + assert(false); + } + + colPlan->length.push_back(Nt); + colPlan->length.push_back(length1); + + colPlan->inStride[0] = fftPlan->inStride[2]; + colPlan->inStride.push_back(fftPlan->inStride[0]); + colPlan->inStride.push_back(fftPlan->inStride[1]); + colPlan->iDist = fftPlan->iDist; + + if (fftPlan->placeness == CLFFT_INPLACE) { + colPlan->placeness = CLFFT_INPLACE; + + colPlan->outStride[0] = colPlan->inStride[0]; + colPlan->outStride.push_back(colPlan->inStride[1]); + colPlan->outStride.push_back(colPlan->inStride[2]); + colPlan->oDist = colPlan->iDist; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(fftPlan->inStride[index]); + colPlan->outStride.push_back(fftPlan->inStride[index]); + } + } else { + colPlan->placeness = CLFFT_OUTOFPLACE; + + colPlan->outStride[0] = Nt * length1; + colPlan->outStride.push_back(1); + colPlan->outStride.push_back(Nt); + colPlan->oDist = Nt * length1 * length2; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + colPlan->length.push_back(fftPlan->length[index]); + colPlan->inStride.push_back(fftPlan->inStride[index]); + colPlan->outStride.push_back(colPlan->oDist); + colPlan->oDist *= fftPlan->length[index]; + } + } + + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = 1.0f; + colPlan->backwardScale = 1.0f; + colPlan->tmpBufSize = 0; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + colPlan->batchsize = fftPlan->batchsize; + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + colPlan->hasPreCallback = true; + colPlan->preCallback = fftPlan->preCallback; + colPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan 3D->1D planZ failed" )); + + clLengths[0] = fftPlan->length[DimX]; + clLengths[1] = fftPlan->length[DimY]; + + // create 2D xy plan + OPENCL_V(clfftCreateDefaultPlanInternal( + &fftPlan->planX, fftPlan->context, CLFFT_2D, clLengths), + _T( "CreateDefaultPlan 2D planX failed" )); + + FFTPlan *xyPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, xyPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + xyPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; + xyPlan->outputLayout = fftPlan->outputLayout; + + xyPlan->length.push_back(length2); + + xyPlan->outStride[0] = fftPlan->outStride[0]; + xyPlan->outStride[1] = fftPlan->outStride[1]; + xyPlan->outStride.push_back(fftPlan->outStride[2]); + xyPlan->oDist = fftPlan->oDist; + + if (fftPlan->placeness == CLFFT_INPLACE) { + xyPlan->placeness = CLFFT_INPLACE; + + xyPlan->inStride[0] = colPlan->outStride[1]; + xyPlan->inStride[1] = colPlan->outStride[2]; + xyPlan->inStride.push_back(colPlan->outStride[0]); + xyPlan->iDist = colPlan->oDist; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + xyPlan->length.push_back(fftPlan->length[index]); + xyPlan->inStride.push_back(colPlan->outStride[index]); + xyPlan->outStride.push_back(fftPlan->outStride[index]); + } + } else { + xyPlan->placeness = CLFFT_OUTOFPLACE; + + xyPlan->inStride[0] = 1; + xyPlan->inStride[1] = Nt; + xyPlan->inStride.push_back(Nt * length1); + xyPlan->iDist = Nt * length1 * length2; + + for (size_t index = 3; index < fftPlan->length.size(); index++) { + xyPlan->length.push_back(fftPlan->length[index]); + xyPlan->outStride.push_back(fftPlan->outStride[index]); + xyPlan->inStride.push_back(xyPlan->iDist); + xyPlan->iDist *= fftPlan->length[index]; + } + } + + xyPlan->precision = fftPlan->precision; + xyPlan->forwardScale = fftPlan->forwardScale; + xyPlan->backwardScale = fftPlan->backwardScale; + xyPlan->tmpBufSize = fftPlan->tmpBufSize; + + xyPlan->gen = fftPlan->gen; + xyPlan->envelope = fftPlan->envelope; + + xyPlan->batchsize = fftPlan->batchsize; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + xyPlan->hasPostCallback = true; + xyPlan->postCallbackParam = fftPlan->postCallbackParam; + xyPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan 3D->2D planX failed" )); + } + } else { + if (fftPlan->tmpBufSize == 0 && (fftPlan->length[0] > Large1DThreshold || + fftPlan->length[1] > Large1DThreshold || + fftPlan->length[2] > Large1DThreshold)) { + fftPlan->tmpBufSize = fftPlan->length[0] * fftPlan->length[1] * + fftPlan->length[2] * fftPlan->batchsize * + fftPlan->ElementSize(); + } + + size_t clLengths[] = {1, 1, 0}; + clLengths[0] = fftPlan->length[DimX]; + clLengths[1] = fftPlan->length[DimY]; + + // create 2D xy plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planX, fftPlan->context, + CLFFT_2D, clLengths), + _T( "CreateDefaultPlan 2D planX failed" )); + + FFTPlan *xyPlan = nullptr; + lockRAII *rowLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planX, xyPlan, rowLock), + _T( "fftRepo.getPlan failed" )); + + xyPlan->inputLayout = fftPlan->inputLayout; + xyPlan->outputLayout = fftPlan->outputLayout; + xyPlan->placeness = fftPlan->placeness; + xyPlan->precision = fftPlan->precision; + xyPlan->forwardScale = 1.0f; + xyPlan->backwardScale = 1.0f; + xyPlan->tmpBufSize = fftPlan->tmpBufSize; + + xyPlan->gen = fftPlan->gen; + xyPlan->envelope = fftPlan->envelope; + + // This is the xy fft, the first elements distance between the first two + // FFTs is the distance of the first elements of the first two rows in the + // original buffer. + xyPlan->batchsize = fftPlan->batchsize; + xyPlan->inStride[0] = fftPlan->inStride[0]; + xyPlan->inStride[1] = fftPlan->inStride[1]; + xyPlan->outStride[0] = fftPlan->outStride[0]; + xyPlan->outStride[1] = fftPlan->outStride[1]; + + // pass length and other info to kernel, so the kernel knows this is + // decomposed from higher dimension + xyPlan->length.push_back(fftPlan->length[2]); + xyPlan->inStride.push_back(fftPlan->inStride[2]); + xyPlan->outStride.push_back(fftPlan->outStride[2]); + xyPlan->iDist = fftPlan->iDist; + xyPlan->oDist = fftPlan->oDist; + + // Set callback data if set on top level plan + if (fftPlan->hasPreCallback) { + xyPlan->hasPreCallback = true; + xyPlan->preCallback = fftPlan->preCallback; + xyPlan->precallUserData = fftPlan->precallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan 3D->2D planX failed" )); + + clLengths[0] = fftPlan->length[DimZ]; + clLengths[1] = clLengths[2] = 0; + // create 1D col plan + OPENCL_V(clfftCreateDefaultPlanInternal(&fftPlan->planZ, fftPlan->context, + CLFFT_1D, clLengths), + _T( "CreateDefaultPlan for planZ failed" )); + + FFTPlan *colPlan = nullptr; + lockRAII *colLock = nullptr; + OPENCL_V(fftRepo.getPlan(fftPlan->planZ, colPlan, colLock), + _T( "fftRepo.getPlan failed" )); + + colPlan->inputLayout = fftPlan->outputLayout; + colPlan->outputLayout = fftPlan->outputLayout; + colPlan->placeness = CLFFT_INPLACE; + colPlan->precision = fftPlan->precision; + colPlan->forwardScale = fftPlan->forwardScale; + colPlan->backwardScale = fftPlan->backwardScale; + colPlan->tmpBufSize = fftPlan->tmpBufSize; + + colPlan->gen = fftPlan->gen; + colPlan->envelope = fftPlan->envelope; + + // This is a column FFT, the first elements distance between each FFT is + // the distance of the first two elements in the original buffer. Like a + // transpose of the matrix + colPlan->batchsize = fftPlan->batchsize; + colPlan->inStride[0] = fftPlan->outStride[2]; + colPlan->outStride[0] = fftPlan->outStride[2]; + + // pass length and other info to kernel, so the kernel knows this is + // decomposed from higher dimension + colPlan->length.push_back(fftPlan->length[0]); + colPlan->length.push_back(fftPlan->length[1]); + colPlan->inStride.push_back(fftPlan->outStride[0]); + colPlan->inStride.push_back(fftPlan->outStride[1]); + colPlan->outStride.push_back(fftPlan->outStride[0]); + colPlan->outStride.push_back(fftPlan->outStride[1]); + colPlan->iDist = fftPlan->oDist; + colPlan->oDist = fftPlan->oDist; + + // Set callback data if set on top level plan + if (fftPlan->hasPostCallback) { + colPlan->hasPostCallback = true; + colPlan->postCallbackParam = fftPlan->postCallbackParam; + colPlan->postcallUserData = fftPlan->postcallUserData; + } + + OPENCL_V( + clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, nullptr, nullptr), + _T( "BakePlan 3D->1D planZ failed" )); + } - trans2Plan->inStride[0] = 1; - trans2Plan->inStride[1] = length1; - trans2Plan->outStride[0] = 1; - trans2Plan->outStride[1] = Nt; - trans2Plan->iDist = colPlan->oDist; - trans2Plan->oDist = Nt*length1; - - trans2Plan->gen = Transpose_GCN; - trans2Plan->transflag = true; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - trans2Plan->length.push_back(fftPlan->length[index]); - trans2Plan->inStride.push_back(colPlan->outStride[index]); - trans2Plan->outStride.push_back(trans2Plan->oDist); - trans2Plan->oDist *= fftPlan->length[index]; + fftPlan->baked = true; + return CLFFT_SUCCESS; + } + } - } + clfftStatus err = selectAction(fftPlan, fftPlan->action, commQueueFFT); - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTX failed" ) ); + // Allocate resources + OPENCL_V(fftPlan->AllocateBuffers(), _T("AllocateBuffers() failed")); - // create row plan - // hermitian to real + fftPlan->ConstructAndEnqueueConstantBuffers(commQueueFFT); - //create row plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimX ] ), - _T( "CreateDefaultPlan for planX failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - rowPlan->outputLayout = fftPlan->outputLayout; - rowPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; - - rowPlan->length.push_back(length1); - - rowPlan->outStride[0] = fftPlan->outStride[0]; - rowPlan->outStride.push_back(fftPlan->outStride[1]); - rowPlan->oDist = fftPlan->oDist; - - rowPlan->inStride[0] = trans2Plan->outStride[0]; - rowPlan->inStride.push_back(trans2Plan->outStride[1]); - rowPlan->iDist = trans2Plan->oDist; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - rowPlan->length.push_back(fftPlan->length[index]); - rowPlan->inStride.push_back(trans2Plan->outStride[index]); - rowPlan->outStride.push_back(fftPlan->outStride[index]); - } - - if (fftPlan->placeness == CLFFT_INPLACE) - { - rowPlan->placeness = CLFFT_INPLACE; - } - else - { - rowPlan->placeness = CLFFT_OUTOFPLACE; - } - - - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = fftPlan->forwardScale; - rowPlan->backwardScale = fftPlan->backwardScale; - rowPlan->tmpBufSize = 0; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - - rowPlan->batchsize = fftPlan->batchsize; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - rowPlan->hasPostCallback = true; - rowPlan->postCallbackParam = fftPlan->postCallbackParam; - rowPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planX failed" ) ); - } - else - { - - // create col plan - // complex to complex - - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimY ] ), - _T( "CreateDefaultPlan for planY failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - - switch(fftPlan->inputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - - colPlan->length.push_back(Nt); - - colPlan->inStride[0] = fftPlan->inStride[1]; - colPlan->inStride.push_back(fftPlan->inStride[0]); - colPlan->iDist = fftPlan->iDist; - - - if (fftPlan->placeness == CLFFT_INPLACE) - { - colPlan->placeness = CLFFT_INPLACE; - } - else - { - if(fftPlan->length.size() > 2) - colPlan->placeness = CLFFT_INPLACE; - else - colPlan->placeness = CLFFT_OUTOFPLACE; - } - - if(colPlan->placeness == CLFFT_INPLACE) - { - colPlan->outStride[0] = colPlan->inStride[0]; - colPlan->outStride.push_back(colPlan->inStride[1]); - colPlan->oDist = colPlan->iDist; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(fftPlan->inStride[index]); - colPlan->outStride.push_back(fftPlan->inStride[index]); - } - } - else - { - colPlan->outStride[0] = Nt; - colPlan->outStride.push_back(1); - colPlan->oDist = Nt*length1; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(fftPlan->inStride[index]); - colPlan->outStride.push_back(colPlan->oDist); - colPlan->oDist *= fftPlan->length[index]; - } - } - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = 1.0f; - colPlan->backwardScale = 1.0f; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - colPlan->hasPreCallback = true; - colPlan->preCallback = fftPlan->preCallback; - colPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planY failed" ) ); - - // create row plan - // hermitian to real - - //create row plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimX ] ), - _T( "CreateDefaultPlan for planX failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - rowPlan->outputLayout = fftPlan->outputLayout; - rowPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; - - rowPlan->length.push_back(length1); - - rowPlan->outStride[0] = fftPlan->outStride[0]; - rowPlan->outStride.push_back(fftPlan->outStride[1]); - rowPlan->oDist = fftPlan->oDist; - - if (fftPlan->placeness == CLFFT_INPLACE) - { - rowPlan->placeness = CLFFT_INPLACE; - - rowPlan->inStride[0] = colPlan->outStride[1]; - rowPlan->inStride.push_back(colPlan->outStride[0]); - rowPlan->iDist = colPlan->oDist; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - rowPlan->length.push_back(fftPlan->length[index]); - rowPlan->inStride.push_back(colPlan->outStride[index]); - rowPlan->outStride.push_back(fftPlan->outStride[index]); - } - } - else - { - rowPlan->placeness = CLFFT_OUTOFPLACE; - - rowPlan->inStride[0] = 1; - rowPlan->inStride.push_back(Nt); - rowPlan->iDist = Nt*length1; - - for (size_t index=2; index < fftPlan->length.size(); index++) - { - rowPlan->length.push_back(fftPlan->length[index]); - rowPlan->outStride.push_back(fftPlan->outStride[index]); - rowPlan->inStride.push_back(rowPlan->iDist); - rowPlan->iDist *= fftPlan->length[index]; - } - } - - - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = fftPlan->forwardScale; - rowPlan->backwardScale = fftPlan->backwardScale; - rowPlan->tmpBufSize = 0; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - - rowPlan->batchsize = fftPlan->batchsize; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - rowPlan->hasPostCallback = true; - rowPlan->postCallbackParam = fftPlan->postCallbackParam; - rowPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planX failed" ) ); - } - } - else - { - if (fftPlan->tmpBufSize==0 && fftPlan->length.size()<=2) - { - fftPlan->tmpBufSize = length0 * length1 * - fftPlan->batchsize * fftPlan->ElementSize(); - } - - //create row plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimX ] ), - _T( "CreateDefaultPlan for planX failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - rowPlan->inputLayout = fftPlan->inputLayout; - if (fftPlan->large2D || fftPlan->length.size()>2) - { - rowPlan->outputLayout = fftPlan->outputLayout; - rowPlan->placeness = fftPlan->placeness; - rowPlan->outStride[0] = fftPlan->outStride[0]; - rowPlan->outStride.push_back(fftPlan->outStride[1]); - rowPlan->oDist = fftPlan->oDist; - } - else - { - rowPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - rowPlan->placeness = CLFFT_OUTOFPLACE; - rowPlan->outStride[0] = length1;//1; - rowPlan->outStride.push_back(1);//length0); - rowPlan->oDist = length0 * length1; - } - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = 1.0f; - rowPlan->backwardScale = 1.0f; - rowPlan->tmpBufSize = fftPlan->tmpBufSize; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - - // This is the row fft, the first elements distance between the first two FFTs is the distance of the first elements - // of the first two rows in the original buffer. - rowPlan->batchsize = fftPlan->batchsize; - rowPlan->inStride[0] = fftPlan->inStride[0]; - - //pass length and other info to kernel, so the kernel knows this is decomposed from higher dimension - rowPlan->length.push_back(fftPlan->length[1]); - rowPlan->inStride.push_back(fftPlan->inStride[1]); - - //this 2d is decomposed from 3d - if (fftPlan->length.size()>2) - { - rowPlan->length.push_back(fftPlan->length[2]); - rowPlan->inStride.push_back(fftPlan->inStride[2]); - rowPlan->outStride.push_back(fftPlan->outStride[2]); - } - - rowPlan->iDist = fftPlan->iDist; - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - rowPlan->hasPreCallback = true; - rowPlan->preCallback = fftPlan->preCallback; - rowPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planX failed" ) ); - - //create col plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planY, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimY ] ), - _T( "CreateDefaultPlan for planY failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planY, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - if (fftPlan->large2D || fftPlan->length.size()>2) - { - colPlan->inputLayout = fftPlan->outputLayout; - colPlan->placeness = CLFFT_INPLACE; - colPlan->inStride[0] = fftPlan->outStride[1]; - colPlan->inStride.push_back(fftPlan->outStride[0]); - colPlan->iDist = fftPlan->oDist; - } - else - { - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->placeness = CLFFT_OUTOFPLACE; - colPlan->inStride[0] = 1;//length0; - colPlan->inStride.push_back(length1);//1); - colPlan->iDist = length0 * length1; - } - - colPlan->outputLayout = fftPlan->outputLayout; - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = fftPlan->tmpBufSize; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - // This is a column FFT, the first elements distance between each FFT is the distance of the first two - // elements in the original buffer. Like a transpose of the matrix - colPlan->batchsize = fftPlan->batchsize; - colPlan->outStride[0] = fftPlan->outStride[1]; - - //pass length and other info to kernel, so the kernel knows this is decomposed from higher dimension - colPlan->length.push_back(fftPlan->length[0]); - colPlan->outStride.push_back(fftPlan->outStride[0]); - colPlan->oDist = fftPlan->oDist; - - //this 2d is decomposed from 3d - if (fftPlan->length.size()>2) - { - //assert(fftPlan->large2D); - colPlan->length.push_back(fftPlan->length[2]); - colPlan->inStride.push_back(fftPlan->outStride[2]); - colPlan->outStride.push_back(fftPlan->outStride[2]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - colPlan->hasPostCallback = true; - colPlan->postCallbackParam = fftPlan->postCallbackParam; - colPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planY, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planY failed" ) ); - } - - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - case CLFFT_3D: - { - if(fftPlan->inputLayout == CLFFT_REAL) - { - - size_t length0 = fftPlan->length[ DimX ]; - size_t length1 = fftPlan->length[ DimY ]; - size_t length2 = fftPlan->length[ DimZ ]; - - size_t Nt = (1 + length0/2); - - - //create 2D xy plan - size_t clLengths[] = { length0, length1, 0 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan 2D planX failed" ) ); - - FFTPlan* xyPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, xyPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - xyPlan->inputLayout = fftPlan->inputLayout; - xyPlan->outputLayout = fftPlan->outputLayout; - xyPlan->placeness = fftPlan->placeness; - xyPlan->precision = fftPlan->precision; - xyPlan->forwardScale = 1.0f; - xyPlan->backwardScale = 1.0f; - xyPlan->tmpBufSize = fftPlan->tmpBufSize; - - xyPlan->gen = fftPlan->gen; - xyPlan->envelope = fftPlan->envelope; - - // This is the xy fft, the first elements distance between the first two FFTs is the distance of the first elements - // of the first two rows in the original buffer. - xyPlan->batchsize = fftPlan->batchsize; - xyPlan->inStride[0] = fftPlan->inStride[0]; - xyPlan->inStride[1] = fftPlan->inStride[1]; - xyPlan->outStride[0] = fftPlan->outStride[0]; - xyPlan->outStride[1] = fftPlan->outStride[1]; - - //pass length and other info to kernel, so the kernel knows this is decomposed from higher dimension - xyPlan->length.push_back(fftPlan->length[2]); - xyPlan->inStride.push_back(fftPlan->inStride[2]); - xyPlan->outStride.push_back(fftPlan->outStride[2]); - xyPlan->iDist = fftPlan->iDist; - xyPlan->oDist = fftPlan->oDist; - - //this 3d is decomposed from 4d - for (size_t index=3; index < fftPlan->length.size(); index++) - { - xyPlan->length.push_back(fftPlan->length[index]); - xyPlan->inStride.push_back(fftPlan->inStride[index]); - xyPlan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - xyPlan->hasPreCallback = true; - xyPlan->preCallback = fftPlan->preCallback; - xyPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan 3D->2D planX failed" ) ); - - if( (xyPlan->inStride[0] == 1) && (xyPlan->outStride[0] == 1) && - (xyPlan->outStride[2] == Nt*length1) && - ( ((xyPlan->inStride[2] == Nt*2*length1) && (xyPlan->placeness == CLFFT_INPLACE)) || - ((xyPlan->inStride[2] == length0*length1) && (xyPlan->placeness == CLFFT_OUTOFPLACE)) ) ) - { - - if (fftPlan->tmpBufSize==0) - { - fftPlan->tmpBufSize = Nt * length1 * length2 * fftPlan->batchsize * fftPlan->ElementSize(); - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - } - - // create first transpose plan - - //Transpose - // output --> tmp - size_t transLengths[2] = { length0*length1, length2 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, transLengths ), - _T( "CreateDefaultPlan for planTX transpose failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->transflag = true; - - transLengths[0] = Nt*length1; - OPENCL_V(clfftSetPlanLength( fftPlan->planTX, CLFFT_2D, transLengths ), - _T( "clfftSetPlanLength for planTX transpose failed" ) ); - - switch(fftPlan->outputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - trans1Plan->placeness = CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->forwardScale = 1.0f; - trans1Plan->backwardScale = 1.0f; - - trans1Plan->inStride[0] = 1; - trans1Plan->inStride[1] = Nt*length1; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = length2; - trans1Plan->iDist = xyPlan->oDist; - trans1Plan->oDist = Nt*length1*length2; - trans1Plan->transOutHorizontal = true; - - trans1Plan->gen = Transpose_GCN; - - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - trans1Plan->inStride.push_back(xyPlan->outStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTX failed" ) ); - - // Create column plan as a row plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planZ, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimZ ] ), - _T( "CreateDefaultPlan for planZ failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planZ, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - colPlan->outputLayout = trans1Plan->outputLayout; - colPlan->inputLayout = trans1Plan->outputLayout; - colPlan->placeness = CLFFT_INPLACE; - colPlan->length.push_back(Nt*length1); - - colPlan->inStride[0] = 1; - colPlan->inStride.push_back(length2); - colPlan->iDist = Nt*length1*length2; - - colPlan->outStride[0] = 1; - colPlan->outStride.push_back(length2); - colPlan->oDist = Nt*length1*length2; - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - //this 2d is decomposed from 3d - for (size_t index=3; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(colPlan->iDist); - colPlan->outStride.push_back(colPlan->oDist); - colPlan->iDist *= fftPlan->length[index]; - colPlan->oDist *= fftPlan->length[index]; - } - - OPENCL_V(clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planZ failed" ) ); - - if (fftPlan->transposed == CLFFT_TRANSPOSED) - { - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - - // create second transpose plan - - //Transpose - //output --> tmp - size_t trans2Lengths[2] = { length2, length0*length1 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTY, fftPlan->context, CLFFT_2D, trans2Lengths ), - _T( "CreateDefaultPlan for planTY transpose failed" ) ); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTY, trans2Plan, trans2Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans2Plan->transflag = true; - - trans2Lengths[1] = Nt*length1; - OPENCL_V(clfftSetPlanLength( fftPlan->planTY, CLFFT_2D, trans2Lengths ), - _T( "clfftSetPlanLength for planTY transpose failed" ) ); - - switch(fftPlan->outputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - trans2Plan->outputLayout = CLFFT_COMPLEX_PLANAR; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - default: assert(false); - } - - trans2Plan->placeness = CLFFT_OUTOFPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->forwardScale = 1.0f; - trans2Plan->backwardScale = 1.0f; - - trans2Plan->inStride[0] = 1; - trans2Plan->inStride[1] = length2; - trans2Plan->outStride[0] = 1; - trans2Plan->outStride[1] = Nt*length1; - trans2Plan->iDist = Nt*length1*length2; - trans2Plan->oDist = fftPlan->oDist; - - trans2Plan->gen = Transpose_GCN; - trans2Plan->transflag = true; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - trans2Plan->length.push_back(fftPlan->length[index]); - trans2Plan->inStride.push_back(trans2Plan->iDist); - trans2Plan->iDist *= fftPlan->length[index]; - trans2Plan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - trans2Plan->hasPostCallback = true; - trans2Plan->postCallbackParam = fftPlan->postCallbackParam; - trans2Plan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTY, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTY failed" ) ); - - - } - else - { - - clLengths[0] = fftPlan->length[ DimZ ]; - clLengths[1] = clLengths[2] = 0; - //create 1D col plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planZ, fftPlan->context, CLFFT_1D, clLengths ), - _T( "CreateDefaultPlan for planZ failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planZ, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - switch(fftPlan->outputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - colPlan->outputLayout = CLFFT_COMPLEX_PLANAR; - colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - colPlan->placeness = CLFFT_INPLACE; - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = fftPlan->tmpBufSize; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - // This is a column FFT, the first elements distance between each FFT is the distance of the first two - // elements in the original buffer. Like a transpose of the matrix - colPlan->batchsize = fftPlan->batchsize; - colPlan->inStride[0] = fftPlan->outStride[2]; - colPlan->outStride[0] = fftPlan->outStride[2]; - - //pass length and other info to kernel, so the kernel knows this is decomposed from higher dimension - colPlan->length.push_back(1 + fftPlan->length[0]/2); - colPlan->length.push_back(fftPlan->length[1]); - colPlan->inStride.push_back(fftPlan->outStride[0]); - colPlan->inStride.push_back(fftPlan->outStride[1]); - colPlan->outStride.push_back(fftPlan->outStride[0]); - colPlan->outStride.push_back(fftPlan->outStride[1]); - colPlan->iDist = fftPlan->oDist; - colPlan->oDist = fftPlan->oDist; - - //this 3d is decomposed from 4d - for (size_t index=3; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(xyPlan->outStride[index]); - colPlan->outStride.push_back(fftPlan->outStride[index]); - } - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - colPlan->hasPostCallback = true; - colPlan->postCallbackParam = fftPlan->postCallbackParam; - colPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan 3D->1D planZ failed" ) ); - } - } - else if(fftPlan->outputLayout == CLFFT_REAL) - { - size_t length0 = fftPlan->length[ DimX ]; - size_t length1 = fftPlan->length[ DimY ]; - size_t length2 = fftPlan->length[ DimZ ]; - - size_t Nt = (1 + length0/2); - - if (fftPlan->tmpBufSize == 0) - { - fftPlan->tmpBufSize = Nt * length1 * length2 * fftPlan->batchsize * fftPlan->ElementSize(); - for (size_t index=3; index < fftPlan->length.size(); index++) - fftPlan->tmpBufSize *= fftPlan->length[index]; - } - - if ((fftPlan->tmpBufSizeC2R==0) && (fftPlan->placeness == CLFFT_OUTOFPLACE)) - { - fftPlan->tmpBufSizeC2R = fftPlan->tmpBufSize; - } - - if( (fftPlan->inStride[0] == 1) && (fftPlan->outStride[0] == 1) && - ( ((fftPlan->outStride[2] == Nt*2*length1) && (fftPlan->oDist == Nt*2*length1*length2) && (fftPlan->placeness == CLFFT_INPLACE)) || - ((fftPlan->outStride[2] == length0*length1) && (fftPlan->oDist == length0*length1*length2) && (fftPlan->placeness == CLFFT_OUTOFPLACE)) ) - && (fftPlan->inStride[2] == Nt*length1) && (fftPlan->iDist == Nt*length1*length2)) - { - // create first transpose plan - - //Transpose - // input --> tmp - size_t transLengths[2] = { length0*length1, length2 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTZ, fftPlan->context, CLFFT_2D, transLengths ), - _T( "CreateDefaultPlan for planTZ transpose failed" ) ); - - FFTPlan* trans1Plan = NULL; - lockRAII* trans1Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTZ, trans1Plan, trans1Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans1Plan->transflag = true; - - transLengths[0] = Nt*length1; - OPENCL_V(clfftSetPlanLength( fftPlan->planTZ, CLFFT_2D, transLengths ), - _T( "clfftSetPlanLength for planTZ transpose failed" ) ); - - switch(fftPlan->inputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - trans1Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans1Plan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - trans1Plan->placeness = CLFFT_OUTOFPLACE; - trans1Plan->precision = fftPlan->precision; - trans1Plan->tmpBufSize = 0; - trans1Plan->batchsize = fftPlan->batchsize; - trans1Plan->envelope = fftPlan->envelope; - trans1Plan->forwardScale = 1.0f; - trans1Plan->backwardScale = 1.0f; - - trans1Plan->inStride[0] = 1; - trans1Plan->inStride[1] = Nt*length1; - trans1Plan->outStride[0] = 1; - trans1Plan->outStride[1] = length2; - trans1Plan->iDist = fftPlan->iDist; - trans1Plan->oDist = Nt*length1*length2; - trans1Plan->transOutHorizontal = true; - - trans1Plan->gen = Transpose_GCN; - - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - trans1Plan->length.push_back(fftPlan->length[index]); - trans1Plan->inStride.push_back(fftPlan->inStride[index]); - trans1Plan->outStride.push_back(trans1Plan->oDist); - trans1Plan->oDist *= fftPlan->length[index]; - } - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - trans1Plan->hasPreCallback = true; - trans1Plan->preCallback = fftPlan->preCallback; - trans1Plan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planTZ, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTZ failed" ) ); - - // create col plan - // complex to complex - - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planZ, fftPlan->context, CLFFT_1D, &fftPlan->length[ DimZ ] ), - _T( "CreateDefaultPlan for planZ failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planZ, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - colPlan->length.push_back(Nt*length1); - - colPlan->inStride[0] = 1; - colPlan->inStride.push_back(length2); - colPlan->iDist = trans1Plan->oDist; - - colPlan->placeness = CLFFT_INPLACE; - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - - colPlan->outStride[0] = colPlan->inStride[0]; - colPlan->outStride.push_back(colPlan->inStride[1]); - colPlan->oDist = colPlan->iDist; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(trans1Plan->outStride[index-1]); - colPlan->outStride.push_back(trans1Plan->outStride[index-1]); - } - - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = 1.0f; - colPlan->backwardScale = 1.0f; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - OPENCL_V(clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planZ failed" ) ); - - // create second transpose plan - - //Transpose - //tmp --> output - size_t trans2Lengths[2] = { length2, length0*length1 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planTX, fftPlan->context, CLFFT_2D, trans2Lengths ), - _T( "CreateDefaultPlan for planTX transpose failed" ) ); - - FFTPlan* trans2Plan = NULL; - lockRAII* trans2Lock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planTX, trans2Plan, trans2Lock ), _T( "fftRepo.getPlan failed" ) ); - - trans2Plan->transflag = true; - - trans2Lengths[1] = Nt*length1; - OPENCL_V(clfftSetPlanLength( fftPlan->planTX, CLFFT_2D, trans2Lengths ), - _T( "clfftSetPlanLength for planTX transpose failed" ) ); - - - trans2Plan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - trans2Plan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - - - trans2Plan->placeness = CLFFT_OUTOFPLACE; - trans2Plan->precision = fftPlan->precision; - trans2Plan->tmpBufSize = 0; - trans2Plan->batchsize = fftPlan->batchsize; - trans2Plan->envelope = fftPlan->envelope; - trans2Plan->forwardScale = 1.0f; - trans2Plan->backwardScale = 1.0f; + // Record that we baked the plan + fftPlan->baked = true; - trans2Plan->inStride[0] = 1; - trans2Plan->inStride[1] = length2; - trans2Plan->outStride[0] = 1; - trans2Plan->outStride[1] = Nt*length1; - trans2Plan->iDist = colPlan->oDist; - trans2Plan->oDist = Nt*length1*length2; - - trans2Plan->gen = Transpose_GCN; - trans2Plan->transflag = true; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - trans2Plan->length.push_back(fftPlan->length[index]); - trans2Plan->inStride.push_back(colPlan->outStride[index-1]); - trans2Plan->outStride.push_back(trans2Plan->oDist); - trans2Plan->oDist *= fftPlan->length[index]; - - } - - OPENCL_V(clfftBakePlan(fftPlan->planTX, numQueues, commQueueFFT, NULL, NULL ), - _T( "BakePlan for planTX failed" ) ); - - // create row plan - // hermitian to real - - //create 2D xy plan - size_t clLengths[] = { length0, length1, 0 }; - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan for 2D planX failed" ) ); - - FFTPlan* rowPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, rowPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - rowPlan->outputLayout = fftPlan->outputLayout; - rowPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; - - rowPlan->length.push_back(length2); - - rowPlan->outStride[0] = fftPlan->outStride[0]; - rowPlan->outStride[1] = fftPlan->outStride[1]; - rowPlan->outStride.push_back(fftPlan->outStride[2]); - rowPlan->oDist = fftPlan->oDist; - - rowPlan->inStride[0] = trans2Plan->outStride[0]; - rowPlan->inStride[1] = Nt; - rowPlan->inStride.push_back(Nt*length1); - rowPlan->iDist = trans2Plan->oDist; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - rowPlan->length.push_back(fftPlan->length[index]); - rowPlan->inStride.push_back(trans2Plan->outStride[index-1]); - rowPlan->outStride.push_back(fftPlan->outStride[index]); - } - - if (fftPlan->placeness == CLFFT_INPLACE) - { - rowPlan->placeness = CLFFT_INPLACE; - } - else - { - rowPlan->placeness = CLFFT_OUTOFPLACE; - } - - - rowPlan->precision = fftPlan->precision; - rowPlan->forwardScale = fftPlan->forwardScale; - rowPlan->backwardScale = fftPlan->backwardScale; - rowPlan->tmpBufSize = 0; - - rowPlan->gen = fftPlan->gen; - rowPlan->envelope = fftPlan->envelope; - - rowPlan->batchsize = fftPlan->batchsize; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - rowPlan->hasPostCallback = true; - rowPlan->postCallbackParam = fftPlan->postCallbackParam; - rowPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan for planX failed" ) ); - } - else - { - - size_t clLengths[] = { 1, 0, 0 }; - - clLengths[0] = fftPlan->length[ DimZ ]; - - //create 1D col plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planZ, fftPlan->context, CLFFT_1D, clLengths ), - _T( "CreateDefaultPlan for planZ failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planZ, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - switch(fftPlan->inputLayout) - { - case CLFFT_HERMITIAN_INTERLEAVED: - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inputLayout = CLFFT_COMPLEX_INTERLEAVED; - } - break; - case CLFFT_HERMITIAN_PLANAR: - { - colPlan->outputLayout = CLFFT_COMPLEX_INTERLEAVED; - colPlan->inputLayout = CLFFT_COMPLEX_PLANAR; - } - break; - default: assert(false); - } - - colPlan->length.push_back(Nt); - colPlan->length.push_back(length1); - - colPlan->inStride[0] = fftPlan->inStride[2]; - colPlan->inStride.push_back(fftPlan->inStride[0]); - colPlan->inStride.push_back(fftPlan->inStride[1]); - colPlan->iDist = fftPlan->iDist; - - - if (fftPlan->placeness == CLFFT_INPLACE) - { - colPlan->placeness = CLFFT_INPLACE; - - colPlan->outStride[0] = colPlan->inStride[0]; - colPlan->outStride.push_back(colPlan->inStride[1]); - colPlan->outStride.push_back(colPlan->inStride[2]); - colPlan->oDist = colPlan->iDist; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(fftPlan->inStride[index]); - colPlan->outStride.push_back(fftPlan->inStride[index]); - } - } - else - { - colPlan->placeness = CLFFT_OUTOFPLACE; - - colPlan->outStride[0] = Nt*length1; - colPlan->outStride.push_back(1); - colPlan->outStride.push_back(Nt); - colPlan->oDist = Nt*length1*length2; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - colPlan->length.push_back(fftPlan->length[index]); - colPlan->inStride.push_back(fftPlan->inStride[index]); - colPlan->outStride.push_back(colPlan->oDist); - colPlan->oDist *= fftPlan->length[index]; - } - } - - - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = 1.0f; - colPlan->backwardScale = 1.0f; - colPlan->tmpBufSize = 0; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - colPlan->batchsize = fftPlan->batchsize; - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - colPlan->hasPreCallback = true; - colPlan->preCallback = fftPlan->preCallback; - colPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan 3D->1D planZ failed" ) ); - - - clLengths[0] = fftPlan->length[ DimX ]; - clLengths[1] = fftPlan->length[ DimY ]; - - //create 2D xy plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan 2D planX failed" ) ); - - FFTPlan* xyPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, xyPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - xyPlan->inputLayout = CLFFT_HERMITIAN_INTERLEAVED; - xyPlan->outputLayout = fftPlan->outputLayout; - - xyPlan->length.push_back(length2); - - xyPlan->outStride[0] = fftPlan->outStride[0]; - xyPlan->outStride[1] = fftPlan->outStride[1]; - xyPlan->outStride.push_back(fftPlan->outStride[2]); - xyPlan->oDist = fftPlan->oDist; - - if (fftPlan->placeness == CLFFT_INPLACE) - { - xyPlan->placeness = CLFFT_INPLACE; - - xyPlan->inStride[0] = colPlan->outStride[1]; - xyPlan->inStride[1] = colPlan->outStride[2]; - xyPlan->inStride.push_back(colPlan->outStride[0]); - xyPlan->iDist = colPlan->oDist; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - xyPlan->length.push_back(fftPlan->length[index]); - xyPlan->inStride.push_back(colPlan->outStride[index]); - xyPlan->outStride.push_back(fftPlan->outStride[index]); - } - } - else - { - xyPlan->placeness = CLFFT_OUTOFPLACE; - - xyPlan->inStride[0] = 1; - xyPlan->inStride[1] = Nt; - xyPlan->inStride.push_back(Nt*length1); - xyPlan->iDist = Nt*length1*length2; - - for (size_t index=3; index < fftPlan->length.size(); index++) - { - xyPlan->length.push_back(fftPlan->length[index]); - xyPlan->outStride.push_back(fftPlan->outStride[index]); - xyPlan->inStride.push_back(xyPlan->iDist); - xyPlan->iDist *= fftPlan->length[index]; - } - } - - - xyPlan->precision = fftPlan->precision; - xyPlan->forwardScale = fftPlan->forwardScale; - xyPlan->backwardScale = fftPlan->backwardScale; - xyPlan->tmpBufSize = fftPlan->tmpBufSize; - - xyPlan->gen = fftPlan->gen; - xyPlan->envelope = fftPlan->envelope; - - xyPlan->batchsize = fftPlan->batchsize; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - xyPlan->hasPostCallback = true; - xyPlan->postCallbackParam = fftPlan->postCallbackParam; - xyPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan 3D->2D planX failed" ) ); - } - } - else - { - if (fftPlan->tmpBufSize==0 && ( - fftPlan->length[0] > Large1DThreshold || - fftPlan->length[1] > Large1DThreshold || - fftPlan->length[2] > Large1DThreshold - )) - { - fftPlan->tmpBufSize = fftPlan->length[0] * fftPlan->length[1] * fftPlan->length[2] * - fftPlan->batchsize * fftPlan->ElementSize(); - } - - size_t clLengths[] = { 1, 1, 0 }; - clLengths[0] = fftPlan->length[ DimX ]; - clLengths[1] = fftPlan->length[ DimY ]; - - //create 2D xy plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planX, fftPlan->context, CLFFT_2D, clLengths ), - _T( "CreateDefaultPlan 2D planX failed" ) ); - - FFTPlan* xyPlan = NULL; - lockRAII* rowLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planX, xyPlan, rowLock ), _T( "fftRepo.getPlan failed" ) ); - - xyPlan->inputLayout = fftPlan->inputLayout; - xyPlan->outputLayout = fftPlan->outputLayout; - xyPlan->placeness = fftPlan->placeness; - xyPlan->precision = fftPlan->precision; - xyPlan->forwardScale = 1.0f; - xyPlan->backwardScale = 1.0f; - xyPlan->tmpBufSize = fftPlan->tmpBufSize; - - xyPlan->gen = fftPlan->gen; - xyPlan->envelope = fftPlan->envelope; - - // This is the xy fft, the first elements distance between the first two FFTs is the distance of the first elements - // of the first two rows in the original buffer. - xyPlan->batchsize = fftPlan->batchsize; - xyPlan->inStride[0] = fftPlan->inStride[0]; - xyPlan->inStride[1] = fftPlan->inStride[1]; - xyPlan->outStride[0] = fftPlan->outStride[0]; - xyPlan->outStride[1] = fftPlan->outStride[1]; - - //pass length and other info to kernel, so the kernel knows this is decomposed from higher dimension - xyPlan->length.push_back(fftPlan->length[2]); - xyPlan->inStride.push_back(fftPlan->inStride[2]); - xyPlan->outStride.push_back(fftPlan->outStride[2]); - xyPlan->iDist = fftPlan->iDist; - xyPlan->oDist = fftPlan->oDist; - - //Set callback data if set on top level plan - if (fftPlan->hasPreCallback) - { - xyPlan->hasPreCallback = true; - xyPlan->preCallback = fftPlan->preCallback; - xyPlan->precallUserData = fftPlan->precallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planX, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan 3D->2D planX failed" ) ); - - clLengths[0] = fftPlan->length[ DimZ ]; - clLengths[1] = clLengths[2] = 0; - //create 1D col plan - OPENCL_V(clfftCreateDefaultPlanInternal( &fftPlan->planZ, fftPlan->context, CLFFT_1D, clLengths ), - _T( "CreateDefaultPlan for planZ failed" ) ); - - FFTPlan* colPlan = NULL; - lockRAII* colLock = NULL; - OPENCL_V( fftRepo.getPlan( fftPlan->planZ, colPlan, colLock ), _T( "fftRepo.getPlan failed" ) ); - - colPlan->inputLayout = fftPlan->outputLayout; - colPlan->outputLayout = fftPlan->outputLayout; - colPlan->placeness = CLFFT_INPLACE; - colPlan->precision = fftPlan->precision; - colPlan->forwardScale = fftPlan->forwardScale; - colPlan->backwardScale = fftPlan->backwardScale; - colPlan->tmpBufSize = fftPlan->tmpBufSize; - - colPlan->gen = fftPlan->gen; - colPlan->envelope = fftPlan->envelope; - - // This is a column FFT, the first elements distance between each FFT is the distance of the first two - // elements in the original buffer. Like a transpose of the matrix - colPlan->batchsize = fftPlan->batchsize; - colPlan->inStride[0] = fftPlan->outStride[2]; - colPlan->outStride[0] = fftPlan->outStride[2]; - - //pass length and other info to kernel, so the kernel knows this is decomposed from higher dimension - colPlan->length.push_back(fftPlan->length[0]); - colPlan->length.push_back(fftPlan->length[1]); - colPlan->inStride.push_back(fftPlan->outStride[0]); - colPlan->inStride.push_back(fftPlan->outStride[1]); - colPlan->outStride.push_back(fftPlan->outStride[0]); - colPlan->outStride.push_back(fftPlan->outStride[1]); - colPlan->iDist = fftPlan->oDist; - colPlan->oDist = fftPlan->oDist; - - //Set callback data if set on top level plan - if (fftPlan->hasPostCallback) - { - colPlan->hasPostCallback = true; - colPlan->postCallbackParam = fftPlan->postCallbackParam; - colPlan->postcallUserData = fftPlan->postcallUserData; - } - - OPENCL_V(clfftBakePlan(fftPlan->planZ, numQueues, commQueueFFT, NULL, NULL ), _T( "BakePlan 3D->1D planZ failed" ) ); - } - - fftPlan->baked = true; - return CLFFT_SUCCESS; - } - } - - - clfftStatus err = selectAction(fftPlan, fftPlan->action, commQueueFFT); - - // Allocate resources - OPENCL_V( fftPlan->AllocateBuffers (), _T("AllocateBuffers() failed")); - - fftPlan->ConstructAndEnqueueConstantBuffers( commQueueFFT ); - - // Record that we baked the plan - fftPlan->baked = true; - - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus clfftCopyPlan( clfftPlanHandle* out_plHandle, cl_context new_context, clfftPlanHandle in_plHandle ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* in_fftPlan = NULL, *out_fftPlan = NULL; - lockRAII* in_planLock = NULL, *out_planLock = NULL; - - OPENCL_V( fftRepo.getPlan( in_plHandle, in_fftPlan, in_planLock ), _T( "fftRepo.getPlan failed" ) ); - - OPENCL_V( clfftCreateDefaultPlan( out_plHandle, new_context, in_fftPlan->dim, &in_fftPlan->length[ 0 ] ), - _T( "clfftCreateDefaultPlan failed" ) ); - - OPENCL_V( fftRepo.getPlan( *out_plHandle, out_fftPlan, out_planLock ), _T( "fftRepo.getPlan failed" ) ); - - // Let other operations complete before attempting to copy the plan - scopedLock sLock( *in_planLock, _T( "clfftCopyPlan" ) ); - - out_fftPlan->baked = false; - out_fftPlan->gen = in_fftPlan->gen; - out_fftPlan->envelope = in_fftPlan->envelope; - out_fftPlan->dim = in_fftPlan->dim; - out_fftPlan->inputLayout = in_fftPlan->inputLayout; - out_fftPlan->outputLayout = in_fftPlan->outputLayout; - out_fftPlan->placeness = in_fftPlan->placeness; - out_fftPlan->precision = in_fftPlan->precision; - out_fftPlan->forwardScale = in_fftPlan->forwardScale; - out_fftPlan->backwardScale = in_fftPlan->backwardScale; - out_fftPlan->iDist = in_fftPlan->iDist; - out_fftPlan->oDist = in_fftPlan->oDist; - out_fftPlan->length = in_fftPlan->length; - out_fftPlan->inStride = in_fftPlan->inStride; - out_fftPlan->outStride = in_fftPlan->outStride; - out_fftPlan->batchsize = in_fftPlan->batchsize; - out_fftPlan->transposed = in_fftPlan->transposed; - - return CLFFT_SUCCESS; +clfftStatus clfftCopyPlan(clfftPlanHandle *out_plHandle, cl_context new_context, + clfftPlanHandle in_plHandle) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *in_fftPlan = nullptr, *out_fftPlan = nullptr; + lockRAII *in_planLock = nullptr, *out_planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(in_plHandle, in_fftPlan, in_planLock), + _T( "fftRepo.getPlan failed" )); + + OPENCL_V(clfftCreateDefaultPlan(out_plHandle, new_context, in_fftPlan->dim, + &in_fftPlan->length[0]), + _T( "clfftCreateDefaultPlan failed" )); + + OPENCL_V(fftRepo.getPlan(*out_plHandle, out_fftPlan, out_planLock), + _T( "fftRepo.getPlan failed" )); + + // Let other operations complete before attempting to copy the plan + scopedLock sLock(*in_planLock, _T( "clfftCopyPlan" )); + + out_fftPlan->baked = false; + out_fftPlan->gen = in_fftPlan->gen; + out_fftPlan->envelope = in_fftPlan->envelope; + out_fftPlan->dim = in_fftPlan->dim; + out_fftPlan->inputLayout = in_fftPlan->inputLayout; + out_fftPlan->outputLayout = in_fftPlan->outputLayout; + out_fftPlan->placeness = in_fftPlan->placeness; + out_fftPlan->precision = in_fftPlan->precision; + out_fftPlan->forwardScale = in_fftPlan->forwardScale; + out_fftPlan->backwardScale = in_fftPlan->backwardScale; + out_fftPlan->iDist = in_fftPlan->iDist; + out_fftPlan->oDist = in_fftPlan->oDist; + out_fftPlan->length = in_fftPlan->length; + out_fftPlan->inStride = in_fftPlan->inStride; + out_fftPlan->outStride = in_fftPlan->outStride; + out_fftPlan->batchsize = in_fftPlan->batchsize; + out_fftPlan->transposed = in_fftPlan->transposed; + + return CLFFT_SUCCESS; } -clfftStatus FFTPlan::ConstructAndEnqueueConstantBuffers( cl_command_queue* commQueueFFT ) -{ - // Construct the constant buffer and call clEnqueueWriteBuffer - // - cb_t ConstantBufferParams [CLFFT_CB_SIZE]; - memset (& ConstantBufferParams, 0, sizeof (ConstantBufferParams)); +clfftStatus +FFTPlan::ConstructAndEnqueueConstantBuffers(cl_command_queue *commQueueFFT) { + // Construct the constant buffer and call clEnqueueWriteBuffer + // + cb_t ConstantBufferParams[CLFFT_CB_SIZE]; + memset(&ConstantBufferParams, 0, sizeof(ConstantBufferParams)); - ConstantBufferParams[0].u = std::max (1, cl_uint (/*fftPlan->*/batchsize)); + ConstantBufferParams[0].u = + std::max(1, cl_uint(/*fftPlan->*/ batchsize)); + OPENCL_V(clEnqueueWriteBuffer(*commQueueFFT, + /*fftPlan->*/ const_buffer, + 1, // TODO? non-blocking write? + 0, sizeof(ConstantBufferParams), + &ConstantBufferParams, 0, nullptr, nullptr), + _T("clEnqueueWriteBuffer failed")); - OPENCL_V(clEnqueueWriteBuffer( *commQueueFFT, - /*fftPlan->*/const_buffer, - 1, // TODO? non-blocking write? - 0, - sizeof(ConstantBufferParams), - &ConstantBufferParams, - 0, - NULL, - NULL), _T("clEnqueueWriteBuffer failed") ); - - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } - -clfftStatus clfftDestroyPlan( clfftPlanHandle* plHandle ) -{ - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - OPENCL_V( fftRepo.getPlan( *plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - - // Recursively destroy subplans, that are used for higher dimensional FFT's - if( fftPlan->planX ) - clfftDestroyPlan( &fftPlan->planX ); - if( fftPlan->planY ) - clfftDestroyPlan( &fftPlan->planY ); - if( fftPlan->planZ ) - clfftDestroyPlan( &fftPlan->planZ ); - if( fftPlan->planTX ) - clfftDestroyPlan( &fftPlan->planTX ); - if( fftPlan->planTY ) - clfftDestroyPlan( &fftPlan->planTY ); - if( fftPlan->planTZ ) - clfftDestroyPlan( &fftPlan->planTZ ); - if( fftPlan->planRCcopy ) - clfftDestroyPlan( &fftPlan->planRCcopy ); - if( fftPlan->planCopy ) - clfftDestroyPlan( &fftPlan->planCopy ); - - fftRepo.deletePlan( plHandle ); - - return CLFFT_SUCCESS; +clfftStatus clfftDestroyPlan(clfftPlanHandle *plHandle) { + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + OPENCL_V(fftRepo.getPlan(*plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + + // Recursively destroy subplans, that are used for higher dimensional FFT's + if (fftPlan->planX) + clfftDestroyPlan(&fftPlan->planX); + if (fftPlan->planY) + clfftDestroyPlan(&fftPlan->planY); + if (fftPlan->planZ) + clfftDestroyPlan(&fftPlan->planZ); + if (fftPlan->planTX) + clfftDestroyPlan(&fftPlan->planTX); + if (fftPlan->planTY) + clfftDestroyPlan(&fftPlan->planTY); + if (fftPlan->planTZ) + clfftDestroyPlan(&fftPlan->planTZ); + if (fftPlan->planRCcopy) + clfftDestroyPlan(&fftPlan->planRCcopy); + if (fftPlan->planCopy) + clfftDestroyPlan(&fftPlan->planCopy); + + fftRepo.deletePlan(plHandle); + + return CLFFT_SUCCESS; } // This routine will query the OpenCL context for it's devices @@ -4650,193 +4675,206 @@ clfftStatus clfftDestroyPlan( clfftPlanHandle* plHandle ) // the object's context is set. On 2nd and subsequent calls, // we just return the pointer. // -clfftStatus FFTPlan::SetEnvelope () -{ - - // TODO The caller has already acquired the lock on *this - // However, we shouldn't depend on it. - - if (0 == envelope.limit_LocalMemSize) do { - // First time, query OpenCL for the device info - // - memset (&envelope, 0, sizeof(envelope)); - - // Get the size needed for the device list - // - size_t deviceListSize = 0; - OPENCL_V( ::clGetContextInfo( context, CL_CONTEXT_DEVICES, 0, NULL, &deviceListSize ), - _T("Getting device array size ( ::clGetContextInfo() )" )); - cl_uint n = cl_uint (deviceListSize / sizeof(cl_device_id)); - if (n == 0) break; - - std::vector< cl_device_id > devices( n+1 ); - // Get the device list - // - OPENCL_V( ::clGetContextInfo( context, CL_CONTEXT_DEVICES, deviceListSize, &devices[ 0 ], NULL ), - _T("Getting device array ( ::clGetContextInfo() )") ); - - // Get the # of devices - // - cl_uint cContextDevices = 0; - - size_t deviceVersionSize = 0; - OPENCL_V( ::clGetDeviceInfo( devices[0], CL_DEVICE_VERSION, 0, NULL, &deviceVersionSize ), - _T("Getting CL_DEVICE_VERSION Info string size ( ::clGetDeviceInfo() )" )); - - std::vector< char > szDeviceVersion( deviceVersionSize ); - OPENCL_V( ::clGetDeviceInfo( devices[0], CL_DEVICE_VERSION, deviceVersionSize, &szDeviceVersion[ 0 ], NULL ), - _T("Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )" )); - - char openclstr[11]="OpenCL 1.0"; - - if (!strncmp((const char*)&szDeviceVersion[ 0 ], openclstr, 10)) - { - cContextDevices = 1; - } - else - { - OPENCL_V( ::clGetContextInfo( context, CL_CONTEXT_NUM_DEVICES, sizeof( cContextDevices ), &cContextDevices, NULL ), - _T("Getting number of context devices ( ::clGetContextInfo() )" )); - } - - cContextDevices = std::min (cContextDevices, n); - if (0 == cContextDevices) - break; - - envelope.limit_LocalMemSize = 32768; - envelope.limit_WorkGroupSize = 256; - envelope.limit_Dimensions = countOf (envelope.limit_Size); - for (size_t u = 0; u < countOf (envelope.limit_Size); ++u) { - envelope.limit_Size[u] = 256; - } - - for( cl_uint i = 0; i < cContextDevices; ++i ) - { - cl_device_id devId = devices[i]; - - cl_ulong memsize = 0; - unsigned int maxdim = 0; - size_t temp[countOf (envelope.limit_Size)]; - memset (&temp, 0, sizeof(temp)); - - OPENCL_V( ::clGetDeviceInfo( devId, CL_DEVICE_LOCAL_MEM_SIZE, sizeof( cl_ulong ), &memsize, NULL ), - _T("Getting CL_DEVICE_LOCAL_MEM_SIZE device info ( ::clGetDeviceInfo() )") ); - envelope.limit_LocalMemSize = std::min (envelope.limit_LocalMemSize, memsize); - - OPENCL_V( ::clGetDeviceInfo( devId, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof( unsigned int ), &maxdim, NULL ), - _T("Getting CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS device info ( ::clGetDeviceInfo() )") ); - BUG_CHECK (countOf (envelope.limit_Size) >= maxdim); - envelope.limit_Dimensions = std::min (envelope.limit_Dimensions, maxdim); - - OPENCL_V( ::clGetDeviceInfo( devId, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof( size_t ), &temp[0], NULL ), - _T("Getting CL_DEVICE_MAX_WORK_GROUP_SIZE device info ( ::clGetDeviceInfo() )") ); - envelope.limit_WorkGroupSize = std::min (envelope.limit_WorkGroupSize, temp[0]); - - OPENCL_V( ::clGetDeviceInfo( devId, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof( temp ), &temp[0], NULL ), - _T("Getting CL_DEVICE_MAX_WORK_ITEM_SIZES device info ( ::clGetDeviceInfo() )") ); - for (size_t u = 0; u < envelope.limit_Dimensions; ++u) { - BUG_CHECK (temp[u] > 0) - envelope.limit_Size[u] = std::min (envelope.limit_Size[u], temp[u]); - } - } - - BUG_CHECK (envelope.limit_LocalMemSize >= 1024) - } while (0); - - return CLFFT_SUCCESS; +clfftStatus FFTPlan::SetEnvelope() { + + // TODO The caller has already acquired the lock on *this + // However, we shouldn't depend on it. + + if (0 == envelope.limit_LocalMemSize) + do { + // First time, query OpenCL for the device info + // + memset(&envelope, 0, sizeof(envelope)); + + // Get the size needed for the device list + // + size_t deviceListSize = 0; + OPENCL_V(::clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, nullptr, + &deviceListSize), + _T("Getting device array size ( ::clGetContextInfo() )" )); + auto n = cl_uint(deviceListSize / sizeof(cl_device_id)); + if (n == 0) + break; + + std::vector devices(n + 1); + // Get the device list + // + OPENCL_V(::clGetContextInfo(context, CL_CONTEXT_DEVICES, deviceListSize, + &devices[0], nullptr), + _T("Getting device array ( ::clGetContextInfo() )")); + + // Get the # of devices + // + cl_uint cContextDevices = 0; + + size_t deviceVersionSize = 0; + OPENCL_V( + ::clGetDeviceInfo(devices[0], CL_DEVICE_VERSION, 0, nullptr, + &deviceVersionSize), + _T("Getting CL_DEVICE_VERSION Info string size ( ::clGetDeviceInfo() )" )); + + std::vector szDeviceVersion(deviceVersionSize); + OPENCL_V( + ::clGetDeviceInfo(devices[0], CL_DEVICE_VERSION, deviceVersionSize, + &szDeviceVersion[0], nullptr), + _T("Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )" )); + + char openclstr[11] = "OpenCL 1.0"; + + if (!strncmp((const char *)&szDeviceVersion[0], openclstr, 10)) { + cContextDevices = 1; + } else { + OPENCL_V( + ::clGetContextInfo(context, CL_CONTEXT_NUM_DEVICES, + sizeof(cContextDevices), &cContextDevices, nullptr), + _T("Getting number of context devices ( ::clGetContextInfo() )" )); + } + + cContextDevices = std::min(cContextDevices, n); + if (0 == cContextDevices) + break; + + envelope.limit_LocalMemSize = 32768; + envelope.limit_WorkGroupSize = 256; + envelope.limit_Dimensions = countOf(envelope.limit_Size); + for (unsigned long & u : envelope.limit_Size) { + u = 256; + } + + for (cl_uint i = 0; i < cContextDevices; ++i) { + cl_device_id devId = devices[i]; + + cl_ulong memsize = 0; + unsigned int maxdim = 0; + size_t temp[countOf(envelope.limit_Size)]; + memset(&temp, 0, sizeof(temp)); + + OPENCL_V(::clGetDeviceInfo(devId, CL_DEVICE_LOCAL_MEM_SIZE, + sizeof(cl_ulong), &memsize, nullptr), + _T("Getting CL_DEVICE_LOCAL_MEM_SIZE device info ( ") + _T("::clGetDeviceInfo() )")); + envelope.limit_LocalMemSize = + std::min(envelope.limit_LocalMemSize, memsize); + + OPENCL_V(::clGetDeviceInfo(devId, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, + sizeof(unsigned int), &maxdim, nullptr), + _T("Getting CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS device info ( ") + _T("::clGetDeviceInfo() )")); + BUG_CHECK(countOf(envelope.limit_Size) >= maxdim); + envelope.limit_Dimensions = + std::min(envelope.limit_Dimensions, maxdim); + + OPENCL_V(::clGetDeviceInfo(devId, CL_DEVICE_MAX_WORK_GROUP_SIZE, + sizeof(size_t), &temp[0], nullptr), + _T("Getting CL_DEVICE_MAX_WORK_GROUP_SIZE device info ( ") + _T("::clGetDeviceInfo() )")); + envelope.limit_WorkGroupSize = + std::min(envelope.limit_WorkGroupSize, temp[0]); + + OPENCL_V(::clGetDeviceInfo(devId, CL_DEVICE_MAX_WORK_ITEM_SIZES, + sizeof(temp), &temp[0], nullptr), + _T("Getting CL_DEVICE_MAX_WORK_ITEM_SIZES device info ( ") + _T("::clGetDeviceInfo() )")); + for (size_t u = 0; u < envelope.limit_Dimensions; ++u) { + BUG_CHECK(temp[u] > 0) + envelope.limit_Size[u] = + std::min(envelope.limit_Size[u], temp[u]); + } + } + + BUG_CHECK(envelope.limit_LocalMemSize >= 1024) + } while (false); + + return CLFFT_SUCCESS; } -clfftStatus FFTPlan::AllocateBuffers () -{ - cl_int status = CL_SUCCESS; +clfftStatus FFTPlan::AllocateBuffers() { + cl_int status = CL_SUCCESS; - assert (NULL == const_buffer); - ReleaseBuffers (); + assert(NULL == const_buffer); + ReleaseBuffers(); - assert(4 == sizeof(int)); + assert(4 == sizeof(int)); - do { - const_buffer = clCreateBuffer (context, - CL_MEM_READ_ONLY, - CLFFT_CB_SIZE * sizeof (int), - 0, - &status); - if (CL_SUCCESS != status) - break; - } while (0); + do { + const_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, + CLFFT_CB_SIZE * sizeof(int), nullptr, &status); + if (CL_SUCCESS != status) + break; + } while (false); - return (clfftStatus) status; + return (clfftStatus)status; } -clfftStatus FFTPlan::ReleaseBuffers () -{ - clfftStatus result = CLFFT_SUCCESS; - clfftStatus tmp; - - if( NULL != const_buffer ) - { - tmp = static_cast< clfftStatus >( clReleaseMemObject( const_buffer ) ); - const_buffer = NULL; - if( CLFFT_SUCCESS == result ) - result = tmp; - } - - if( (NULL != intBuffer) && libCreatedIntBuffer ) - { - tmp = static_cast< clfftStatus >( clReleaseMemObject( intBuffer ) ); - intBuffer = NULL; - if( CLFFT_SUCCESS == result ) - result = tmp; - } - - if( NULL != intBufferRC ) - { - tmp = static_cast< clfftStatus >( clReleaseMemObject( intBufferRC ) ); - intBufferRC = NULL; - if( CLFFT_SUCCESS == result ) - result = tmp; - } - - if( NULL != intBufferC2R ) - { - tmp = static_cast< clfftStatus >( clReleaseMemObject( intBufferC2R ) ); - intBufferC2R = NULL; - if( CLFFT_SUCCESS == result ) - result = tmp; - } - - return result; +clfftStatus FFTPlan::ReleaseBuffers() { + clfftStatus result = CLFFT_SUCCESS; + clfftStatus tmp; + + if (nullptr != const_buffer) { + tmp = static_cast(clReleaseMemObject(const_buffer)); + const_buffer = nullptr; + if (CLFFT_SUCCESS == result) + result = tmp; + } + + if ((nullptr != intBuffer) && libCreatedIntBuffer) { + tmp = static_cast(clReleaseMemObject(intBuffer)); + intBuffer = nullptr; + if (CLFFT_SUCCESS == result) + result = tmp; + } + + if (nullptr != intBufferRC) { + tmp = static_cast(clReleaseMemObject(intBufferRC)); + intBufferRC = nullptr; + if (CLFFT_SUCCESS == result) + result = tmp; + } + + if (nullptr != intBufferC2R) { + tmp = static_cast(clReleaseMemObject(intBufferC2R)); + intBufferC2R = nullptr; + if (CLFFT_SUCCESS == result) + result = tmp; + } + + return result; } - - -clfftStatus FFTPlan::GetMax1DLength (size_t *longest ) const -{ - switch(gen) - { - case Stockham: return GetMax1DLengthStockham(longest); - case Transpose_GCN: *longest = 4096; return CLFFT_SUCCESS; - case Transpose_SQUARE: *longest = 4096; return CLFFT_SUCCESS; - case Transpose_NONSQUARE: *longest = 4096; return CLFFT_SUCCESS; - case Copy: *longest = 4096; return CLFFT_SUCCESS; - default: assert(false); return CLFFT_NOTIMPLEMENTED; - } +clfftStatus FFTPlan::GetMax1DLength(size_t *longest) const { + switch (gen) { + case Stockham: + return GetMax1DLengthStockham(longest); + case Transpose_GCN: + *longest = 4096; + return CLFFT_SUCCESS; + case Transpose_SQUARE: + *longest = 4096; + return CLFFT_SUCCESS; + case Transpose_NONSQUARE: + *longest = 4096; + return CLFFT_SUCCESS; + case Copy: + *longest = 4096; + return CLFFT_SUCCESS; + default: + assert(false); + return CLFFT_NOTIMPLEMENTED; + } } -clfftStatus FFTPlan::GetEnvelope (const FFTEnvelope ** ppEnvelope) const -{ - if( &envelope == NULL ) - { - assert( false ); - return CLFFT_NOTIMPLEMENTED; - } +clfftStatus FFTPlan::GetEnvelope(const FFTEnvelope **ppEnvelope) const { + if (&envelope == nullptr) { + assert(false); + return CLFFT_NOTIMPLEMENTED; + } - *ppEnvelope = &envelope; - return CLFFT_SUCCESS; + *ppEnvelope = &envelope; + return CLFFT_SUCCESS; } -size_t FFTPlan::ElementSize() const -{ - return ( ((precision == CLFFT_DOUBLE) || (precision == CLFFT_DOUBLE_FAST)) ? sizeof( std::complex ) : sizeof( std::complex ) ); +size_t FFTPlan::ElementSize() const { + return (((precision == CLFFT_DOUBLE) || (precision == CLFFT_DOUBLE_FAST)) + ? sizeof(std::complex) + : sizeof(std::complex)); } - diff --git a/src/library/plan.h b/src/library/plan.h index f1616096..7de3b0c7 100644 --- a/src/library/plan.h +++ b/src/library/plan.h @@ -14,625 +14,572 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( AMD_CLFFT_plan_H ) +#if !defined(AMD_CLFFT_plan_H) #define AMD_CLFFT_plan_H -#include -#include "private.h" -#include "lock.h" #include "generator.h" +#include "lock.h" +#include "private.h" +#include -std::string getKernelName(const clfftGenerators gen, const clfftPlanHandle plHandle, bool withPlHandle); +std::string getKernelName(const clfftGenerators gen, + const clfftPlanHandle plHandle, bool withPlHandle); namespace ARBITRARY { - // TODO: These arbitrary parameters should be tuned for the type of GPU - // being used. These values are probably OK for Radeon 58xx and 68xx. - enum { - MAX_DIMS = 3, - // The clEnqueuNDRangeKernel accepts a multi-dimensional domain array. - // The # of dimensions is arbitrary, but limited by the OpenCL implementation - // usually to 3 dimensions (CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS). - // The kernel generator also assumes a limit on the # of dimensions. - - SIMD_WIDTH = 64, - // Workgroup size. This is the # of work items that share - // local data storage (LDS). This # is best for Evergreen gpus, - // but might change in the future. - - LDS_BANK_BITS = 5, - LDS_BANK_SIZE = (1 << LDS_BANK_BITS), - LDS_PADDING = false,//true, - // On AMD hardware, the low-order bits of the local_id enumerate - // the work items that access LDS in parallel. Ideally, we will - // pad our LDS arrays so that these work items access different banks - // of the LDS. - // 2 ** LDS_BANK_BITS is the number of LDS banks. - // If LDS_PADDING is non-zero, the kernel generator should pad the - // LDS arrays to reduce or eliminate bank conflicts. - - LDS_FRACTION_IDEAL = 6, // i.e., 1/6th - LDS_FRACTION_MAX = 4, // i.e., 1/4 - // For best performance, each workgroup should use 1/IDEAL'th the amount of LDS - // revealed by clGetDeviceInfo (.. CL_DEVICE_LOCAL_MEM_SIZE, ...) - // However, we can use up to 1/MAX'th of LDS per workgroup when necessary to - // perform the FFT in a single pass instead of multiple passes. - // This tuning parameter is a good value for Evergreen gpus, - // but might change in the future. - - LDS_COMPLEX = false, - // This is the default value for FFTKernelGenKeyParams::fft_LdsComplex. - // The generated kernels require so many bytes of LDS for each single precision - //..complex number in the vector. - // If LDS_COMPLEX, then we declare an LDS array of complex numbers (8 bytes each) - // and swap data between workitems with a single barrier. - // If ! LDS_COMPLEX, then we declare an LDS array or scalar numbers (4 bytes each) - // and swap data between workitems in two phases, with extra barriers. - // The former approach uses fewer instructions and barriers; - // The latter uses half as much LDS space, so twice as many wavefronts can be run - // in parallel. - - TWIDDLE_DEE = 8, - // number of bits per row of matrix. - }; - +// TODO: These arbitrary parameters should be tuned for the type of GPU +// being used. These values are probably OK for Radeon 58xx and 68xx. +enum { + MAX_DIMS = 3, + // The clEnqueuNDRangeKernel accepts a multi-dimensional domain array. + // The # of dimensions is arbitrary, but limited by the OpenCL implementation + // usually to 3 dimensions (CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS). + // The kernel generator also assumes a limit on the # of dimensions. + + SIMD_WIDTH = 64, + // Workgroup size. This is the # of work items that share + // local data storage (LDS). This # is best for Evergreen gpus, + // but might change in the future. + + LDS_BANK_BITS = 5, + LDS_BANK_SIZE = (1 << LDS_BANK_BITS), + LDS_PADDING = + false, // true, + // On AMD hardware, the low-order bits of the local_id enumerate + // the work items that access LDS in parallel. Ideally, we will + // pad our LDS arrays so that these work items access different + // banks of the LDS. 2 ** LDS_BANK_BITS is the number of LDS + // banks. If LDS_PADDING is non-zero, the kernel generator should + // pad the LDS arrays to reduce or eliminate bank conflicts. + + LDS_FRACTION_IDEAL = 6, // i.e., 1/6th + LDS_FRACTION_MAX = + 4, // i.e., 1/4 + // For best performance, each workgroup should use 1/IDEAL'th the + // amount of LDS revealed by clGetDeviceInfo (.. + // CL_DEVICE_LOCAL_MEM_SIZE, ...) However, we can use up to 1/MAX'th + // of LDS per workgroup when necessary to perform the FFT in a single + // pass instead of multiple passes. This tuning parameter is a good + // value for Evergreen gpus, but might change in the future. + + LDS_COMPLEX = false, + // This is the default value for FFTKernelGenKeyParams::fft_LdsComplex. + // The generated kernels require so many bytes of LDS for each single + // precision + //..complex number in the vector. + // If LDS_COMPLEX, then we declare an LDS array of complex numbers (8 bytes + // each) and swap data between workitems with a single barrier. If ! + // LDS_COMPLEX, then we declare an LDS array or scalar numbers (4 bytes each) + // and swap data between workitems in two phases, with extra barriers. + // The former approach uses fewer instructions and barriers; + // The latter uses half as much LDS space, so twice as many wavefronts can be + // run in parallel. + + TWIDDLE_DEE = 8, + // number of bits per row of matrix. }; +}; // namespace ARBITRARY -enum BlockComputeType -{ - BCT_C2C, // Column to column - BCT_C2R, // Column to row - BCT_R2C, // Row to column +enum BlockComputeType { + BCT_C2C, // Column to column + BCT_C2R, // Column to row + BCT_R2C, // Row to column }; - -//NonSquareKernelType -enum NonSquareTransposeKernelType -{ - NON_SQUARE_TRANS_PARENT, - NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING, - NON_SQUARE_TRANS_TRANSPOSE_BATCHED, - NON_SQUARE_TRANS_SWAP +// NonSquareKernelType +enum NonSquareTransposeKernelType { + NON_SQUARE_TRANS_PARENT, + NON_SQUARE_TRANS_TRANSPOSE_BATCHED_LEADING, + NON_SQUARE_TRANS_TRANSPOSE_BATCHED, + NON_SQUARE_TRANS_SWAP }; /* -There are three ways of conducting inplace transpose with 1:2 (or 2:1) dimension ratio. -A. first conduct line swapping kernels for the whole non square matrix -then conduct batched square transpose along column dim (a 'real' batched transpose) -B. first conduct batched square transpose along column dim (a 'real' batched transpose) -then conduct line swapping kernels for the whole non square matrix (for 2:1 case) -C. first conduct batched square transpose along leading dim (row dim) -then conduct line swapping kernels for the whole non square matrix -Note that the twiddle computation has to go at the begining of the first kernel or the end of the second kernel - -if leading dimension is bigger, it makes more sense (faster) to swap line first and then conduct batched square transpose -if leading dimension is smaller, it makes more sense (faster) to conduct batched transpose and then swap lines. +There are three ways of conducting inplace transpose with 1:2 (or 2:1) dimension +ratio. A. first conduct line swapping kernels for the whole non square matrix +then conduct batched square transpose along column dim (a 'real' batched +transpose) B. first conduct batched square transpose along column dim (a 'real' +batched transpose) then conduct line swapping kernels for the whole non square +matrix (for 2:1 case) C. first conduct batched square transpose along leading +dim (row dim) then conduct line swapping kernels for the whole non square matrix +Note that the twiddle computation has to go at the begining of the first kernel +or the end of the second kernel + +if leading dimension is bigger, it makes more sense (faster) to swap line first +and then conduct batched square transpose if leading dimension is smaller, it +makes more sense (faster) to conduct batched transpose and then swap lines. */ -enum NON_SQUARE_KERNEL_ORDER -{ - NOT_A_TRANSPOSE, - SWAP_AND_TRANSPOSE, // A. - TRANSPOSE_AND_SWAP, // B. - TRANSPOSE_LEADING_AND_SWAP, // C. +enum NON_SQUARE_KERNEL_ORDER { + NOT_A_TRANSPOSE, + SWAP_AND_TRANSPOSE, // A. + TRANSPOSE_AND_SWAP, // B. + TRANSPOSE_LEADING_AND_SWAP, // C. }; #define CLFFT_CB_SIZE 32 #define CLFFT_MAX_INTERNAL_DIM 16 -/*! @brief Data structure to store the callback function string and other metadata passed by client -* @details Client sets the callback function and other required parameters through clfftSetPlanCallback() -* in order to register the callback function. The library populates these values into this data structure -*/ -typedef struct clfftCallbackParam_ -{ - int localMemSize; /*!< optional local memory size if needed by callback */ - const char* funcname; /*!< callback function name */ - const char* funcstring; /*!< callback function in string form */ -}clfftCallbackParam; +/*! @brief Data structure to store the callback function string and other + * metadata passed by client + * @details Client sets the callback function and other required parameters + * through clfftSetPlanCallback() in order to register the callback function. + * The library populates these values into this data structure + */ +typedef struct clfftCallbackParam_ { + int localMemSize; /*!< optional local memory size if needed by callback */ + const char *funcname; /*!< callback function name */ + const char *funcstring; /*!< callback function in string form */ +} clfftCallbackParam; struct FFTKernelGenKeyParams { - /* - * This structure distills a subset of the fftPlan data, - * including all information that is used to generate the OpenCL kernel. - * This structure can be used as a key to reusing kernels that have already - * been compiled. - */ - size_t fft_DataDim; // Dimensionality of the data - size_t fft_N[CLFFT_MAX_INTERNAL_DIM]; // [0] is FFT size, e.g. 1024 - // This must be <= size of LDS! - size_t fft_inStride [CLFFT_MAX_INTERNAL_DIM]; // input strides - size_t fft_outStride[CLFFT_MAX_INTERNAL_DIM]; // output strides - - clfftResultLocation fft_placeness; - clfftLayout fft_inputLayout; - clfftLayout fft_outputLayout; - clfftPrecision fft_precision; - double fft_fwdScale; - double fft_backScale; - - size_t fft_offsetIn; - size_t fft_offsetOut; - - size_t fft_SIMD; // Assume this SIMD/workgroup size - size_t fft_LDSsize; // Limit the use of LDS to this many bytes. - size_t fft_R; // # of complex values to keep in working registers - // SIMD size * R must be <= size of LDS! - - size_t fft_MaxWorkGroupSize; // Limit for work group size - - bool fft_3StepTwiddle; // This is one pass of the "3-step" algorithm; - // so extra twiddles are applied on output. - bool fft_twiddleFront; // do twiddle scaling at the beginning pass - - bool fft_realSpecial; // this is the flag to control the special case step (4th step) - // in the 5-step real 1D large breakdown - size_t fft_realSpecial_Nr; - - bool fft_RCsimple; - - bool transOutHorizontal; // tiles traverse the output buffer in horizontal direction - - bool blockCompute; - BlockComputeType blockComputeType; - size_t blockSIMD; - size_t blockLDS; - - NonSquareTransposeKernelType nonSquareKernelType; - // sometimes non square matrix are broken down into a number of - // square matrix during inplace transpose - // let's call this number transposeMiniBatchSize - // no user of the library should set its value - size_t transposeMiniBatchSize; - // transposeBatchSize is the number of batchs times transposeMiniBatchSzie - // no user of the library should set its value - size_t transposeBatchSize; - // no user of the library should set its value - NON_SQUARE_KERNEL_ORDER nonSquareKernelOrder; - - bool fft_hasPreCallback; - clfftCallbackParam fft_preCallback; - - bool fft_hasPostCallback; - clfftCallbackParam fft_postCallback; - - cl_ulong limit_LocalMemSize; - - // Default constructor - FFTKernelGenKeyParams() - { - fft_DataDim = 0; - for(int i=0; i -struct FFTKernelSignature : public FFTKernelSignatureHeader, public DATA -{ - FFTKernelSignature() - : FFTKernelSignatureHeader(sizeof(FFTKernelSignature), ID) - { - } +struct FFTKernelSignature : public FFTKernelSignatureHeader, public DATA { + FFTKernelSignature() + : FFTKernelSignatureHeader(sizeof(FFTKernelSignature), ID) {} }; - - -// +// // FFTAction is the base class for all actions used to implement FFT computes -// +// // An action basically implements some OpenCL related actions, for instance: // - Generating a kernel source code from kernel characteristics // - Computing the work-group local sizes according to a kernel // - Enqueuing arguments to the kernel call -// +// // Kernels generated and compiled by an action are stored in the different // cache mechanism (see repo.h for the dynamic cache and fft_binary_lookup.h // for disk cache for more information). Each cache entry can be obtained from // the action signature which is set of byte characterizing the action itself. -// +// // At the moment, FFTAction only implements the enqueue method which is // inherited by every action subclasses. But it may change in the time. There // are no clear rules and the choices made until now are still subject to // change. -// -class FFTAction -{ +// +class FFTAction { public: - FFTAction(FFTPlan * plan, clfftStatus & err); - - virtual clfftStatus enqueue(clfftPlanHandle plHandle, - clfftDirection dir, - cl_uint numQueuesAndEvents, - cl_command_queue* commQueues, - cl_uint numWaitEvents, - const cl_event* waitEvents, - cl_event* outEvents, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers); + FFTAction(FFTPlan *plan, clfftStatus &err); -protected: + virtual clfftStatus enqueue(clfftPlanHandle plHandle, clfftDirection dir, + cl_uint numQueuesAndEvents, + cl_command_queue *commQueues, + cl_uint numWaitEvents, const cl_event *waitEvents, + cl_event *outEvents, cl_mem *clInputBuffers, + cl_mem *clOutputBuffers); - virtual clfftGenerators getGenerator() = 0; +protected: + virtual clfftGenerators getGenerator() = 0; - clfftStatus compileKernels ( const cl_command_queue commQueueFFT, const clfftPlanHandle plHandle, FFTPlan* fftPlan); - clfftStatus writeKernel ( const clfftPlanHandle plHandle, const clfftGenerators gen, const FFTKernelSignatureHeader* data, const cl_context& context, const cl_device_id &device); + clfftStatus compileKernels(const cl_command_queue commQueueFFT, + const clfftPlanHandle plHandle, FFTPlan *fftPlan); + clfftStatus writeKernel(const clfftPlanHandle plHandle, + const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const cl_context &context, + const cl_device_id &device); - virtual clfftStatus generateKernel ( FFTRepo & fftRepo, const cl_command_queue commQueueFFT) = 0; - virtual clfftStatus getWorkSizes ( std::vector & globalws, std::vector & localws) = 0; + virtual clfftStatus generateKernel(FFTRepo &fftRepo, + const cl_command_queue commQueueFFT) = 0; + virtual clfftStatus getWorkSizes(std::vector &globalws, + std::vector &localws) = 0; - virtual const FFTKernelSignatureHeader * getSignatureData() = 0; + virtual const FFTKernelSignatureHeader *getSignatureData() = 0; - FFTPlan * plan; + FFTPlan *plan; private: + clfftStatus selectBufferArguments(FFTPlan *plan, cl_mem *clInputBuffers, + cl_mem *clOutputBuffers, + std::vector &inputBuff, + std::vector &outputBuff); - clfftStatus selectBufferArguments(FFTPlan * plan, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers, - std::vector< cl_mem > &inputBuff, - std::vector< cl_mem > &outputBuff); - - virtual bool buildForwardKernel() = 0; - virtual bool buildBackwardKernel() = 0; + virtual bool buildForwardKernel() = 0; + virtual bool buildBackwardKernel() = 0; }; - // The "envelope" is a set of limits imposed by the hardware // This will depend on the GPU(s) in the OpenCL context. // If there are multiple devices, this should be the least // common denominators. // struct FFTEnvelope { - cl_ulong limit_LocalMemSize; - // this is the minimum of CL_DEVICE_LOCAL_MEM_SIZE - size_t limit_Dimensions; - // this is the minimum of CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS - size_t limit_Size[8]; - // these are the minimima of CL_DEVICE_MAX_WORK_ITEM_SIZES[0..n] - size_t limit_WorkGroupSize; - // this is the minimum of CL_DEVICE_MAX_WORK_GROUP_SIZE - - // ?? CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE - - FFTEnvelope () - : limit_LocalMemSize (0) - , limit_Dimensions (0) - , limit_WorkGroupSize (0) - { - ::memset( &limit_Size, 0, sizeof( limit_Size ) ); - } + cl_ulong limit_LocalMemSize; + // this is the minimum of CL_DEVICE_LOCAL_MEM_SIZE + size_t limit_Dimensions; + // this is the minimum of CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS + size_t limit_Size[8]; + // these are the minimima of CL_DEVICE_MAX_WORK_ITEM_SIZES[0..n] + size_t limit_WorkGroupSize; + // this is the minimum of CL_DEVICE_MAX_WORK_GROUP_SIZE + + // ?? CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE + + FFTEnvelope() + : limit_LocalMemSize(0), limit_Dimensions(0), limit_WorkGroupSize(0) { + ::memset(&limit_Size, 0, sizeof(limit_Size)); + } }; - -// This class contains objects that are specific to a particular FFT transform, and the data herein is useful -// for us to know ahead of transform time such that we can optimize for these settings -class FFTPlan -{ +// This class contains objects that are specific to a particular FFT +//transform, and the data herein is useful for us to know ahead of transform +//time such that we can optimize for these settings +class FFTPlan { public: - - bool baked; - - // Properties provided by the user. - clfftDim dim; - clfftLayout inputLayout; - clfftLayout outputLayout; - clfftResultLocation placeness; - clfftResultTransposed transposed; - clfftPrecision precision; - cl_context context; - double forwardScale, backwardScale; - size_t iDist, oDist; - size_t batchsize; - - size_t offsetIn; - size_t offsetOut; - - // Note the device passed to BakePlan, assuming we are baking for one device - // TODO, change this logic for handling multiple GPUs/devices - cl_device_id bakeDevice; - - // Disabling devices member, plan has 1-on-1 mapping with single device as identified by bakeDevice - // Devices that the user specified in the context passed to the create function - // std::vector< cl_device_id > devices; - - // Length of the FFT in each dimension - std::vector< size_t > length; - - // Stride of the FFT in each dimension - std::vector< size_t > inStride, outStride; - - // Hardware Limits - FFTEnvelope envelope; - - - // Reserved copy for large 1d, 2d, and 3d plan - size_t tmpBufSize; - cl_mem intBuffer; - bool libCreatedIntBuffer; - - // for RC copies - size_t tmpBufSizeRC; - cl_mem intBufferRC; - - // for C-to-R transforms that are OUTOFPLACE - // we need this because the user supplied output buffer is not big enough - // to hold intermediate results for any problem other than normal 1D - size_t tmpBufSizeC2R; - cl_mem intBufferC2R; - - - size_t large1D; - bool large2D; - bool twiddleFront; - - clfftPlanHandle planX; - clfftPlanHandle planY; - clfftPlanHandle planZ; - - bool transflag; - bool transOutHorizontal; - clfftPlanHandle planTX; - clfftPlanHandle planTY; - clfftPlanHandle planTZ; //reserve for 3D transpose - - clfftPlanHandle planRCcopy; - clfftPlanHandle planCopy; - - // Plan resources - // - cl_mem const_buffer; - - // Generator type - clfftGenerators gen; - - - // Real-Complex simple flag - // if this is set we do real to-and-from full complex using simple algorithm - // where imaginary of input is set to zero in forward and imaginary not written in backward - bool RCsimple; - - // Real FFT special flag - // if this is set it means we are doing the 4th step in the 5-step real FFT breakdown algorithm - bool realSpecial; - - size_t realSpecial_Nr; // this value stores the logical column height (N0) of matrix in the 4th step - // length[1] should be 1 + N0/2 - - // User created plan - bool userPlan; - - - // Allocate no extra memory - bool allOpsInplace; - - // flag to indicate transpose placeness in 2D breakdown - bool transpose_in_2d_inplace; - - - // A flag to say that blocked FFTs are going to be performed - // It can only be one of these: column to row, row to column or column to column - // row to row is just the normal case where blocking is not needed - bool blockCompute; - BlockComputeType blockComputeType; - - bool hasPreCallback; - bool hasPostCallback; - - clfftCallbackParam preCallback; - clfftCallbackParam postCallbackParam; - - cl_mem precallUserData; - cl_mem postcallUserData; - - clfftPlanHandle plHandle; - - // The action - FFTAction * action; - - NonSquareTransposeKernelType nonSquareKernelType; - // sometimes non square matrix are broken down into a number of - // square matrix during inplace transpose - // let's call this number transposeMiniBatchSize - // no user of the library should set its value - size_t transposeMiniBatchSize; - NON_SQUARE_KERNEL_ORDER nonSquareKernelOrder; - - FFTPlan () - : baked (false) - , dim (CLFFT_1D) - , inputLayout (CLFFT_COMPLEX_INTERLEAVED) - , outputLayout (CLFFT_COMPLEX_INTERLEAVED) - , placeness (CLFFT_INPLACE) - , transposed (CLFFT_NOTRANSPOSE) - , precision (CLFFT_SINGLE) - , context (NULL) - , forwardScale (1.0) - , backwardScale (1.0) - , iDist( 1 ), oDist( 1 ) - , batchsize (1) - , tmpBufSize (0) - , intBuffer( NULL ) - , libCreatedIntBuffer(false) - , tmpBufSizeRC (0) - , intBufferRC( NULL ) - , tmpBufSizeC2R (0) - , intBufferC2R( NULL ) - , large1D(0) - , large2D(false) - , twiddleFront(false) - , planX( 0 ) - , planY( 0 ) - , planZ( 0 ) - , transflag(false) - , transOutHorizontal(false) - , RCsimple(false) - , realSpecial(false) - , realSpecial_Nr(0) - , userPlan(false) - , allOpsInplace(false) - , transpose_in_2d_inplace(false) - , blockCompute(false) - , blockComputeType(BCT_C2C) - , planTX( 0 ) - , planTY( 0 ) - , planTZ( 0 ) - , planRCcopy(0) - , planCopy(0) - , const_buffer( NULL ) - , gen(Stockham) - , action(0) - , nonSquareKernelType(NON_SQUARE_TRANS_PARENT) - , transposeMiniBatchSize(1) - , nonSquareKernelOrder(NOT_A_TRANSPOSE) - , plHandle(0) - , hasPreCallback(false) - , hasPostCallback(false) - , offsetIn(0) - , offsetOut(0) - { - }; - - size_t ElementSize() const; - - clfftStatus AllocateBuffers (); - clfftStatus ReleaseBuffers (); - - clfftStatus GetMax1DLength (size_t *longest ) const; - - clfftStatus ConstructAndEnqueueConstantBuffers( cl_command_queue* commQueueFFT ); - - clfftStatus GetEnvelope (const FFTEnvelope **) const; - clfftStatus SetEnvelope (); - - clfftStatus GetMax1DLengthStockham (size_t *longest ) const; - - ~FFTPlan () - { - ReleaseBuffers (); - - if (action != NULL) - { - delete action; - action = 0; - } - } + bool baked; + + // Properties provided by the user. + clfftDim dim; + clfftLayout inputLayout; + clfftLayout outputLayout; + clfftResultLocation placeness; + clfftResultTransposed transposed; + clfftPrecision precision; + cl_context context; + double forwardScale, backwardScale; + size_t iDist, oDist; + size_t batchsize; + + size_t offsetIn; + size_t offsetOut; + + // Note the device passed to BakePlan, assuming we are baking for one device + // TODO, change this logic for handling multiple GPUs/devices + cl_device_id bakeDevice; + + // Disabling devices member, plan has 1-on-1 mapping with single device as + // identified by bakeDevice + // Devices that the user specified in the context passed to the create + //function + // std::vector< cl_device_id > devices; + + // Length of the FFT in each dimension + std::vector length; + + // Stride of the FFT in each dimension + std::vector inStride, outStride; + + // Hardware Limits + FFTEnvelope envelope; + + // Reserved copy for large 1d, 2d, and 3d plan + size_t tmpBufSize; + cl_mem intBuffer; + bool libCreatedIntBuffer; + + // for RC copies + size_t tmpBufSizeRC; + cl_mem intBufferRC; + + // for C-to-R transforms that are OUTOFPLACE + // we need this because the user supplied output buffer is not big enough + // to hold intermediate results for any problem other than normal 1D + size_t tmpBufSizeC2R; + cl_mem intBufferC2R; + + size_t large1D; + bool large2D; + bool twiddleFront; + + clfftPlanHandle planX; + clfftPlanHandle planY; + clfftPlanHandle planZ; + + bool transflag; + bool transOutHorizontal; + clfftPlanHandle planTX; + clfftPlanHandle planTY; + clfftPlanHandle planTZ; // reserve for 3D transpose + + clfftPlanHandle planRCcopy; + clfftPlanHandle planCopy; + + // Plan resources + // + cl_mem const_buffer; + + // Generator type + clfftGenerators gen; + + // Real-Complex simple flag + // if this is set we do real to-and-from full complex using simple algorithm + // where imaginary of input is set to zero in forward and imaginary not + // written in backward + bool RCsimple; + + // Real FFT special flag + // if this is set it means we are doing the 4th step in the 5-step real FFT + // breakdown algorithm + bool realSpecial; + + size_t realSpecial_Nr; // this value stores the logical column height (N0) of + // matrix in the 4th step length[1] should be 1 + N0/2 + + // User created plan + bool userPlan; + + // Allocate no extra memory + bool allOpsInplace; + + // flag to indicate transpose placeness in 2D breakdown + bool transpose_in_2d_inplace; + + // A flag to say that blocked FFTs are going to be performed + // It can only be one of these: column to row, row to column or column to + // column row to row is just the normal case where blocking is not needed + bool blockCompute; + BlockComputeType blockComputeType; + + bool hasPreCallback; + bool hasPostCallback; + + clfftCallbackParam preCallback; + clfftCallbackParam postCallbackParam; + + cl_mem precallUserData; + cl_mem postcallUserData; + + clfftPlanHandle plHandle; + + // The action + FFTAction *action; + + NonSquareTransposeKernelType nonSquareKernelType; + // sometimes non square matrix are broken down into a number of + // square matrix during inplace transpose + // let's call this number transposeMiniBatchSize + // no user of the library should set its value + size_t transposeMiniBatchSize; + NON_SQUARE_KERNEL_ORDER nonSquareKernelOrder; + + FFTPlan() + : baked(false), dim(CLFFT_1D), inputLayout(CLFFT_COMPLEX_INTERLEAVED), + outputLayout(CLFFT_COMPLEX_INTERLEAVED), placeness(CLFFT_INPLACE), + transposed(CLFFT_NOTRANSPOSE), precision(CLFFT_SINGLE), context(nullptr), + forwardScale(1.0), backwardScale(1.0), iDist(1), oDist(1), batchsize(1), + tmpBufSize(0), intBuffer(nullptr), libCreatedIntBuffer(false), + tmpBufSizeRC(0), intBufferRC(nullptr), tmpBufSizeC2R(0), + intBufferC2R(nullptr), large1D(0), large2D(false), twiddleFront(false), + planX(0), planY(0), planZ(0), transflag(false), + transOutHorizontal(false), RCsimple(false), realSpecial(false), + realSpecial_Nr(0), userPlan(false), allOpsInplace(false), + transpose_in_2d_inplace(false), blockCompute(false), + blockComputeType(BCT_C2C), planTX(0), planTY(0), planTZ(0), + planRCcopy(0), planCopy(0), const_buffer(nullptr), gen(Stockham), + action(nullptr), nonSquareKernelType(NON_SQUARE_TRANS_PARENT), + transposeMiniBatchSize(1), nonSquareKernelOrder(NOT_A_TRANSPOSE), + plHandle(0), hasPreCallback(false), hasPostCallback(false), offsetIn(0), + offsetOut(0){}; + + size_t ElementSize() const; + + clfftStatus AllocateBuffers(); + clfftStatus ReleaseBuffers(); + + clfftStatus GetMax1DLength(size_t *longest) const; + + clfftStatus + ConstructAndEnqueueConstantBuffers(cl_command_queue *commQueueFFT); + + clfftStatus GetEnvelope(const FFTEnvelope **) const; + clfftStatus SetEnvelope(); + + clfftStatus GetMax1DLengthStockham(size_t *longest) const; + + ~FFTPlan() { + ReleaseBuffers(); + + if (action != nullptr) { + delete action; + action = nullptr; + } + } }; -static bool Is1DPossible(size_t length, size_t large1DThreshold) -{ - if (length > large1DThreshold) - return false; +static bool Is1DPossible(size_t length, size_t large1DThreshold) { + if (length > large1DThreshold) + return false; + + if ((length % 7 == 0) && (length % 5 == 0) && (length % 3 == 0)) + return false; - if ( (length%7 == 0) && (length%5 == 0) && (length%3 == 0) ) - return false; + // radix 11 & 2 is ok, anything else we cannot do in 1 kernel + if ((length % 11 == 0) && ((length % 13 == 0) || (length % 7 == 0) || + (length % 5 == 0) || (length % 3 == 0))) + return false; - // radix 11 & 2 is ok, anything else we cannot do in 1 kernel - if ( (length % 11 == 0) && ((length % 13 == 0) || (length % 7 == 0) || (length % 5 == 0) || (length % 3 == 0)) ) - return false; - - // radix 13 & 2 is ok, anything else we cannot do in 1 kernel - if ( (length % 13 == 0) && ((length % 11 == 0) || (length % 7 == 0) || (length % 5 == 0) || (length % 3 == 0)) ) - return false; + // radix 13 & 2 is ok, anything else we cannot do in 1 kernel + if ((length % 13 == 0) && ((length % 11 == 0) || (length % 7 == 0) || + (length % 5 == 0) || (length % 3 == 0))) + return false; - return true; + return true; } #endif // AMD_CLFFT_plan_H - diff --git a/src/library/private.h b/src/library/private.h index 48f2fa5e..e40ceace 100644 --- a/src/library/private.h +++ b/src/library/private.h @@ -14,81 +14,76 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_private_H ) +#if !defined(CLFFT_private_H) #define CLFFT_private_H -#include -#include -#include +#include "../include/clFFT.h" +#include "../include/unicode.compatibility.h" +#include #include +#include #include #include -#include -#include "../include/clFFT.h" -#include "../include/unicode.compatibility.h" +#include +#include #if defined(_MSC_VER) - // Microsoft Visual C++ compiler - // -#define SPRINTF(_buffer, _count, _format,...) \ - _snprintf_s (_buffer, _count, _TRUNCATE, _format, __VA_ARGS__) -#elif defined( __GNUC__ ) - // Gnu G++ - // -#define SPRINTF(_buffer, _count, _format,...) \ - { size_t len = (_count)-1; \ - snprintf (_buffer, len, _format,__VA_ARGS__); \ - _buffer[len] = 0; \ - } +// Microsoft Visual C++ compiler +// +#define SPRINTF(_buffer, _count, _format, ...) \ + _snprintf_s(_buffer, _count, _TRUNCATE, _format, __VA_ARGS__) +#elif defined(__GNUC__) +// Gnu G++ +// +#define SPRINTF(_buffer, _count, _format, ...) \ + { \ + size_t len = (_count)-1; \ + snprintf(_buffer, len, _format, __VA_ARGS__); \ + _buffer[len] = 0; \ + } #else #error Unknown/unsupported C++ compiler. #endif // Creating a portable defintion of countof // This excludes mingw compilers; mingw32 does not have _countof -#if defined( _MSC_VER ) - #define countOf _countof +#if defined(_MSC_VER) +#define countOf _countof #else - #define countOf( arr ) ( sizeof( arr ) / sizeof( arr[ 0 ] ) ) +#define countOf(arr) (sizeof(arr) / sizeof(arr[0])) #endif // This excludes mingw compilers; mingw32 does not have -#if defined( _MSC_VER ) - #include - - #if defined( _WIN64 ) - inline void BSF( unsigned long* index, size_t& mask ) - { - _BitScanForward64( index, mask ); - } - - inline size_t AtomicAdd( volatile size_t* value, size_t op ) - { - return _InterlockedExchangeAdd64( reinterpret_cast< volatile __int64* >( value ), op ); - } - #else - inline void BSF( unsigned long* index, size_t& mask ) - { - _BitScanForward( index, mask ); - } - - inline size_t AtomicAdd( volatile size_t* value, size_t op ) - { - return _InterlockedExchangeAdd( reinterpret_cast< volatile long* >( value ), op ); - } - #endif -#elif defined( __GNUC__ ) - inline void BSF( unsigned long * index, size_t & mask ) - { - *index = __builtin_ctz( mask ); - } - - inline size_t AtomicAdd( volatile size_t* value, size_t op ) - { - return __sync_fetch_and_add( value, op ); - } +#if defined(_MSC_VER) +#include + +#if defined(_WIN64) +inline void BSF(unsigned long *index, size_t &mask) { + _BitScanForward64(index, mask); +} + +inline size_t AtomicAdd(volatile size_t *value, size_t op) { + return _InterlockedExchangeAdd64(reinterpret_cast(value), + op); +} +#else +inline void BSF(unsigned long *index, size_t &mask) { + _BitScanForward(index, mask); +} + +inline size_t AtomicAdd(volatile size_t *value, size_t op) { + return _InterlockedExchangeAdd(reinterpret_cast(value), op); +} +#endif +#elif defined(__GNUC__) +inline void BSF(unsigned long *index, size_t &mask) { + *index = __builtin_ctz(mask); +} + +inline size_t AtomicAdd(volatile size_t *value, size_t op) { + return __sync_fetch_and_add(value, op); +} #endif void clfftInitRequestLibNoMemAlloc(); @@ -96,276 +91,265 @@ bool clfftGetRequestLibNoMemAlloc(); void clfftInitBinaryCache(); -// This header file is not visible to clients, and contains internal structures and functions for use -// by the FFT library. Since this header is private to this implementation, there is no need to keep -// strict C compliance. - -// Enum to help provide descriptive names to array indices, when indexing into our various vectors -enum clfftDim_Index -{ - DimX, ///< 1 Dimension - DimY, ///< 2 Dimension - DimZ, ///< 3 Dimension - DimW, ///< 4th Dimension - ENDDIMINDEX ///< This value will always be last, and marks the length of clfftDim_Index +// This header file is not visible to clients, and contains internal +//structures and functions for use by the FFT library. Since this header is +//private to this implementation, there is no need to keep strict C compliance. + +// Enum to help provide descriptive names to array indices, when indexing +//into our various vectors +enum clfftDim_Index { + DimX, ///< 1 Dimension + DimY, ///< 2 Dimension + DimZ, ///< 3 Dimension + DimW, ///< 4th Dimension + ENDDIMINDEX ///< This value will always be last, and marks the length of + ///< clfftDim_Index }; -template< typename FileStreamType, typename StringType > -class tofstreamRAII -{ - FileStreamType outFile; - StringType fileName; - - public: - tofstreamRAII( const StringType& name ): fileName( name ) - { - outFile.open( fileName.c_str( ) ); - } - - ~tofstreamRAII( ) - { - outFile.close( ); - } - - StringType& getName( ) - { - return fileName; - } - - void setName( const StringType& name ) - { - fileName = name; - } - - FileStreamType& get( ) - { - return outFile; - } +template class tofstreamRAII { + FileStreamType outFile; + StringType fileName; + +public: + tofstreamRAII(const StringType &name) : fileName(name) { + outFile.open(fileName.c_str()); + } + + ~tofstreamRAII() { outFile.close(); } + + StringType &getName() { return fileName; } + + void setName(const StringType &name) { fileName = name; } + + FileStreamType &get() { return outFile; } }; //(currently) true if length is a power of 2,3,5,7,11,13 -inline bool IsASupportedLength( size_t length ) -{ - while( length > 1 ) - { - if( length % 2 == 0 ) - length /= 2; - else if( length % 3 == 0 ) - length /= 3; - else if( length % 5 == 0 ) - length /= 5; - else if( length % 7 == 0 ) - length /= 7; - else if (length % 11 == 0) - length /= 11; - else if (length % 13 == 0) - length /= 13; - else - return false; - } - return true; +inline bool IsASupportedLength(size_t length) { + while (length > 1) { + if (length % 2 == 0) + length /= 2; + else if (length % 3 == 0) + length /= 3; + else if (length % 5 == 0) + length /= 5; + else if (length % 7 == 0) + length /= 7; + else if (length % 11 == 0) + length /= 11; + else if (length % 13 == 0) + length /= 13; + else + return false; + } + return true; } -inline tstring clfftErrorStatusAsString( const cl_int& status ) -{ - switch( status ) - { - case CLFFT_INVALID_GLOBAL_WORK_SIZE: - return _T( "CLFFT_INVALID_GLOBAL_WORK_SIZE" ); - case CLFFT_INVALID_MIP_LEVEL: - return _T( "CLFFT_INVALID_MIP_LEVEL" ); - case CLFFT_INVALID_BUFFER_SIZE: - return _T( "CLFFT_INVALID_BUFFER_SIZE" ); - case CLFFT_INVALID_GL_OBJECT: - return _T( "CLFFT_INVALID_GL_OBJECT" ); - case CLFFT_INVALID_OPERATION: - return _T( "CLFFT_INVALID_OPERATION" ); - case CLFFT_INVALID_EVENT: - return _T( "CLFFT_INVALID_EVENT" ); - case CLFFT_INVALID_EVENT_WAIT_LIST: - return _T( "CLFFT_INVALID_EVENT_WAIT_LIST" ); - case CLFFT_INVALID_GLOBAL_OFFSET: - return _T( "CLFFT_INVALID_GLOBAL_OFFSET" ); - case CLFFT_INVALID_WORK_ITEM_SIZE: - return _T( "CLFFT_INVALID_WORK_ITEM_SIZE" ); - case CLFFT_INVALID_WORK_GROUP_SIZE: - return _T( "CLFFT_INVALID_WORK_GROUP_SIZE" ); - case CLFFT_INVALID_WORK_DIMENSION: - return _T( "CLFFT_INVALID_WORK_DIMENSION" ); - case CLFFT_INVALID_KERNEL_ARGS: - return _T( "CLFFT_INVALID_KERNEL_ARGS" ); - case CLFFT_INVALID_ARG_SIZE: - return _T( "CLFFT_INVALID_ARG_SIZE" ); - case CLFFT_INVALID_ARG_VALUE: - return _T( "CLFFT_INVALID_ARG_VALUE" ); - case CLFFT_INVALID_ARG_INDEX: - return _T( "CLFFT_INVALID_ARG_INDEX" ); - case CLFFT_INVALID_KERNEL: - return _T( "CLFFT_INVALID_KERNEL" ); - case CLFFT_INVALID_KERNEL_DEFINITION: - return _T( "CLFFT_INVALID_KERNEL_DEFINITION" ); - case CLFFT_INVALID_KERNEL_NAME: - return _T( "CLFFT_INVALID_KERNEL_NAME" ); - case CLFFT_INVALID_PROGRAM_EXECUTABLE: - return _T( "CLFFT_INVALID_PROGRAM_EXECUTABLE" ); - case CLFFT_INVALID_PROGRAM: - return _T( "CLFFT_INVALID_PROGRAM" ); - case CLFFT_INVALID_BUILD_OPTIONS: - return _T( "CLFFT_INVALID_BUILD_OPTIONS" ); - case CLFFT_INVALID_BINARY: - return _T( "CLFFT_INVALID_BINARY" ); - case CLFFT_INVALID_SAMPLER: - return _T( "CLFFT_INVALID_SAMPLER" ); - case CLFFT_INVALID_IMAGE_SIZE: - return _T( "CLFFT_INVALID_IMAGE_SIZE" ); - case CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR: - return _T( "CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR" ); - case CLFFT_INVALID_MEM_OBJECT: - return _T( "CLFFT_INVALID_MEM_OBJECT" ); - case CLFFT_INVALID_HOST_PTR: - return _T( "CLFFT_INVALID_HOST_PTR" ); - case CLFFT_INVALID_COMMAND_QUEUE: - return _T( "CLFFT_INVALID_COMMAND_QUEUE" ); - case CLFFT_INVALID_QUEUE_PROPERTIES: - return _T( "CLFFT_INVALID_QUEUE_PROPERTIES" ); - case CLFFT_INVALID_CONTEXT: - return _T( "CLFFT_INVALID_CONTEXT" ); - case CLFFT_INVALID_DEVICE: - return _T( "CLFFT_INVALID_DEVICE" ); - case CLFFT_INVALID_PLATFORM: - return _T( "CLFFT_INVALID_PLATFORM" ); - case CLFFT_INVALID_DEVICE_TYPE: - return _T( "CLFFT_INVALID_DEVICE_TYPE" ); - case CLFFT_INVALID_VALUE: - return _T( "CLFFT_INVALID_VALUE" ); - case CLFFT_MAP_FAILURE: - return _T( "CLFFT_MAP_FAILURE" ); - case CLFFT_BUILD_PROGRAM_FAILURE: - return _T( "CLFFT_BUILD_PROGRAM_FAILURE" ); - case CLFFT_IMAGE_FORMAT_NOT_SUPPORTED: - return _T( "CLFFT_IMAGE_FORMAT_NOT_SUPPORTED" ); - case CLFFT_IMAGE_FORMAT_MISMATCH: - return _T( "CLFFT_IMAGE_FORMAT_MISMATCH" ); - case CLFFT_MEM_COPY_OVERLAP: - return _T( "CLFFT_MEM_COPY_OVERLAP" ); - case CLFFT_PROFILING_INFO_NOT_AVAILABLE: - return _T( "CLFFT_PROFILING_INFO_NOT_AVAILABLE" ); - case CLFFT_OUT_OF_HOST_MEMORY: - return _T( "CLFFT_OUT_OF_HOST_MEMORY" ); - case CLFFT_OUT_OF_RESOURCES: - return _T( "CLFFT_OUT_OF_RESOURCES" ); - case CLFFT_MEM_OBJECT_ALLOCATION_FAILURE: - return _T( "CLFFT_MEM_OBJECT_ALLOCATION_FAILURE" ); - case CLFFT_COMPILER_NOT_AVAILABLE: - return _T( "CLFFT_COMPILER_NOT_AVAILABLE" ); - case CLFFT_DEVICE_NOT_AVAILABLE: - return _T( "CLFFT_DEVICE_NOT_AVAILABLE" ); - case CLFFT_DEVICE_NOT_FOUND: - return _T( "CLFFT_DEVICE_NOT_FOUND" ); - case CLFFT_SUCCESS: - return _T( "CLFFT_SUCCESS" ); - case CLFFT_NOTIMPLEMENTED: - return _T( "CLFFT_NOTIMPLEMENTED" ); - case CLFFT_FILE_NOT_FOUND: - return _T( "CLFFT_FILE_NOT_FOUND" ); - case CLFFT_FILE_CREATE_FAILURE: - return _T( "CLFFT_FILE_CREATE_FAILURE" ); - case CLFFT_VERSION_MISMATCH: - return _T( "CLFFT_VERSION_MISMATCH" ); - case CLFFT_INVALID_PLAN: - return _T( "CLFFT_INVALID_PLAN" ); - default: - return _T( "Error code not defined" ); - break; - } +inline tstring clfftErrorStatusAsString(const cl_int &status) { + switch (status) { + case CLFFT_INVALID_GLOBAL_WORK_SIZE: + return _T( "CLFFT_INVALID_GLOBAL_WORK_SIZE" ); + case CLFFT_INVALID_MIP_LEVEL: + return _T( "CLFFT_INVALID_MIP_LEVEL" ); + case CLFFT_INVALID_BUFFER_SIZE: + return _T( "CLFFT_INVALID_BUFFER_SIZE" ); + case CLFFT_INVALID_GL_OBJECT: + return _T( "CLFFT_INVALID_GL_OBJECT" ); + case CLFFT_INVALID_OPERATION: + return _T( "CLFFT_INVALID_OPERATION" ); + case CLFFT_INVALID_EVENT: + return _T( "CLFFT_INVALID_EVENT" ); + case CLFFT_INVALID_EVENT_WAIT_LIST: + return _T( "CLFFT_INVALID_EVENT_WAIT_LIST" ); + case CLFFT_INVALID_GLOBAL_OFFSET: + return _T( "CLFFT_INVALID_GLOBAL_OFFSET" ); + case CLFFT_INVALID_WORK_ITEM_SIZE: + return _T( "CLFFT_INVALID_WORK_ITEM_SIZE" ); + case CLFFT_INVALID_WORK_GROUP_SIZE: + return _T( "CLFFT_INVALID_WORK_GROUP_SIZE" ); + case CLFFT_INVALID_WORK_DIMENSION: + return _T( "CLFFT_INVALID_WORK_DIMENSION" ); + case CLFFT_INVALID_KERNEL_ARGS: + return _T( "CLFFT_INVALID_KERNEL_ARGS" ); + case CLFFT_INVALID_ARG_SIZE: + return _T( "CLFFT_INVALID_ARG_SIZE" ); + case CLFFT_INVALID_ARG_VALUE: + return _T( "CLFFT_INVALID_ARG_VALUE" ); + case CLFFT_INVALID_ARG_INDEX: + return _T( "CLFFT_INVALID_ARG_INDEX" ); + case CLFFT_INVALID_KERNEL: + return _T( "CLFFT_INVALID_KERNEL" ); + case CLFFT_INVALID_KERNEL_DEFINITION: + return _T( "CLFFT_INVALID_KERNEL_DEFINITION" ); + case CLFFT_INVALID_KERNEL_NAME: + return _T( "CLFFT_INVALID_KERNEL_NAME" ); + case CLFFT_INVALID_PROGRAM_EXECUTABLE: + return _T( "CLFFT_INVALID_PROGRAM_EXECUTABLE" ); + case CLFFT_INVALID_PROGRAM: + return _T( "CLFFT_INVALID_PROGRAM" ); + case CLFFT_INVALID_BUILD_OPTIONS: + return _T( "CLFFT_INVALID_BUILD_OPTIONS" ); + case CLFFT_INVALID_BINARY: + return _T( "CLFFT_INVALID_BINARY" ); + case CLFFT_INVALID_SAMPLER: + return _T( "CLFFT_INVALID_SAMPLER" ); + case CLFFT_INVALID_IMAGE_SIZE: + return _T( "CLFFT_INVALID_IMAGE_SIZE" ); + case CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR: + return _T( "CLFFT_INVALID_IMAGE_FORMAT_DESCRIPTOR" ); + case CLFFT_INVALID_MEM_OBJECT: + return _T( "CLFFT_INVALID_MEM_OBJECT" ); + case CLFFT_INVALID_HOST_PTR: + return _T( "CLFFT_INVALID_HOST_PTR" ); + case CLFFT_INVALID_COMMAND_QUEUE: + return _T( "CLFFT_INVALID_COMMAND_QUEUE" ); + case CLFFT_INVALID_QUEUE_PROPERTIES: + return _T( "CLFFT_INVALID_QUEUE_PROPERTIES" ); + case CLFFT_INVALID_CONTEXT: + return _T( "CLFFT_INVALID_CONTEXT" ); + case CLFFT_INVALID_DEVICE: + return _T( "CLFFT_INVALID_DEVICE" ); + case CLFFT_INVALID_PLATFORM: + return _T( "CLFFT_INVALID_PLATFORM" ); + case CLFFT_INVALID_DEVICE_TYPE: + return _T( "CLFFT_INVALID_DEVICE_TYPE" ); + case CLFFT_INVALID_VALUE: + return _T( "CLFFT_INVALID_VALUE" ); + case CLFFT_MAP_FAILURE: + return _T( "CLFFT_MAP_FAILURE" ); + case CLFFT_BUILD_PROGRAM_FAILURE: + return _T( "CLFFT_BUILD_PROGRAM_FAILURE" ); + case CLFFT_IMAGE_FORMAT_NOT_SUPPORTED: + return _T( "CLFFT_IMAGE_FORMAT_NOT_SUPPORTED" ); + case CLFFT_IMAGE_FORMAT_MISMATCH: + return _T( "CLFFT_IMAGE_FORMAT_MISMATCH" ); + case CLFFT_MEM_COPY_OVERLAP: + return _T( "CLFFT_MEM_COPY_OVERLAP" ); + case CLFFT_PROFILING_INFO_NOT_AVAILABLE: + return _T( "CLFFT_PROFILING_INFO_NOT_AVAILABLE" ); + case CLFFT_OUT_OF_HOST_MEMORY: + return _T( "CLFFT_OUT_OF_HOST_MEMORY" ); + case CLFFT_OUT_OF_RESOURCES: + return _T( "CLFFT_OUT_OF_RESOURCES" ); + case CLFFT_MEM_OBJECT_ALLOCATION_FAILURE: + return _T( "CLFFT_MEM_OBJECT_ALLOCATION_FAILURE" ); + case CLFFT_COMPILER_NOT_AVAILABLE: + return _T( "CLFFT_COMPILER_NOT_AVAILABLE" ); + case CLFFT_DEVICE_NOT_AVAILABLE: + return _T( "CLFFT_DEVICE_NOT_AVAILABLE" ); + case CLFFT_DEVICE_NOT_FOUND: + return _T( "CLFFT_DEVICE_NOT_FOUND" ); + case CLFFT_SUCCESS: + return _T( "CLFFT_SUCCESS" ); + case CLFFT_NOTIMPLEMENTED: + return _T( "CLFFT_NOTIMPLEMENTED" ); + case CLFFT_FILE_NOT_FOUND: + return _T( "CLFFT_FILE_NOT_FOUND" ); + case CLFFT_FILE_CREATE_FAILURE: + return _T( "CLFFT_FILE_CREATE_FAILURE" ); + case CLFFT_VERSION_MISMATCH: + return _T( "CLFFT_VERSION_MISMATCH" ); + case CLFFT_INVALID_PLAN: + return _T( "CLFFT_INVALID_PLAN" ); + default: + return _T( "Error code not defined" ); + break; + } } -// This is used to either wrap an OpenCL function call, or to explicitly check a variable for an OpenCL error condition. -// If an error occurs, we issue a return statement to exit the calling function. -#if defined( _DEBUG ) - -#define OPENCL_V( fn, msg ) \ -{ \ - clfftStatus vclStatus = static_cast< clfftStatus >( fn ); \ - switch( vclStatus ) \ - { \ - case CL_SUCCESS: /**< No error */ \ - break; \ - default: \ - { \ - terr << _T( "OPENCL_V< " ); \ - terr << clfftErrorStatusAsString( vclStatus ); \ - terr << _T( " > (" )<< static_cast( __LINE__ ) << _T( "): " ); \ - terr << msg << std::endl; \ - return vclStatus; \ - } \ - } \ -} +// This is used to either wrap an OpenCL function call, or to explicitly +//check a variable for an OpenCL error condition. If an error occurs, we issue a +//return statement to exit the calling function. +#if defined(_DEBUG) + +#define OPENCL_V(fn, msg) \ + { \ + clfftStatus vclStatus = static_cast(fn); \ + switch (vclStatus) { \ + case CL_SUCCESS: /**< No error */ \ + break; \ + default: { \ + terr << _T( "OPENCL_V< " ); \ + terr << clfftErrorStatusAsString(vclStatus); \ + terr << _T( " > (" ) << static_cast(__LINE__) << _T( "): " ); \ + terr << msg << std::endl; \ + return vclStatus; \ + } \ + } \ + } #else -#define OPENCL_V( fn, msg ) \ -{ \ - clfftStatus vclStatus = static_cast< clfftStatus >( fn ); \ - switch( vclStatus ) \ - { \ - case CL_SUCCESS: /**< No error */ \ - break; \ - default: \ - { \ - return vclStatus; \ - } \ - } \ -} +#define OPENCL_V(fn, msg) \ + { \ + clfftStatus vclStatus = static_cast(fn); \ + switch (vclStatus) { \ + case CL_SUCCESS: /**< No error */ \ + break; \ + default: { \ + return vclStatus; \ + } \ + } \ + } #endif -static inline bool IsPo2 (size_t u) { - return (u != 0) && (0 == (u & (u-1))); -} +static inline bool IsPo2(size_t u) { return (u != 0) && (0 == (u & (u - 1))); } -template -static inline T DivRoundingUp (T a, T b) { - return (a + (b-1)) / b; +template static inline T DivRoundingUp(T a, T b) { + return (a + (b - 1)) / b; } -static inline size_t BitScanF (size_t n) { - assert (n != 0); - unsigned long tmp = 0; - BSF (& tmp, n); - return (size_t) tmp; +static inline size_t BitScanF(size_t n) { + assert(n != 0); + unsigned long tmp = 0; + BSF(&tmp, n); + return (size_t)tmp; } -#define ARG_CHECK(_proposition) \ -{ bool btmp = (_proposition); assert (btmp); if (! btmp) return CLFFT_INVALID_ARG_VALUE; } - -#define BUG_CHECK(_proposition) \ - { bool btmp = (_proposition); assert (btmp); if (! btmp) return CLFFT_BUGCHECK; } +#define ARG_CHECK(_proposition) \ + { \ + bool btmp = (_proposition); \ + assert(btmp); \ + if (!btmp) \ + return CLFFT_INVALID_ARG_VALUE; \ + } + +#define BUG_CHECK(_proposition) \ + { \ + bool btmp = (_proposition); \ + assert(btmp); \ + if (!btmp) \ + return CLFFT_BUGCHECK; \ + } #ifdef __cplusplus extern "C" { #endif -CLFFTAPI clfftStatus clfftLocalMemSize( const clfftPlanHandle plHandle, cl_ulong* local_mem_size ); +CLFFTAPI clfftStatus clfftLocalMemSize(const clfftPlanHandle plHandle, + cl_ulong *local_mem_size); /*! @brief Save to disk a file containing the contents of a baked plan. -* @details A plan is a repository of state for calculating FFT's. Saves the details for a plan to allow the user -* to easily recreate a plan and execute it without having to first build the kernel. -* @param[in] plHandle Handle to the plan to be written to disk -* @param[in] filename The desired name of the output file for the stored plan -* @return Enum describing error condition; superset of OpenCL error codes -*/ -CLFFTAPI clfftStatus clfftWritePlanToDisk( clfftPlanHandle plHandle, const char* filename ); + * @details A plan is a repository of state for calculating FFT's. Saves the + *details for a plan to allow the user to easily recreate a plan and execute it + *without having to first build the kernel. + * @param[in] plHandle Handle to the plan to be written to disk + * @param[in] filename The desired name of the output file for the stored plan + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftWritePlanToDisk(clfftPlanHandle plHandle, + const char *filename); /*! @brief Read from disk a file containing the contents of a baked plan. -* @details A plan is a repository of state for calculating FFT's. Reads the details for a plan from a file on disk and duplicates -* the plan in the provided plan handle. -* @param[out] plHandle Handle to the plan to be set to details from the file -* @param[in] filename The name of the file containing the stored plan -* @return Enum describing error condition; superset of OpenCL error codes -*/ -CLFFTAPI clfftStatus clfftReadPlanFromDisk( clfftPlanHandle plHandle, const char* filename ); - - + * @details A plan is a repository of state for calculating FFT's. Reads the + *details for a plan from a file on disk and duplicates the plan in the provided + *plan handle. + * @param[out] plHandle Handle to the plan to be set to details from the file + * @param[in] filename The name of the file containing the stored plan + * @return Enum describing error condition; superset of OpenCL error codes + */ +CLFFTAPI clfftStatus clfftReadPlanFromDisk(clfftPlanHandle plHandle, + const char *filename); #ifdef __cplusplus } diff --git a/src/library/repo.cpp b/src/library/repo.cpp index 6778c991..8bf4db30 100644 --- a/src/library/repo.cpp +++ b/src/library/repo.cpp @@ -14,365 +14,382 @@ * limitations under the License. * ************************************************************************/ - // clfft.repo.cpp : Defines the entry point for the console application. // -#include "stdafx.h" #include "repo.h" +#include "stdafx.h" using std::map; using std::string; // Static initialization of the plan count variable -size_t FFTRepo::planCount = 1; - -// Handle/Address of the dynamic module that contains the timer, that we discover and load during runtime -void* FFTRepo::timerHandle = NULL; -GpuStatTimer* FFTRepo::pStatTimer = NULL; - - - - -clfftStatus FFTRepo::releaseResources( ) -{ - scopedLock sLock( lockRepo(), _T( "releaseResources" ) ); - - // Release all handles to Kernels - // - for(Kernel_iterator iKern = mapKernels.begin( ); iKern != mapKernels.end( ); ++iKern ) - { - cl_kernel k = iKern->second.kernel_fwd; - iKern->second.kernel_fwd = NULL; - if (NULL != k) - clReleaseKernel( k ); - k = iKern->second.kernel_back; - iKern->second.kernel_back = NULL; - if (NULL != k) - clReleaseKernel( k ); - - if (NULL != iKern->second.kernel_fwd_lock) - { - delete iKern->second.kernel_fwd_lock; - iKern->second.kernel_fwd_lock = NULL; - } - - if (NULL != iKern->second.kernel_back_lock) - { - delete iKern->second.kernel_back_lock; - iKern->second.kernel_back_lock = NULL; - } - } - mapKernels.clear( ); - - // Release all handles to programs - // - for (fftRepo_iterator iProg = mapFFTs.begin( ); iProg != mapFFTs.end( ); ++iProg ) - { - if (iProg->first.data != NULL) - { - const_cast(&iProg->first)->deleteData(); - } - - cl_program p = iProg->second.clProgram; - iProg->second.clProgram = NULL; - if (NULL != p) - clReleaseProgram (p); - } - - // Free all memory allocated in the repoPlans; represents cached plans that were not destroyed by the client - // - for( repoPlansType::iterator iter = repoPlans.begin( ); iter != repoPlans.end( ); ++iter ) - { - FFTPlan* plan = iter->second.first; - lockRAII* lock = iter->second.second; - if( plan != NULL ) - { - delete plan; - } - if( lock != NULL ) - { - delete lock; - } - } - - // Reset the plan count to zero because we are guaranteed to have destroyed all plans - planCount = 1; - - // Release all strings - mapFFTs.clear( ); - - return CLFFT_SUCCESS; +size_t FFTRepo::planCount = 1; + +// Handle/Address of the dynamic module that contains the timer, that we +//discover and load during runtime +void *FFTRepo::timerHandle = nullptr; +GpuStatTimer *FFTRepo::pStatTimer = nullptr; + +clfftStatus FFTRepo::releaseResources() { + scopedLock sLock(lockRepo(), _T( "releaseResources" )); + + // Release all handles to Kernels + // + for (auto & mapKernel : mapKernels) { + cl_kernel k = mapKernel.second.kernel_fwd; + mapKernel.second.kernel_fwd = nullptr; + if (nullptr != k) + clReleaseKernel(k); + k = mapKernel.second.kernel_back; + mapKernel.second.kernel_back = nullptr; + if (nullptr != k) + clReleaseKernel(k); + + if (nullptr != mapKernel.second.kernel_fwd_lock) { + delete mapKernel.second.kernel_fwd_lock; + mapKernel.second.kernel_fwd_lock = nullptr; + } + + if (nullptr != mapKernel.second.kernel_back_lock) { + delete mapKernel.second.kernel_back_lock; + mapKernel.second.kernel_back_lock = nullptr; + } + } + mapKernels.clear(); + + // Release all handles to programs + // + for (auto & mapFFT : mapFFTs) { + if (mapFFT.first.data != nullptr) { + const_cast(&mapFFT.first)->deleteData(); + } + + cl_program p = mapFFT.second.clProgram; + mapFFT.second.clProgram = nullptr; + if (nullptr != p) + clReleaseProgram(p); + } + + // Free all memory allocated in the repoPlans; represents cached plans that + //were not destroyed by the client + // + for (auto & repoPlan : repoPlans) { + FFTPlan *plan = repoPlan.second.first; + lockRAII *lock = repoPlan.second.second; + if (plan != nullptr) { + delete plan; + } + if (lock != nullptr) { + delete lock; + } + } + + // Reset the plan count to zero because we are guaranteed to have destroyed + //all plans + planCount = 1; + + // Release all strings + mapFFTs.clear(); + + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::setProgramCode( const clfftGenerators gen, const FFTKernelSignatureHeader * data, const std::string& kernel, const cl_device_id &device, const cl_context& planContext ) -{ - scopedLock sLock( lockRepo(), _T( "setProgramCode" ) ); - - FFTRepoKey key(gen, data, planContext, device); - - key.privatizeData(); - - // Prefix copyright statement at the top of generated kernels - std::stringstream ss; - ss << - "/* ************************************************************************\n" - " * Copyright 2013 Advanced Micro Devices, Inc.\n" - " *\n" - " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" - " * you may not use this file except in compliance with the License.\n" - " * You may obtain a copy of the License at\n" - " *\n" - " * http://www.apache.org/licenses/LICENSE-2.0\n" - " *\n" - " * Unless required by applicable law or agreed to in writing, software\n" - " * distributed under the License is distributed on an \"AS IS\" BASIS,\n" - " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" - " * See the License for the specific language governing permissions and\n" - " * limitations under the License.\n" - " * ************************************************************************/" - << std::endl << std::endl; - - std::string prefixCopyright = ss.str(); - - fftRepoType::iterator it = mapFFTs.find(key); - if (it == mapFFTs.end()) - mapFFTs[key].ProgramString = prefixCopyright + kernel; - else - key.deleteData(); - - return CLFFT_SUCCESS; +clfftStatus FFTRepo::setProgramCode(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const std::string &kernel, + const cl_device_id &device, + const cl_context &planContext) { + scopedLock sLock(lockRepo(), _T( "setProgramCode" )); + + FFTRepoKey key(gen, data, planContext, device); + + key.privatizeData(); + + // Prefix copyright statement at the top of generated kernels + std::stringstream ss; + ss << "/* " + "**********************************************************************" + "**\n" + " * Copyright 2013 Advanced Micro Devices, Inc.\n" + " *\n" + " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" + " * you may not use this file except in compliance with the License.\n" + " * You may obtain a copy of the License at\n" + " *\n" + " * http://www.apache.org/licenses/LICENSE-2.0\n" + " *\n" + " * Unless required by applicable law or agreed to in writing, " + "software\n" + " * distributed under the License is distributed on an \"AS IS\" " + "BASIS,\n" + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or " + "implied.\n" + " * See the License for the specific language governing permissions " + "and\n" + " * limitations under the License.\n" + " * " + "**********************************************************************" + "**/" + << std::endl + << std::endl; + + std::string prefixCopyright = ss.str(); + + auto it = mapFFTs.find(key); + if (it == mapFFTs.end()) + mapFFTs[key].ProgramString = prefixCopyright + kernel; + else + key.deleteData(); + + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::getProgramCode( const clfftGenerators gen, const FFTKernelSignatureHeader * data, std::string& kernel, const cl_device_id &device, const cl_context& planContext ) -{ - scopedLock sLock( lockRepo(), _T( "getProgramCode" ) ); +clfftStatus FFTRepo::getProgramCode(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + std::string &kernel, + const cl_device_id &device, + const cl_context &planContext) { + scopedLock sLock(lockRepo(), _T( "getProgramCode" )); - FFTRepoKey key(gen, data, planContext, device); + FFTRepoKey key(gen, data, planContext, device); - fftRepo_iterator pos = mapFFTs.find( key); - if( pos == mapFFTs.end( ) ) - return CLFFT_FILE_NOT_FOUND; + auto pos = mapFFTs.find(key); + if (pos == mapFFTs.end()) + return CLFFT_FILE_NOT_FOUND; kernel = pos->second.ProgramString; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::setProgramEntryPoints( const clfftGenerators gen, const FFTKernelSignatureHeader * data, - const char * kernel_fwd, const char * kernel_back, const cl_device_id &device, const cl_context& planContext ) -{ - scopedLock sLock( lockRepo(), _T( "setProgramEntryPoints" ) ); +clfftStatus FFTRepo::setProgramEntryPoints(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const char *kernel_fwd, + const char *kernel_back, + const cl_device_id &device, + const cl_context &planContext) { + scopedLock sLock(lockRepo(), _T( "setProgramEntryPoints" )); - FFTRepoKey key(gen, data, planContext, device); + FFTRepoKey key(gen, data, planContext, device); - fftRepoValue& fft = mapFFTs[ key ]; - fft.EntryPoint_fwd = kernel_fwd; - fft.EntryPoint_back = kernel_back; + fftRepoValue &fft = mapFFTs[key]; + fft.EntryPoint_fwd = kernel_fwd; + fft.EntryPoint_back = kernel_back; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::getProgramEntryPoint( const clfftGenerators gen, const FFTKernelSignatureHeader * data, - clfftDirection dir, std::string& kernel, const cl_device_id &device, const cl_context& planContext ) -{ - scopedLock sLock( lockRepo(), _T( "getProgramEntryPoint" ) ); - - FFTRepoKey key(gen, data, planContext, device); - - fftRepo_iterator pos = mapFFTs.find( key ); - if( pos == mapFFTs.end( ) ) - return CLFFT_FILE_NOT_FOUND; - - switch (dir) { - case CLFFT_FORWARD: - kernel = pos->second.EntryPoint_fwd; - break; - case CLFFT_BACKWARD: - kernel = pos->second.EntryPoint_back; - break; - default: - assert (false); - return CLFFT_INVALID_ARG_VALUE; - } - - if (0 == kernel.size()) - return CLFFT_FILE_NOT_FOUND; - - return CLFFT_SUCCESS; +clfftStatus FFTRepo::getProgramEntryPoint(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + clfftDirection dir, + std::string &kernel, + const cl_device_id &device, + const cl_context &planContext) { + scopedLock sLock(lockRepo(), _T( "getProgramEntryPoint" )); + + FFTRepoKey key(gen, data, planContext, device); + + auto pos = mapFFTs.find(key); + if (pos == mapFFTs.end()) + return CLFFT_FILE_NOT_FOUND; + + switch (dir) { + case CLFFT_FORWARD: + kernel = pos->second.EntryPoint_fwd; + break; + case CLFFT_BACKWARD: + kernel = pos->second.EntryPoint_back; + break; + default: + assert(false); + return CLFFT_INVALID_ARG_VALUE; + } + + if (0 == kernel.size()) + return CLFFT_FILE_NOT_FOUND; + + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::setclProgram( const clfftGenerators gen, const FFTKernelSignatureHeader * data, const cl_program& prog, const cl_device_id &device, const cl_context& planContext ) -{ - scopedLock sLock( lockRepo(), _T( "setclProgram" ) ); - - FFTRepoKey key(gen, data, planContext, device); - - fftRepo_iterator pos = mapFFTs.find( key ); - if( pos == mapFFTs.end( ) ) - { - key.privatizeData(); // the key owns the data - mapFFTs[ key ].clProgram = prog; - } - else { - cl_program p = pos->second.clProgram; - assert (NULL == p); - if (NULL != p) - clReleaseProgram (p); - pos->second.clProgram = prog; - } - - return CLFFT_SUCCESS; +clfftStatus FFTRepo::setclProgram(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const cl_program &prog, + const cl_device_id &device, + const cl_context &planContext) { + scopedLock sLock(lockRepo(), _T( "setclProgram" )); + + FFTRepoKey key(gen, data, planContext, device); + + auto pos = mapFFTs.find(key); + if (pos == mapFFTs.end()) { + key.privatizeData(); // the key owns the data + mapFFTs[key].clProgram = prog; + } else { + cl_program p = pos->second.clProgram; + assert(NULL == p); + if (nullptr != p) + clReleaseProgram(p); + pos->second.clProgram = prog; + } + + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::getclProgram( const clfftGenerators gen, const FFTKernelSignatureHeader * data, cl_program& prog, const cl_device_id &device, const cl_context& planContext ) -{ - scopedLock sLock( lockRepo(), _T( "getclProgram" ) ); +clfftStatus FFTRepo::getclProgram(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + cl_program &prog, const cl_device_id &device, + const cl_context &planContext) { + scopedLock sLock(lockRepo(), _T( "getclProgram" )); + + FFTRepoKey key(gen, data, planContext, device); - FFTRepoKey key(gen, data, planContext, device); + auto pos = mapFFTs.find(key); + if (pos == mapFFTs.end()) + return CLFFT_INVALID_PROGRAM; + prog = pos->second.clProgram; + if (nullptr == prog) + return CLFFT_INVALID_PROGRAM; - fftRepo_iterator pos = mapFFTs.find( key ); - if( pos == mapFFTs.end( ) ) - return CLFFT_INVALID_PROGRAM; - prog = pos->second.clProgram; - if (NULL == prog) - return CLFFT_INVALID_PROGRAM; - cl_context progContext; - clGetProgramInfo(prog, CL_PROGRAM_CONTEXT, sizeof(cl_context), &progContext, NULL); - if (planContext!=progContext) - return CLFFT_INVALID_PROGRAM; + clGetProgramInfo(prog, CL_PROGRAM_CONTEXT, sizeof(cl_context), &progContext, + nullptr); + if (planContext != progContext) + return CLFFT_INVALID_PROGRAM; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::setclKernel( cl_program prog, clfftDirection dir, const cl_kernel& kernel ) -{ - scopedLock sLock( lockRepo(), _T( "setclKernel" ) ); +clfftStatus FFTRepo::setclKernel(cl_program prog, clfftDirection dir, + const cl_kernel &kernel) { + scopedLock sLock(lockRepo(), _T( "setclKernel" )); - fftKernels & Kernels = mapKernels[ prog ]; + fftKernels &Kernels = mapKernels[prog]; - cl_kernel * pk; - lockRAII ** kernelLock; + cl_kernel *pk; + lockRAII **kernelLock; - switch (dir) { - case CLFFT_FORWARD: - pk = & Kernels.kernel_fwd; - kernelLock = & Kernels.kernel_fwd_lock; - break; - case CLFFT_BACKWARD: - pk = & Kernels.kernel_back; - kernelLock = & Kernels.kernel_back_lock; - break; - default: - assert (false); - return CLFFT_INVALID_ARG_VALUE; - } + switch (dir) { + case CLFFT_FORWARD: + pk = &Kernels.kernel_fwd; + kernelLock = &Kernels.kernel_fwd_lock; + break; + case CLFFT_BACKWARD: + pk = &Kernels.kernel_back; + kernelLock = &Kernels.kernel_back_lock; + break; + default: + assert(false); + return CLFFT_INVALID_ARG_VALUE; + } - assert (NULL == *pk); - if (NULL != *pk) - clReleaseKernel( *pk ); + assert(NULL == *pk); + if (nullptr != *pk) + clReleaseKernel(*pk); - *pk = kernel; + *pk = kernel; - if (NULL != *kernelLock) - delete kernelLock; + if (nullptr != *kernelLock) + delete kernelLock; - *kernelLock = new lockRAII; + *kernelLock = new lockRAII; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::getclKernel( cl_program prog, clfftDirection dir, cl_kernel& kernel, lockRAII*& kernelLock) -{ - scopedLock sLock( lockRepo(), _T( "getclKernel" ) ); - - Kernel_iterator pos = mapKernels.find( prog ); - if (pos == mapKernels.end( ) ) - return CLFFT_INVALID_KERNEL; - - switch (dir) { - case CLFFT_FORWARD: - kernel = pos->second.kernel_fwd; - kernelLock = pos->second.kernel_fwd_lock; - break; - case CLFFT_BACKWARD: - kernel = pos->second.kernel_back; - kernelLock = pos->second.kernel_back_lock; - break; - default: - assert (false); - return CLFFT_INVALID_ARG_VALUE; - } - - if (NULL == kernel) - return CLFFT_INVALID_KERNEL; - - return CLFFT_SUCCESS; +clfftStatus FFTRepo::getclKernel(cl_program prog, clfftDirection dir, + cl_kernel &kernel, lockRAII *&kernelLock) { + scopedLock sLock(lockRepo(), _T( "getclKernel" )); + + auto pos = mapKernels.find(prog); + if (pos == mapKernels.end()) + return CLFFT_INVALID_KERNEL; + + switch (dir) { + case CLFFT_FORWARD: + kernel = pos->second.kernel_fwd; + kernelLock = pos->second.kernel_fwd_lock; + break; + case CLFFT_BACKWARD: + kernel = pos->second.kernel_back; + kernelLock = pos->second.kernel_back_lock; + break; + default: + assert(false); + return CLFFT_INVALID_ARG_VALUE; + } + + if (nullptr == kernel) + return CLFFT_INVALID_KERNEL; + + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::createPlan( clfftPlanHandle* plHandle, FFTPlan*& fftPlan ) -{ - scopedLock sLock( lockRepo(), _T( "insertPlan" ) ); +clfftStatus FFTRepo::createPlan(clfftPlanHandle *plHandle, FFTPlan *&fftPlan) { + scopedLock sLock(lockRepo(), _T( "insertPlan" )); - // We keep track of this memory in our own collection class, to make sure it's freed in releaseResources - // The lifetime of a plan is tracked by the client and is freed when the client calls ::clfftDestroyPlan() - fftPlan = new FFTPlan; + // We keep track of this memory in our own collection class, to make sure + //it's freed in releaseResources The lifetime of a plan is tracked by the + //client and is freed when the client calls ::clfftDestroyPlan() + fftPlan = new FFTPlan; - // We allocate a new lock here, and expect it to be freed in ::clfftDestroyPlan(); - // The lifetime of the lock is the same as the lifetime of the plan - lockRAII* lockPlan = new lockRAII; + // We allocate a new lock here, and expect it to be freed in + //::clfftDestroyPlan(); The lifetime of the lock is the same as the lifetime + //of the plan + auto *lockPlan = new lockRAII; - // Add and remember the fftPlan in our map - repoPlans[ planCount ] = std::make_pair( fftPlan, lockPlan ); + // Add and remember the fftPlan in our map + repoPlans[planCount] = std::make_pair(fftPlan, lockPlan); - // Assign the user handle the plan count (unique identifier), and bump the count for the next plan - *plHandle = planCount++; + // Assign the user handle the plan count (unique identifier), and bump the + //count for the next plan + *plHandle = planCount++; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::getPlan( clfftPlanHandle plHandle, FFTPlan*& fftPlan, lockRAII*& planLock ) -{ - scopedLock sLock( lockRepo(), _T( "getPlan" ) ); +clfftStatus FFTRepo::getPlan(clfftPlanHandle plHandle, FFTPlan *&fftPlan, + lockRAII *&planLock) { + scopedLock sLock(lockRepo(), _T( "getPlan" )); - // First, check if we have already created a plan with this exact same FFTPlan - repoPlansType::iterator iter = repoPlans.find( plHandle ); - if( iter == repoPlans.end( ) ) - return CLFFT_INVALID_PLAN; + // First, check if we have already created a plan with this exact same + //FFTPlan + auto iter = repoPlans.find(plHandle); + if (iter == repoPlans.end()) + return CLFFT_INVALID_PLAN; - // If plan is valid, return fill out the output pointers - fftPlan = iter->second.first; - planLock = iter->second.second; + // If plan is valid, return fill out the output pointers + fftPlan = iter->second.first; + planLock = iter->second.second; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } -clfftStatus FFTRepo::deletePlan( clfftPlanHandle* plHandle ) -{ - scopedLock sLock( lockRepo(), _T( "deletePlan" ) ); +clfftStatus FFTRepo::deletePlan(clfftPlanHandle *plHandle) { + scopedLock sLock(lockRepo(), _T( "deletePlan" )); - // First, check if we have already created a plan with this exact same FFTPlan - repoPlansType::iterator iter = repoPlans.find( *plHandle ); - if( iter == repoPlans.end( ) ) - return CLFFT_INVALID_PLAN; + // First, check if we have already created a plan with this exact same + //FFTPlan + auto iter = repoPlans.find(*plHandle); + if (iter == repoPlans.end()) + return CLFFT_INVALID_PLAN; - // We lock the plan object while we are in the process of deleting it - { - scopedLock sLock( *iter->second.second, _T( "clfftDestroyPlan" ) ); - clReleaseContext( iter->second.first->context ); + // We lock the plan object while we are in the process of deleting it + { + scopedLock sLock(*iter->second.second, _T( "clfftDestroyPlan" )); + clReleaseContext(iter->second.first->context); - // Delete the FFTPlan - delete iter->second.first; - } + // Delete the FFTPlan + delete iter->second.first; + } - // Delete the lockRAII - delete iter->second.second; + // Delete the lockRAII + delete iter->second.second; - // Remove entry from our map object - repoPlans.erase( iter ); + // Remove entry from our map object + repoPlans.erase(iter); - // Clear the client's handle to signify that the plan is gone - *plHandle = 0; + // Clear the client's handle to signify that the plan is gone + *plHandle = 0; - return CLFFT_SUCCESS; + return CLFFT_SUCCESS; } diff --git a/src/library/repo.h b/src/library/repo.h index bb81f118..deab6c61 100644 --- a/src/library/repo.h +++ b/src/library/repo.h @@ -14,221 +14,221 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_repo_H ) +#if !defined(CLFFT_repo_H) #define CLFFT_repo_H -#include -#include "private.h" -#include "plan.h" #include "lock.h" +#include "plan.h" +#include "private.h" +#include #include "../statTimer/statisticalTimer.GPU.h" - - - - -// This class contains objects that we wish to retain between individual calls into the FFT interface. -// These objects will be shared across different individual FFT plans, and we wish to keep only one -// copy of these programs, objects and events. When the client decides that they either want to reset -// the library or release all resources, this Repo will release all acquired resources and clean itself -// up as much as it can. It is implemented as a Singleton object. -class FFTRepo -{ - - struct FFTRepoKey - { - clfftGenerators gen; - const FFTKernelSignatureHeader * data; - cl_context context; - cl_device_id device; - bool dataIsPrivate; - - FFTRepoKey(clfftGenerators gen_, const FFTKernelSignatureHeader * data_, cl_context context_, cl_device_id device_) - : gen(gen_), data(data_), context(context_), device(device_), dataIsPrivate(false) - { - - } - - void privatizeData() - { - char * tmp = new char[data->datasize]; - ::memcpy(tmp, data, data->datasize); - this->data = (FFTKernelSignatureHeader*) tmp; - dataIsPrivate = true; - } - - void deleteData() - { - if ( dataIsPrivate && (this->data != NULL) ) - { - char *tmp = (char *)(this->data); - delete[] tmp; - this->data = 0; - } - } - - bool operator<(const FFTRepoKey & b) const - { - const FFTRepoKey & a = *this; - - if (a.gen != b.gen) - { - return a.gen < b.gen; - } - else if (a.data->datasize != b.data->datasize) - { - return a.data->datasize < b.data->datasize; - } - else if (a.context != b.context) - { - return a.context < b.context; - } - else if (a.device != b.device) - { - return a.device < b.device; - } - else - { - return ::memcmp(a.data, b.data, a.data->datasize) < 0; - } - } - }; - - - // Structure containing all the data we need to remember for a specific invokation of a kernel - // generator - struct fftRepoValue { - std::string ProgramString; - std::string EntryPoint_fwd; - std::string EntryPoint_back; - cl_program clProgram; - - fftRepoValue () - : clProgram (NULL) - {} - }; - - // Map structure to map parameters that a generator uses to a specific set of kernels that the generator - // has created - //typedef std::pair< clfftGenerators, FFTKernelGenKeyParams > fftRepoKey; - - typedef std::map< FFTRepoKey, fftRepoValue > fftRepoType; - typedef fftRepoType::iterator fftRepo_iterator; - - - - fftRepoType mapFFTs; - - struct fftKernels { - cl_kernel kernel_fwd; - cl_kernel kernel_back; - lockRAII* kernel_fwd_lock; - lockRAII* kernel_back_lock; - - fftKernels () - : kernel_fwd (NULL) - , kernel_back (NULL) - , kernel_fwd_lock(NULL) - , kernel_back_lock(NULL) - {} - }; - - typedef std::map< cl_program, fftKernels > mapKernelType; - typedef mapKernelType::iterator Kernel_iterator; - mapKernelType mapKernels; - - // All plans that the user creates over the course of using the library are stored here. - // Plans can be arbitrarily created and destroyed at anytime by the user, in arbitrary order, so vector - // does not seem appropriate, so a map was chosen because of the O(log N) search properties - // A lock object is created for each plan, such that any getter/setter can lock the 'plan' object before - // reading/writing its values. The lock object is kept seperate from the plan object so that the lock - // object can be held the entire time a plan is getting destroyed in clfftDestroyPlan. - typedef std::pair< FFTPlan*, lockRAII* > repoPlansValue; - typedef std::map< clfftPlanHandle, repoPlansValue > repoPlansType; - repoPlansType repoPlans; - - // Static count of how many plans we have generated; always incrementing during the life of the library - // This is used as a unique identifier for plans - static size_t planCount; - - // Private constructor to stop explicit instantiation - FFTRepo( ) - {} - - // Private copy constructor to stop implicit instantiation - FFTRepo( const FFTRepo& ); - - // Private operator= to assure only 1 copy of singleton - FFTRepo& operator=( const FFTRepo& ); - - ~FFTRepo( ) - { - // NOTE: We can't release resources in our destructor because as a static object, the order of destruction of static objects - // is not guaranteed, and openCL might already have cleaned itself up. When clFFT tries to free its resources, an access - // violation could occur. - //releaseResources( ); - - // We should at least print out a warning message to the user if we are in our destructor and we still have resources - // bound. This should give the user a clue to remember to call clfftTeardown( ) - if( (!mapKernels.empty( )) || (!mapFFTs.empty( )) ) - { - terr << _T( "Warning: Program terminating, but clFFT resources not freed." ) << std::endl; - terr << _T( "Please consider explicitly calling clfftTeardown( )." ) << std::endl; - } - }; +// This class contains objects that we wish to retain between individual +//calls into the FFT interface. These objects will be shared across different +//individual FFT plans, and we wish to keep only one copy of these programs, +//objects and events. When the client decides that they either want to reset +// the library or release all resources, this Repo will release all +//acquired resources and clean itself up as much as it can. It is implemented +//as a Singleton object. +class FFTRepo { + + struct FFTRepoKey { + clfftGenerators gen; + const FFTKernelSignatureHeader *data; + cl_context context; + cl_device_id device; + bool dataIsPrivate; + + FFTRepoKey(clfftGenerators gen_, const FFTKernelSignatureHeader *data_, + cl_context context_, cl_device_id device_) + : gen(gen_), data(data_), context(context_), device(device_), + dataIsPrivate(false) {} + + void privatizeData() { + char *tmp = new char[data->datasize]; + ::memcpy(tmp, data, data->datasize); + this->data = (FFTKernelSignatureHeader *)tmp; + dataIsPrivate = true; + } + + void deleteData() { + if (dataIsPrivate && (this->data != nullptr)) { + char *tmp = (char *)(this->data); + delete[] tmp; + this->data = nullptr; + } + } + + bool operator<(const FFTRepoKey &b) const { + const FFTRepoKey &a = *this; + + if (a.gen != b.gen) { + return a.gen < b.gen; + } else if (a.data->datasize != b.data->datasize) { + return a.data->datasize < b.data->datasize; + } else if (a.context != b.context) { + return a.context < b.context; + } else if (a.device != b.device) { + return a.device < b.device; + } else { + return ::memcmp(a.data, b.data, a.data->datasize) < 0; + } + } + }; + + // Structure containing all the data we need to remember for a specific + //invokation of a kernel generator + struct fftRepoValue { + std::string ProgramString; + std::string EntryPoint_fwd; + std::string EntryPoint_back; + cl_program clProgram; + + fftRepoValue() : clProgram(nullptr) {} + }; + + // Map structure to map parameters that a generator uses to a specific set + //of kernels that the generator has created typedef std::pair< + // clfftGenerators, FFTKernelGenKeyParams > fftRepoKey; + + typedef std::map fftRepoType; + typedef fftRepoType::iterator fftRepo_iterator; + + fftRepoType mapFFTs; + + struct fftKernels { + cl_kernel kernel_fwd; + cl_kernel kernel_back; + lockRAII *kernel_fwd_lock; + lockRAII *kernel_back_lock; + + fftKernels() + : kernel_fwd(nullptr), kernel_back(nullptr), kernel_fwd_lock(nullptr), + kernel_back_lock(nullptr) {} + }; + + typedef std::map mapKernelType; + typedef mapKernelType::iterator Kernel_iterator; + mapKernelType mapKernels; + + // All plans that the user creates over the course of using the library are + //stored here. Plans can be arbitrarily created and destroyed at anytime by + //the user, in arbitrary order, so vector does not seem appropriate, so a map + //was chosen because of the O(log N) search properties A lock object is + //created for each plan, such that any getter/setter can lock the 'plan' + //object before reading/writing its values. The lock object is kept seperate + //from the plan object so that the lock object can be held the entire time a + //plan is getting destroyed in clfftDestroyPlan. + typedef std::pair repoPlansValue; + typedef std::map repoPlansType; + repoPlansType repoPlans; + + // Static count of how many plans we have generated; always incrementing + //during the life of the library This is used as a unique identifier for plans + static size_t planCount; + + // Private constructor to stop explicit instantiation + FFTRepo() {} + + // Private copy constructor to stop implicit instantiation + FFTRepo(const FFTRepo &); + + // Private operator= to assure only 1 copy of singleton + FFTRepo &operator=(const FFTRepo &); + + ~FFTRepo() { + // NOTE: We can't release resources in our destructor because as a static + //object, the order of destruction of static objects is not guaranteed, and + //openCL might already have cleaned itself up. When clFFT tries to free its + //resources, an access violation could occur. releaseResources( ); + + // We should at least print out a warning message to the user if we are in + //our destructor and we still have resources bound. This should give the + //user a clue to remember to call clfftTeardown( ) + if ((!mapKernels.empty()) || (!mapFFTs.empty())) { + terr + << _T( "Warning: Program terminating, but clFFT resources not freed." ) + << std::endl; + terr << _T( "Please consider explicitly calling clfftTeardown( )." ) + << std::endl; + } + }; public: - // Used to make the FFTRepo struct thread safe; STL is not thread safe by default - // Optimally, we could use a lock object per STL struct, as two different STL structures - // can be modified at the same time, but a single lock object is easier and performance should - // still be good. This is implemented as a function returning a static local reference to - // assert that the lock must be instantiated before the result can be used. - static lockRAII& lockRepo() - { - // Static initialization of the repo lock variable - static lockRAII lock(_T("FFTRepo")); - return lock; - } - - // Our runtime library can instrument kernel timings with a GPU timer available in a shared module - // Handle/Address of the dynamic module that contains timers - static void* timerHandle; - - // Pointer to the timer class queried from the timer shared library - static GpuStatTimer* pStatTimer; - - // Global debug flags that the FFT engine can check to control various debug logic - clfftSetupData setupData; - - // Everybody who wants to access the Repo calls this function to get a repo reference - static FFTRepo& getInstance( ) - { - static FFTRepo fftRepo; - return fftRepo; - }; - - clfftStatus releaseResources( ); - - clfftStatus setProgramCode( const clfftGenerators gen, const FFTKernelSignatureHeader * data, const std::string& kernel, const cl_device_id &device, const cl_context& planContext ); - clfftStatus getProgramCode( const clfftGenerators gen, const FFTKernelSignatureHeader * data, std::string& kernel, const cl_device_id &device, const cl_context& planContext ); - - clfftStatus setProgramEntryPoints( const clfftGenerators gen, const FFTKernelSignatureHeader * data, const char * kernel_fwd, const char * kernel_back, const cl_device_id &device, const cl_context& planContext ); - clfftStatus getProgramEntryPoint( const clfftGenerators gen, const FFTKernelSignatureHeader * data, clfftDirection dir, std::string& kernel , const cl_device_id &device, const cl_context& planContext ); - - clfftStatus setclProgram( const clfftGenerators gen, const FFTKernelSignatureHeader * data, const cl_program& prog, const cl_device_id &device, const cl_context& planContext ); - clfftStatus getclProgram( const clfftGenerators gen, const FFTKernelSignatureHeader * data, cl_program& prog, const cl_device_id &device, const cl_context& planContext ); - - clfftStatus setclKernel ( cl_program prog, clfftDirection dir, const cl_kernel& kernel ); - clfftStatus getclKernel ( cl_program prog, clfftDirection dir, cl_kernel& kernel, lockRAII*& kernelLock); - - clfftStatus createPlan( clfftPlanHandle* plHandle, FFTPlan*& fftPlan ); - clfftStatus getPlan( clfftPlanHandle plHandle, FFTPlan*& fftPlan, lockRAII*& planLock ); - clfftStatus deletePlan( clfftPlanHandle* plHandle ); - - + // Used to make the FFTRepo struct thread safe; STL is not thread safe by + //default Optimally, we could use a lock object per STL struct, as two + //different STL structures can be modified at the same time, but a single lock + //object is easier and performance should still be good. This is implemented + //as a function returning a static local reference to assert that the lock + //must be instantiated before the result can be used. + static lockRAII &lockRepo() { + // Static initialization of the repo lock variable + static lockRAII lock(_T("FFTRepo")); + return lock; + } + + // Our runtime library can instrument kernel timings with a GPU timer + //available in a shared module Handle/Address of the dynamic module that + //contains timers + static void *timerHandle; + + // Pointer to the timer class queried from the timer shared library + static GpuStatTimer *pStatTimer; + + // Global debug flags that the FFT engine can check to control various + //debug logic + clfftSetupData setupData; + + // Everybody who wants to access the Repo calls this function to get a repo + //reference + static FFTRepo &getInstance() { + static FFTRepo fftRepo; + return fftRepo; + }; + + clfftStatus releaseResources(); + + clfftStatus setProgramCode(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const std::string &kernel, + const cl_device_id &device, + const cl_context &planContext); + clfftStatus getProgramCode(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + std::string &kernel, const cl_device_id &device, + const cl_context &planContext); + + clfftStatus setProgramEntryPoints(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const char *kernel_fwd, + const char *kernel_back, + const cl_device_id &device, + const cl_context &planContext); + clfftStatus getProgramEntryPoint(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + clfftDirection dir, std::string &kernel, + const cl_device_id &device, + const cl_context &planContext); + + clfftStatus setclProgram(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + const cl_program &prog, const cl_device_id &device, + const cl_context &planContext); + clfftStatus getclProgram(const clfftGenerators gen, + const FFTKernelSignatureHeader *data, + cl_program &prog, const cl_device_id &device, + const cl_context &planContext); + + clfftStatus setclKernel(cl_program prog, clfftDirection dir, + const cl_kernel &kernel); + clfftStatus getclKernel(cl_program prog, clfftDirection dir, + cl_kernel &kernel, lockRAII *&kernelLock); + + clfftStatus createPlan(clfftPlanHandle *plHandle, FFTPlan *&fftPlan); + clfftStatus getPlan(clfftPlanHandle plHandle, FFTPlan *&fftPlan, + lockRAII *&planLock); + clfftStatus deletePlan(clfftPlanHandle *plHandle); }; #endif - diff --git a/src/library/stdafx.cpp b/src/library/stdafx.cpp index d87a55d8..3186bb85 100644 --- a/src/library/stdafx.cpp +++ b/src/library/stdafx.cpp @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - // stdafx.cpp : source file that includes just the standard includes // clfft.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information diff --git a/src/library/transform.cpp b/src/library/transform.cpp index 7b5a9dc0..86be0de9 100644 --- a/src/library/transform.cpp +++ b/src/library/transform.cpp @@ -14,1308 +14,1384 @@ * limitations under the License. * ************************************************************************/ - // clfft.transform.cpp : Defines the entry point for the console application. // -#include "stdafx.h" +#include "plan.h" #include "private.h" #include "repo.h" -#include "plan.h" +#include "stdafx.h" //#define DEBUGGING using std::vector; -clfftStatus clfftEnqueueTransform( - clfftPlanHandle plHandle, - clfftDirection dir, - cl_uint numQueuesAndEvents, - cl_command_queue* commQueues, - cl_uint numWaitEvents, - const cl_event* waitEvents, - cl_event* outEvents, - cl_mem* clInputBuffers, - cl_mem* clOutputBuffers, - cl_mem clTmpBuffers - ) -{ - cl_int status = CLFFT_SUCCESS; - - // We do not currently support multiple command queues, which is necessary to support multi-gpu operations - if( numQueuesAndEvents > 1 ) - { - return CLFFT_NOTIMPLEMENTED; - } - - FFTRepo& fftRepo = FFTRepo::getInstance( ); - FFTPlan* fftPlan = NULL; - lockRAII* planLock = NULL; - - // At this point, the user wants to enqueue a plan to execute. We lock the plan down now, such that - // after we finish baking the plan (if the user did not do that explicitely before), the plan cannot - // change again through the action of other thread before we enqueue this plan for execution. - OPENCL_V( fftRepo.getPlan( plHandle, fftPlan, planLock ), _T( "fftRepo.getPlan failed" ) ); - scopedLock sLock( *planLock, _T( "clfftGetPlanBatchSize" ) ); - - if( fftPlan->baked == false ) - { - OPENCL_V( clfftBakePlan( plHandle, numQueuesAndEvents, commQueues, NULL, NULL ), _T( "Failed to bake plan" ) ); - } - - - // get the device information - cl_device_id q_device; - clGetCommandQueueInfo(*commQueues, CL_QUEUE_DEVICE, sizeof(cl_device_id), &q_device, NULL); - - // verify if the current device is the same as the one used for baking the plan - if(q_device != fftPlan->bakeDevice) - return CLFFT_DEVICE_MISMATCH; - - - if (fftPlan->inputLayout == CLFFT_REAL) dir = CLFFT_FORWARD; - else if (fftPlan->outputLayout == CLFFT_REAL) dir = CLFFT_BACKWARD; - - - // we do not check the user provided buffer at this release - cl_mem localIntBuffer = clTmpBuffers; - - if( clTmpBuffers == NULL && fftPlan->tmpBufSize > 0 && fftPlan->intBuffer == NULL) - { - // create the intermediate buffers - // The intermediate buffer is always interleave and packed - // For outofplace operation, we have the choice not to create intermediate buffer - // input ->(col+Transpose) output ->(col) output - fftPlan->intBuffer = clCreateBuffer( fftPlan->context, CL_MEM_READ_WRITE, - fftPlan->tmpBufSize, 0, &status); - OPENCL_V( status, _T("Creating the intermediate buffer for large1D Failed") ); - fftPlan->libCreatedIntBuffer = true; +clfftStatus +clfftEnqueueTransform(clfftPlanHandle plHandle, clfftDirection dir, + cl_uint numQueuesAndEvents, cl_command_queue *commQueues, + cl_uint numWaitEvents, const cl_event *waitEvents, + cl_event *outEvents, cl_mem *clInputBuffers, + cl_mem *clOutputBuffers, cl_mem clTmpBuffers) { + cl_int status = CLFFT_SUCCESS; + + // We do not currently support multiple command queues, which is necessary + //to support multi-gpu operations + if (numQueuesAndEvents > 1) { + return CLFFT_NOTIMPLEMENTED; + } + + FFTRepo &fftRepo = FFTRepo::getInstance(); + FFTPlan *fftPlan = nullptr; + lockRAII *planLock = nullptr; + + // At this point, the user wants to enqueue a plan to execute. We lock the + //plan down now, such that after we finish baking the plan (if the user did + //not do that explicitely before), the plan cannot change again through the + //action of other thread before we enqueue this plan for execution. + OPENCL_V(fftRepo.getPlan(plHandle, fftPlan, planLock), + _T( "fftRepo.getPlan failed" )); + scopedLock sLock(*planLock, _T( "clfftGetPlanBatchSize" )); + + if (fftPlan->baked == false) { + OPENCL_V( + clfftBakePlan(plHandle, numQueuesAndEvents, commQueues, nullptr, nullptr), + _T( "Failed to bake plan" )); + } + + // get the device information + cl_device_id q_device; + clGetCommandQueueInfo(*commQueues, CL_QUEUE_DEVICE, sizeof(cl_device_id), + &q_device, nullptr); + + // verify if the current device is the same as the one used for baking the + // plan + if (q_device != fftPlan->bakeDevice) + return CLFFT_DEVICE_MISMATCH; + + if (fftPlan->inputLayout == CLFFT_REAL) + dir = CLFFT_FORWARD; + else if (fftPlan->outputLayout == CLFFT_REAL) + dir = CLFFT_BACKWARD; + + // we do not check the user provided buffer at this release + cl_mem localIntBuffer = clTmpBuffers; + + if (clTmpBuffers == nullptr && fftPlan->tmpBufSize > 0 && + fftPlan->intBuffer == nullptr) { + // create the intermediate buffers + // The intermediate buffer is always interleave and packed + // For outofplace operation, we have the choice not to create intermediate + // buffer input ->(col+Transpose) output ->(col) output + fftPlan->intBuffer = clCreateBuffer(fftPlan->context, CL_MEM_READ_WRITE, + fftPlan->tmpBufSize, nullptr, &status); + OPENCL_V(status, _T("Creating the intermediate buffer for large1D Failed")); + fftPlan->libCreatedIntBuffer = true; #if defined(DEBUGGING) - std::cout << "One intermediate buffer is created" << std::endl; + std::cout << "One intermediate buffer is created" << std::endl; #endif - } - - if( localIntBuffer == NULL && fftPlan->intBuffer != NULL ) - localIntBuffer = fftPlan->intBuffer; - - if( fftPlan->intBufferRC == NULL && fftPlan->tmpBufSizeRC > 0 ) - { - fftPlan->intBufferRC = clCreateBuffer( fftPlan->context, CL_MEM_READ_WRITE, fftPlan->tmpBufSizeRC, 0, &status); - OPENCL_V( status, _T("Creating the intermediate buffer for large1D RC Failed") ); - } - - if( fftPlan->intBufferC2R == NULL && fftPlan->tmpBufSizeC2R > 0 ) - { - fftPlan->intBufferC2R = clCreateBuffer( fftPlan->context, CL_MEM_READ_WRITE, fftPlan->tmpBufSizeC2R, 0, &status); - OPENCL_V( status, _T("Creating the intermediate buffer for large1D YZ C2R Failed") ); - } - - // The largest vector we can transform in a single pass - // depends on the GPU caps -- especially the amount of LDS - // available - // - size_t Large1DThreshold = 0; - OPENCL_V(fftPlan->GetMax1DLength (&Large1DThreshold), _T("GetMax1DLength failed")); - BUG_CHECK (Large1DThreshold > 1); - - //Large1DThreshold = 128; - - if(fftPlan->gen != Copy) - switch( fftPlan->dim ) - { - case CLFFT_1D: - { - if ( Is1DPossible(fftPlan->length[0], Large1DThreshold) ) - break; - - if( ( fftPlan->inputLayout == CLFFT_REAL ) && ( fftPlan->planTZ != 0) ) - { - //First transpose - // Input->tmp - cl_event transTXOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &transTXOutEvents, clInputBuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for large1D transTX failed")); - - cl_mem *mybuffers; - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = clOutputBuffers; + } + + if (localIntBuffer == nullptr && fftPlan->intBuffer != nullptr) + localIntBuffer = fftPlan->intBuffer; + + if (fftPlan->intBufferRC == nullptr && fftPlan->tmpBufSizeRC > 0) { + fftPlan->intBufferRC = clCreateBuffer(fftPlan->context, CL_MEM_READ_WRITE, + fftPlan->tmpBufSizeRC, nullptr, &status); + OPENCL_V(status, + _T("Creating the intermediate buffer for large1D RC Failed")); + } + + if (fftPlan->intBufferC2R == nullptr && fftPlan->tmpBufSizeC2R > 0) { + fftPlan->intBufferC2R = clCreateBuffer(fftPlan->context, CL_MEM_READ_WRITE, + fftPlan->tmpBufSizeC2R, nullptr, &status); + OPENCL_V(status, + _T("Creating the intermediate buffer for large1D YZ C2R Failed")); + } + + // The largest vector we can transform in a single pass + // depends on the GPU caps -- especially the amount of LDS + // available + // + size_t Large1DThreshold = 0; + OPENCL_V(fftPlan->GetMax1DLength(&Large1DThreshold), + _T("GetMax1DLength failed")); + BUG_CHECK(Large1DThreshold > 1); + + // Large1DThreshold = 128; + + if (fftPlan->gen != Copy) + switch (fftPlan->dim) { + case CLFFT_1D: { + if (Is1DPossible(fftPlan->length[0], Large1DThreshold)) + break; + + if ((fftPlan->inputLayout == CLFFT_REAL) && (fftPlan->planTZ != 0)) { + // First transpose + // Input->tmp + cl_event transTXOutEvents = nullptr; + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, + &transTXOutEvents, clInputBuffers, + &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for large1D transTX failed")); + + cl_mem *mybuffers; + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = clOutputBuffers; #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //First Row - //tmp->output - cl_event rowXOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, - &transTXOutEvents, &rowXOutEvents, &localIntBuffer, &(fftPlan->intBufferRC), NULL ), - _T("clfftEnqueueTransform for large1D rowX failed")); - clReleaseEvent(transTXOutEvents); - + // First Row + // tmp->output + cl_event rowXOutEvents = nullptr; + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, numQueuesAndEvents, + commQueues, 1, &transTXOutEvents, + &rowXOutEvents, &localIntBuffer, + &(fftPlan->intBufferRC), nullptr), + _T("clfftEnqueueTransform for large1D rowX failed")); + clReleaseEvent(transTXOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, *mybuffers, CL_TRUE, 0, 536870912, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, *mybuffers, CL_TRUE, 0, + 536870912, &temp[0], 0, NULL, NULL), + _T("Reading the result buffer failed")); #endif - //Second Transpose - // output->tmp - cl_event transTYOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, - &rowXOutEvents, &transTYOutEvents, &(fftPlan->intBufferRC), &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for large1D transTY failed")); - clReleaseEvent(rowXOutEvents); - + // Second Transpose + // output->tmp + cl_event transTYOutEvents = nullptr; + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, + &rowXOutEvents, &transTYOutEvents, &(fftPlan->intBufferRC), + &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for large1D transTY failed")); + clReleaseEvent(rowXOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //Second Row - //tmp->tmp, inplace - cl_event rowYOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, - &transTYOutEvents, &rowYOutEvents, &localIntBuffer, &(fftPlan->intBufferRC), NULL ), - _T("clfftEnqueueTransform for large1D rowY failed")); - clReleaseEvent(transTYOutEvents); + // Second Row + // tmp->tmp, inplace + cl_event rowYOutEvents = nullptr; + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, numQueuesAndEvents, + commQueues, 1, &transTYOutEvents, + &rowYOutEvents, &localIntBuffer, + &(fftPlan->intBufferRC), nullptr), + _T("clfftEnqueueTransform for large1D rowY failed")); + clReleaseEvent(transTYOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //Third Transpose - // tmp->output - OPENCL_V( clfftEnqueueTransform( fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, 1, - &rowYOutEvents, outEvents, &(fftPlan->intBufferRC), mybuffers, NULL ), - _T("clfftEnqueueTransform for large1D transTZ failed")); - clReleaseEvent(rowYOutEvents); - } - else if ( fftPlan->inputLayout == CLFFT_REAL ) - { - cl_event colOutEvents = NULL; - cl_event copyInEvents = NULL; - - // First pass - // column with twiddle first, OUTOFPLACE, + transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, CLFFT_FORWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &colOutEvents, clInputBuffers, &(fftPlan->intBufferRC), localIntBuffer), - _T("clfftEnqueueTransform large1D col pass failed")); - - - cl_mem *out_local; - out_local = (fftPlan->placeness==CLFFT_INPLACE) ? clInputBuffers : clOutputBuffers; - - - // another column FFT output, INPLACE - OPENCL_V(clfftEnqueueTransform(fftPlan->planY, CLFFT_FORWARD, numQueuesAndEvents, commQueues, 1, &colOutEvents, - ©InEvents, &(fftPlan->intBufferRC), &(fftPlan->intBufferRC), localIntBuffer), - _T("clfftEnqueueTransform large1D second column failed")); - clReleaseEvent(colOutEvents); - - // copy from full complex to hermitian - OPENCL_V(clfftEnqueueTransform(fftPlan->planRCcopy, CLFFT_FORWARD, numQueuesAndEvents, commQueues, 1, ©InEvents, - outEvents, &(fftPlan->intBufferRC), out_local, localIntBuffer), - _T("clfftEnqueueTransform large1D RC copy failed")); - clReleaseEvent(copyInEvents); - - - } - else if( fftPlan->outputLayout == CLFFT_REAL ) - { - cl_event colOutEvents = NULL; - cl_event copyOutEvents = NULL; - - if (fftPlan->planRCcopy) - { - // copy from hermitian to full complex - OPENCL_V(clfftEnqueueTransform(fftPlan->planRCcopy, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, ©OutEvents, clInputBuffers, &(fftPlan->intBufferRC), localIntBuffer), - _T("clfftEnqueueTransform large1D RC copy failed")); - - // First pass - // column with twiddle first, INPLACE, - OPENCL_V(clfftEnqueueTransform(fftPlan->planX, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, 1, - ©OutEvents, &colOutEvents, &(fftPlan->intBufferRC), &(fftPlan->intBufferRC), localIntBuffer), - _T("clfftEnqueueTransform large1D col pass failed")); - clReleaseEvent(copyOutEvents); - } - else - { - // First pass - // column with twiddle first, INPLACE, - OPENCL_V(clfftEnqueueTransform(fftPlan->planX, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &colOutEvents, clInputBuffers, &(fftPlan->intBufferRC), localIntBuffer), - _T("clfftEnqueueTransform large1D col pass failed")); - clReleaseEvent(copyOutEvents); - } - - cl_mem *out_local; - out_local = (fftPlan->placeness==CLFFT_INPLACE) ? clInputBuffers : clOutputBuffers; - - // another column FFT output, OUTOFPLACE + transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, &(fftPlan->intBufferRC), out_local, localIntBuffer ), - _T("clfftEnqueueTransform large1D second column failed")); - clReleaseEvent(colOutEvents); - - } - else - { + // Third Transpose + // tmp->output + OPENCL_V(clfftEnqueueTransform(fftPlan->planTZ, dir, numQueuesAndEvents, + commQueues, 1, &rowYOutEvents, outEvents, + &(fftPlan->intBufferRC), mybuffers, + nullptr), + _T("clfftEnqueueTransform for large1D transTZ failed")); + clReleaseEvent(rowYOutEvents); + } else if (fftPlan->inputLayout == CLFFT_REAL) { + cl_event colOutEvents = nullptr; + cl_event copyInEvents = nullptr; + + // First pass + // column with twiddle first, OUTOFPLACE, + transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, CLFFT_FORWARD, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, &colOutEvents, + clInputBuffers, &(fftPlan->intBufferRC), localIntBuffer), + _T("clfftEnqueueTransform large1D col pass failed")); + + cl_mem *out_local; + out_local = (fftPlan->placeness == CLFFT_INPLACE) ? clInputBuffers + : clOutputBuffers; + + // another column FFT output, INPLACE + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, CLFFT_FORWARD, + numQueuesAndEvents, commQueues, 1, + &colOutEvents, ©InEvents, + &(fftPlan->intBufferRC), + &(fftPlan->intBufferRC), localIntBuffer), + _T("clfftEnqueueTransform large1D second column failed")); + clReleaseEvent(colOutEvents); + + // copy from full complex to hermitian + OPENCL_V(clfftEnqueueTransform( + fftPlan->planRCcopy, CLFFT_FORWARD, numQueuesAndEvents, + commQueues, 1, ©InEvents, outEvents, + &(fftPlan->intBufferRC), out_local, localIntBuffer), + _T("clfftEnqueueTransform large1D RC copy failed")); + clReleaseEvent(copyInEvents); + + } else if (fftPlan->outputLayout == CLFFT_REAL) { + cl_event colOutEvents = nullptr; + cl_event copyOutEvents = nullptr; + + if (fftPlan->planRCcopy) { + // copy from hermitian to full complex + OPENCL_V(clfftEnqueueTransform( + fftPlan->planRCcopy, CLFFT_BACKWARD, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, ©OutEvents, + clInputBuffers, &(fftPlan->intBufferRC), localIntBuffer), + _T("clfftEnqueueTransform large1D RC copy failed")); + + // First pass + // column with twiddle first, INPLACE, + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, CLFFT_BACKWARD, numQueuesAndEvents, + commQueues, 1, ©OutEvents, &colOutEvents, + &(fftPlan->intBufferRC), &(fftPlan->intBufferRC), + localIntBuffer), + _T("clfftEnqueueTransform large1D col pass failed")); + clReleaseEvent(copyOutEvents); + } else { + // First pass + // column with twiddle first, INPLACE, + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, CLFFT_BACKWARD, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, &colOutEvents, + clInputBuffers, &(fftPlan->intBufferRC), localIntBuffer), + _T("clfftEnqueueTransform large1D col pass failed")); + clReleaseEvent(copyOutEvents); + } + + cl_mem *out_local; + out_local = (fftPlan->placeness == CLFFT_INPLACE) ? clInputBuffers + : clOutputBuffers; + + // another column FFT output, OUTOFPLACE + transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planY, CLFFT_BACKWARD, numQueuesAndEvents, + commQueues, 1, &colOutEvents, outEvents, + &(fftPlan->intBufferRC), out_local, localIntBuffer), + _T("clfftEnqueueTransform large1D second column failed")); + clReleaseEvent(colOutEvents); + + } else { #if defined(DEBUGGING) - // For debugging interleave data only, initialize the intermediate buffer - // to a data pattern. This will show which data in the buffer - // are being written by the kernel - // - size_t buffSizeBytes_complex = fftPlan->tmpBufSize; - size_t buffersize = buffSizeBytes_complex/sizeof( std::complex< float > ); - std::vector > temp(buffersize); - - for (size_t u = 0; u < buffersize; ++u) { - temp[u] = std::complex (float(u+1), float(buffersize-u)); - } - - if (fftPlan->large1D == 0) - { - //First time usage, we can initialize tmp buffer - OPENCL_V(clEnqueueWriteBuffer( *commQueues, - localIntBuffer, - CL_TRUE, // blocking write - 0, - buffSizeBytes_complex, - &temp[0], - 0, - NULL, - NULL), _T("clEnqueueWriteBuffer failed") ); - } + // For debugging interleave data only, initialize the intermediate + // buffer to a data pattern. This will show which data in the buffer + // are being written by the kernel + // + size_t buffSizeBytes_complex = fftPlan->tmpBufSize; + size_t buffersize = buffSizeBytes_complex / sizeof(std::complex); + std::vector> temp(buffersize); + + for (size_t u = 0; u < buffersize; ++u) { + temp[u] = std::complex(float(u + 1), float(buffersize - u)); + } + + if (fftPlan->large1D == 0) { + // First time usage, we can initialize tmp buffer + OPENCL_V(clEnqueueWriteBuffer(*commQueues, localIntBuffer, + CL_TRUE, // blocking write + 0, buffSizeBytes_complex, &temp[0], 0, + NULL, NULL), + _T("clEnqueueWriteBuffer failed")); + } #endif - if (fftPlan->transflag) - { - //First transpose - // Input->tmp - cl_event transTXOutEvents = NULL; - if(fftPlan->allOpsInplace) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &transTXOutEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for large1D transTX failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &transTXOutEvents, clInputBuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for large1D transTX failed")); - } - - cl_mem *mybuffers; - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = clOutputBuffers; + if (fftPlan->transflag) { + // First transpose + // Input->tmp + cl_event transTXOutEvents = nullptr; + if (fftPlan->allOpsInplace) { + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &transTXOutEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for large1D transTX failed")); + } else { + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &transTXOutEvents, + clInputBuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for large1D transTX failed")); + } + + cl_mem *mybuffers; + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = clOutputBuffers; #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //First Row - //tmp->output - cl_event rowXOutEvents = NULL; - if(fftPlan->allOpsInplace) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, - &transTXOutEvents, &rowXOutEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for large1D rowX failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, - &transTXOutEvents, &rowXOutEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for large1D rowX failed")); - } - clReleaseEvent(transTXOutEvents); - + // First Row + // tmp->output + cl_event rowXOutEvents = nullptr; + if (fftPlan->allOpsInplace) { + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, + numQueuesAndEvents, commQueues, 1, + &transTXOutEvents, &rowXOutEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for large1D rowX failed")); + } else { + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, + numQueuesAndEvents, commQueues, 1, + &transTXOutEvents, &rowXOutEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for large1D rowX failed")); + } + clReleaseEvent(transTXOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, *mybuffers, CL_TRUE, 0, 536870912, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, *mybuffers, CL_TRUE, 0, + 536870912, &temp[0], 0, NULL, NULL), + _T("Reading the result buffer failed")); #endif - //Second Transpose - // output->tmp - cl_event transTYOutEvents = NULL; - if(fftPlan->allOpsInplace) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, - &rowXOutEvents, &transTYOutEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for large1D transTY failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, - &rowXOutEvents, &transTYOutEvents, mybuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for large1D transTY failed")); - } - clReleaseEvent(rowXOutEvents); - + // Second Transpose + // output->tmp + cl_event transTYOutEvents = nullptr; + if (fftPlan->allOpsInplace) { + OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, + numQueuesAndEvents, commQueues, 1, + &rowXOutEvents, &transTYOutEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for large1D transTY failed")); + } else { + OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, + numQueuesAndEvents, commQueues, 1, + &rowXOutEvents, &transTYOutEvents, + mybuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for large1D transTY failed")); + } + clReleaseEvent(rowXOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //Second Row - //tmp->tmp, inplace - cl_event rowYOutEvents = NULL; - if(fftPlan->allOpsInplace) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, - &transTYOutEvents, &rowYOutEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for large1D rowY failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, - &transTYOutEvents, &rowYOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform for large1D rowY failed")); - } - clReleaseEvent(transTYOutEvents); + // Second Row + // tmp->tmp, inplace + cl_event rowYOutEvents = nullptr; + if (fftPlan->allOpsInplace) { + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transTYOutEvents, &rowYOutEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for large1D rowY failed")); + } else { + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transTYOutEvents, &rowYOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform for large1D rowY failed")); + } + clReleaseEvent(transTYOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //Third Transpose - // tmp->output - if(fftPlan->allOpsInplace) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, 1, - &rowYOutEvents, outEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for large1D transTZ failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, 1, - &rowYOutEvents, outEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for large1D transTZ failed")); - } - clReleaseEvent(rowYOutEvents); - - } - else - { - if (fftPlan->large1D == 0) - { - if(fftPlan->planCopy) - { - // Transpose OUTOFPLACE - cl_event transTXOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &transTXOutEvents, clInputBuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for large1D transTX failed")); + // Third Transpose + // tmp->output + if (fftPlan->allOpsInplace) { + OPENCL_V(clfftEnqueueTransform(fftPlan->planTZ, dir, + numQueuesAndEvents, commQueues, 1, + &rowYOutEvents, outEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for large1D transTZ failed")); + } else { + OPENCL_V(clfftEnqueueTransform(fftPlan->planTZ, dir, + numQueuesAndEvents, commQueues, 1, + &rowYOutEvents, outEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for large1D transTZ failed")); + } + clReleaseEvent(rowYOutEvents); + + } else { + if (fftPlan->large1D == 0) { + if (fftPlan->planCopy) { + // Transpose OUTOFPLACE + cl_event transTXOutEvents = nullptr; + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &transTXOutEvents, + clInputBuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for large1D transTX failed")); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes_complex, &temp[0], + 0, NULL, NULL), + _T("Reading the result buffer failed")); #endif - // FFT INPLACE - cl_event rowXOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, - &transTXOutEvents, &rowXOutEvents, &localIntBuffer, NULL, NULL), - _T("clfftEnqueueTransform large1D first row pass failed")); - clReleaseEvent(transTXOutEvents); + // FFT INPLACE + cl_event rowXOutEvents = nullptr; + OPENCL_V( + clfftEnqueueTransform(fftPlan->planX, dir, numQueuesAndEvents, + commQueues, 1, &transTXOutEvents, + &rowXOutEvents, &localIntBuffer, nullptr, + nullptr), + _T("clfftEnqueueTransform large1D first row pass failed")); + clReleaseEvent(transTXOutEvents); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes_complex, &temp[0], + 0, NULL, NULL), + _T("Reading the result buffer failed")); #endif - // FFT INPLACE - cl_event colYOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &rowXOutEvents, - &colYOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform large1D second column failed")); - clReleaseEvent(rowXOutEvents); - + // FFT INPLACE + cl_event colYOutEvents = nullptr; + OPENCL_V( + clfftEnqueueTransform(fftPlan->planY, dir, numQueuesAndEvents, + commQueues, 1, &rowXOutEvents, + &colYOutEvents, &localIntBuffer, nullptr, + nullptr), + _T("clfftEnqueueTransform large1D second column failed")); + clReleaseEvent(rowXOutEvents); + #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - clFinish(*commQueues); - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + clFinish(*commQueues); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes_complex, &temp[0], + 0, NULL, NULL), + _T("Reading the result buffer failed")); #endif - cl_mem *mybuffers; - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = clOutputBuffers; - - // Copy kernel - OPENCL_V( clfftEnqueueTransform( fftPlan->planCopy, dir, numQueuesAndEvents, commQueues, 1, &colYOutEvents, - outEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform large1D copy failed")); - clReleaseEvent(colYOutEvents); - } - else - { - cl_event colOutEvents = NULL; - // First pass - // column with twiddle first, OUTOFPLACE - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &colOutEvents, clInputBuffers, &localIntBuffer, NULL), - _T("clfftEnqueueTransform large1D col pass failed")); + cl_mem *mybuffers; + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = clOutputBuffers; + + // Copy kernel + OPENCL_V(clfftEnqueueTransform(fftPlan->planCopy, dir, + numQueuesAndEvents, commQueues, 1, + &colYOutEvents, outEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform large1D copy failed")); + clReleaseEvent(colYOutEvents); + } else { + cl_event colOutEvents = nullptr; + // First pass + // column with twiddle first, OUTOFPLACE + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &colOutEvents, + clInputBuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform large1D col pass failed")); #if defined(DEBUGGING) - // debug purpose, interleave input <-> interleave output - // read the intermediate buffer and print part of it. - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 1, - &colOutEvents, NULL ), - _T("Reading the result buffer failed") ); + // debug purpose, interleave input <-> interleave output + // read the intermediate buffer and print part of it. + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes_complex, &temp[0], + 1, &colOutEvents, NULL), + _T("Reading the result buffer failed")); #endif - if(fftPlan->planTZ) - { - cl_event rowYOutEvents = NULL; - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - &rowYOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform large1D second row failed")); - - if (fftPlan->placeness == CLFFT_INPLACE) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, 1, &rowYOutEvents, - outEvents, &localIntBuffer, clInputBuffers, NULL ), - _T("clfftEnqueueTransform large1D trans3 failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, 1, &rowYOutEvents, - outEvents, &localIntBuffer, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform large1D trans3 failed")); - } - - clReleaseEvent(rowYOutEvents); - - } - else - { - //another column FFT output, OUTOFPLACE + transpose - if (fftPlan->placeness == CLFFT_INPLACE) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, &localIntBuffer, clInputBuffers, NULL ), - _T("clfftEnqueueTransform large1D second column failed")); + if (fftPlan->planTZ) { + cl_event rowYOutEvents = nullptr; + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, + 1, &colOutEvents, &rowYOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform large1D second row failed")); + + if (fftPlan->placeness == CLFFT_INPLACE) { + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTZ, dir, numQueuesAndEvents, + commQueues, 1, &rowYOutEvents, outEvents, + &localIntBuffer, clInputBuffers, nullptr), + _T("clfftEnqueueTransform large1D trans3 failed")); + } else { + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTZ, dir, numQueuesAndEvents, + commQueues, 1, &rowYOutEvents, outEvents, + &localIntBuffer, clOutputBuffers, nullptr), + _T("clfftEnqueueTransform large1D trans3 failed")); + } + + clReleaseEvent(rowYOutEvents); + + } else { + // another column FFT output, OUTOFPLACE + transpose + if (fftPlan->placeness == CLFFT_INPLACE) { + OPENCL_V( + clfftEnqueueTransform( + fftPlan->planY, dir, numQueuesAndEvents, commQueues, + 1, &colOutEvents, outEvents, &localIntBuffer, + clInputBuffers, nullptr), + _T("clfftEnqueueTransform large1D second column failed")); #if defined(DEBUGGING) - // For debugging interleave data only, - // read the input buffer back into memory. - OPENCL_V( clEnqueueReadBuffer( *commQueues, clInputBuffers[0], CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 1, - outEvents, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, + // read the input buffer back into memory. + OPENCL_V(clEnqueueReadBuffer(*commQueues, clInputBuffers[0], + CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], + 1, outEvents, NULL), + _T("Reading the result buffer failed")); #endif - } - else - { + } else { #if defined(DEBUGGING) - // debug purpose, interleave input <-> interleave output - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 1, - &colOutEvents, NULL ), - _T("Reading the result buffer failed") ); + // debug purpose, interleave input <-> interleave output + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, + CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], + 1, &colOutEvents, NULL), + _T("Reading the result buffer failed")); #endif - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, &localIntBuffer, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform large1D second column failed")); + OPENCL_V( + clfftEnqueueTransform( + fftPlan->planY, dir, numQueuesAndEvents, commQueues, + 1, &colOutEvents, outEvents, &localIntBuffer, + clOutputBuffers, nullptr), + _T("clfftEnqueueTransform large1D second column failed")); #if defined(DEBUGGING) - // For debugging interleave data only, read back the output buffer - // - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 1, - outEvents, NULL ), - _T("Reading the result buffer failed") ); + // For debugging interleave data only, read back the output + // buffer + // + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], + CL_TRUE, 0, + buffSizeBytes_complex, &temp[0], + 1, outEvents, NULL), + _T("Reading the result buffer failed")); #endif - } - } - - clReleaseEvent(colOutEvents); - } - } - else - { - cl_event colOutEvents = NULL; - - // second pass for huge 1D - // column with twiddle first, OUTOFPLACE, + transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &colOutEvents, &localIntBuffer, clOutputBuffers, localIntBuffer), - _T("clfftEnqueueTransform Huge1D col pass failed")); + } + } + + clReleaseEvent(colOutEvents); + } + } else { + cl_event colOutEvents = nullptr; + + // second pass for huge 1D + // column with twiddle first, OUTOFPLACE, + transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &colOutEvents, + &localIntBuffer, clOutputBuffers, localIntBuffer), + _T("clfftEnqueueTransform Huge1D col pass failed")); #if defined(DEBUGGING) - // debug purpose, interleave input <-> interleave output - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes_complex, &temp[ 0 ], 1, - &colOutEvents, NULL ), - _T("Reading the result buffer failed") ); + // debug purpose, interleave input <-> interleave output + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], + CL_TRUE, 0, buffSizeBytes_complex, + &temp[0], 1, &colOutEvents, NULL), + _T("Reading the result buffer failed")); #endif - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, clOutputBuffers, clOutputBuffers, localIntBuffer ), - _T("clfftEnqueueTransform large1D second column failed")); - - clReleaseEvent(colOutEvents); - } - } - } - - if( fftRepo.pStatTimer ) - { - fftRepo.pStatTimer->AddSample( plHandle, fftPlan, NULL, 0, NULL, std::vector< size_t >( ), std::vector< size_t >() ); - } - - return CLFFT_SUCCESS; - - } - case CLFFT_2D: - { - // if transpose kernel, we will fall below - if (fftPlan->transflag && !(fftPlan->planTX)) break; - - if ( (fftPlan->gen == Transpose_NONSQUARE ) && - (fftPlan->nonSquareKernelType == NON_SQUARE_TRANS_PARENT) ) - { - cl_event stage1OutEvents = NULL; - - OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &stage1OutEvents, clInputBuffers, NULL, NULL), - _T("clfftEnqueueTransform stage1 failed")); - - OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, - &stage1OutEvents, outEvents, clInputBuffers, NULL, NULL), - _T("clfftEnqueueTransform stage2 failed")); - clReleaseEvent(stage1OutEvents); - - if (fftRepo.pStatTimer) - { - fftRepo.pStatTimer->AddSample(plHandle, fftPlan, NULL, 0, NULL, std::vector< size_t >(), std::vector< size_t >()); - } - - return CLFFT_SUCCESS; - } - - cl_event rowOutEvents = NULL; + OPENCL_V(clfftEnqueueTransform( + fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, + &colOutEvents, outEvents, clOutputBuffers, + clOutputBuffers, localIntBuffer), + _T("clfftEnqueueTransform large1D second column failed")); + + clReleaseEvent(colOutEvents); + } + } + } + + if (fftRepo.pStatTimer) { + fftRepo.pStatTimer->AddSample(plHandle, fftPlan, nullptr, 0, nullptr, + std::vector(), + std::vector()); + } + + return CLFFT_SUCCESS; + } + case CLFFT_2D: { + // if transpose kernel, we will fall below + if (fftPlan->transflag && !(fftPlan->planTX)) + break; + + if ((fftPlan->gen == Transpose_NONSQUARE) && + (fftPlan->nonSquareKernelType == NON_SQUARE_TRANS_PARENT)) { + cl_event stage1OutEvents = nullptr; + + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, + &stage1OutEvents, clInputBuffers, nullptr, + nullptr), + _T("clfftEnqueueTransform stage1 failed")); + + OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, numQueuesAndEvents, + commQueues, 1, &stage1OutEvents, + outEvents, clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform stage2 failed")); + clReleaseEvent(stage1OutEvents); + + if (fftRepo.pStatTimer) { + fftRepo.pStatTimer->AddSample(plHandle, fftPlan, nullptr, 0, nullptr, + std::vector(), + std::vector()); + } + + return CLFFT_SUCCESS; + } + + cl_event rowOutEvents = nullptr; #if defined(DEBUGGING) - size_t buffersize = fftPlan->length[0] * fftPlan->length[1] * fftPlan->batchsize; - if (fftPlan->length.size() > 2) buffersize *= fftPlan->length[2]; - //size_t buffSizeBytes=sizeof( std::complex< float > )*buffersize; - //std::vector< std::complex< float > > output2( buffersize ); - size_t buffSizeBytes=sizeof( float) * buffersize; - //std::vector output2(buffersize*2); - float *output2 = new float[buffersize*2]; + size_t buffersize = + fftPlan->length[0] * fftPlan->length[1] * fftPlan->batchsize; + if (fftPlan->length.size() > 2) + buffersize *= fftPlan->length[2]; + // size_t buffSizeBytes=sizeof( std::complex< float > )*buffersize; + // std::vector< std::complex< float > > output2( buffersize ); + size_t buffSizeBytes = sizeof(float) * buffersize; + // std::vector output2(buffersize*2); + float *output2 = new float[buffersize * 2]; #endif #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, clInputBuffers[0], CL_TRUE, 0, buffSizeBytes, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); - - if (fftPlan->placeness == CLFFT_OUTOFPLACE) - { - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); - } + OPENCL_V(clEnqueueReadBuffer(*commQueues, clInputBuffers[0], CL_TRUE, 0, + buffSizeBytes, &output2[0], 0, NULL, NULL), + _T("Reading the result buffer failed")); + + if (fftPlan->placeness == CLFFT_OUTOFPLACE) { + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], CL_TRUE, + 0, buffSizeBytes, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); + } #endif - if (fftPlan->transflag) - {//first time set up transpose kernel for 2D - //First row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform for row failed")); + if (fftPlan->transflag) { // first time set up transpose kernel for 2D + // First row + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, + &rowOutEvents, clInputBuffers, + clOutputBuffers, nullptr), + _T("clfftEnqueueTransform for row failed")); - cl_mem *mybuffers; + cl_mem *mybuffers; - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = clOutputBuffers; + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = clOutputBuffers; #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - cl_event transXOutEvents = NULL; - cl_event colOutEvents = NULL; + cl_event transXOutEvents = nullptr; + cl_event colOutEvents = nullptr; - if (!fftPlan->transpose_in_2d_inplace) - { - //First transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - &transXOutEvents, mybuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for first transpose failed")); - clReleaseEvent(rowOutEvents); + if (!fftPlan->transpose_in_2d_inplace) { + // First transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, &transXOutEvents, + mybuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for first transpose failed")); + clReleaseEvent(rowOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - if (fftPlan->transposed == CLFFT_NOTRANSPOSE) - { - //Second Row transform - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - &colOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform for second row failed")); - clReleaseEvent(transXOutEvents); + if (fftPlan->transposed == CLFFT_NOTRANSPOSE) { + // Second Row transform + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, &colOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform for second row failed")); + clReleaseEvent(transXOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - //Second transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for second transpose failed")); - clReleaseEvent(colOutEvents); + // Second transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, + numQueuesAndEvents, commQueues, 1, + &colOutEvents, outEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for second transpose failed")); + clReleaseEvent(colOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - } - else - { - //Second Row transform - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - outEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for second row failed")); - clReleaseEvent(transXOutEvents); - } - } - else - { - // First Transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - &transXOutEvents, mybuffers, NULL, NULL ), - _T("clfftEnqueueTransform for first transpose failed")); - clReleaseEvent(rowOutEvents); - - if (fftPlan->transposed == CLFFT_NOTRANSPOSE) - { - //Second Row transform - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - &colOutEvents, mybuffers, NULL, NULL ), - _T("clfftEnqueueTransform for Second Row failed")); - clReleaseEvent(transXOutEvents); - - //Second transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, mybuffers, NULL, NULL ), - _T("clfftEnqueueTransform for second transpose failed")); - clReleaseEvent(colOutEvents); - } - else - { - //Second Row transform - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - outEvents, mybuffers, NULL, NULL ), - _T("clfftEnqueueTransform for second row failed")); - clReleaseEvent(transXOutEvents); - } - - } - } - else - { - - if ( (fftPlan->large2D || fftPlan->length.size()>2) && - (fftPlan->inputLayout != CLFFT_REAL) && (fftPlan->outputLayout != CLFFT_REAL)) - { - if (fftPlan->placeness==CLFFT_INPLACE) - { - //deal with row first - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for row failed")); - - //deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, clInputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for column failed")); - } - else - { - //deal with row first - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, clOutputBuffers, localIntBuffer ), - _T("clfftEnqueueTransform for row failed")); - - //deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, clOutputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for column failed")); - - } - } - else - { - if(fftPlan->inputLayout == CLFFT_REAL) - { - if(fftPlan->planTX) - { - //First row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform for row failed")); - - cl_mem *mybuffers; - - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = clOutputBuffers; + } else { + // Second Row transform + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, outEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for second row failed")); + clReleaseEvent(transXOutEvents); + } + } else { + // First Transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, + &rowOutEvents, &transXOutEvents, mybuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for first transpose failed")); + clReleaseEvent(rowOutEvents); + + if (fftPlan->transposed == CLFFT_NOTRANSPOSE) { + // Second Row transform + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, &colOutEvents, + mybuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for Second Row failed")); + clReleaseEvent(transXOutEvents); + + // Second transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTY, dir, numQueuesAndEvents, commQueues, + 1, &colOutEvents, outEvents, mybuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for second transpose failed")); + clReleaseEvent(colOutEvents); + } else { + // Second Row transform + OPENCL_V(clfftEnqueueTransform( + fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, + &transXOutEvents, outEvents, mybuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for second row failed")); + clReleaseEvent(transXOutEvents); + } + } + } else { + + if ((fftPlan->large2D || fftPlan->length.size() > 2) && + (fftPlan->inputLayout != CLFFT_REAL) && + (fftPlan->outputLayout != CLFFT_REAL)) { + if (fftPlan->placeness == CLFFT_INPLACE) { + // deal with row first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for row failed")); + + // deal with column + OPENCL_V( + clfftEnqueueTransform(fftPlan->planY, dir, numQueuesAndEvents, + commQueues, 1, &rowOutEvents, outEvents, + clInputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for column failed")); + } else { + // deal with row first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, clOutputBuffers, localIntBuffer), + _T("clfftEnqueueTransform for row failed")); + + // deal with column + OPENCL_V( + clfftEnqueueTransform(fftPlan->planY, dir, numQueuesAndEvents, + commQueues, 1, &rowOutEvents, outEvents, + clOutputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for column failed")); + } + } else { + if (fftPlan->inputLayout == CLFFT_REAL) { + if (fftPlan->planTX) { + // First row + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, clOutputBuffers, nullptr), + _T("clfftEnqueueTransform for row failed")); + + cl_mem *mybuffers; + + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = clOutputBuffers; #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - cl_event transXOutEvents = NULL; - cl_event colOutEvents = NULL; + cl_event transXOutEvents = nullptr; + cl_event colOutEvents = nullptr; - - //First transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - &transXOutEvents, mybuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for first transpose failed")); - // clReleaseEvent(rowOutEvents); + // First transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, &transXOutEvents, + mybuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for first transpose failed")); + // clReleaseEvent(rowOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - - //Second Row transform - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - &colOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform for second row failed")); - clReleaseEvent(transXOutEvents); + // Second Row transform + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, &colOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform for second row failed")); + clReleaseEvent(transXOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - //Second transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for second transpose failed")); - clReleaseEvent(colOutEvents); + // Second transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, + numQueuesAndEvents, commQueues, 1, + &colOutEvents, outEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for second transpose failed")); + clReleaseEvent(colOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - } - else - { - if (fftPlan->placeness==CLFFT_INPLACE) - { - // deal with row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, CLFFT_FORWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for row failed")); - - // deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, CLFFT_FORWARD, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, clInputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for column failed")); - } - else - { - // deal with row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, CLFFT_FORWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, clOutputBuffers, localIntBuffer ), - _T("clfftEnqueueTransform for row failed")); - - // deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, CLFFT_FORWARD, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, clOutputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for column failed")); - } - } - } - else if(fftPlan->outputLayout == CLFFT_REAL) - { - if(fftPlan->planTY) - { - cl_mem *mybuffers; - - if ( (fftPlan->placeness==CLFFT_INPLACE) || - ((fftPlan->placeness==CLFFT_OUTOFPLACE) && (fftPlan->length.size() > 2)) ) - mybuffers = clInputBuffers; - else - mybuffers = &(fftPlan->intBufferC2R); - - cl_event transYOutEvents = NULL; - cl_event transXOutEvents = NULL; - - //First transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &transYOutEvents, clInputBuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for first transpose failed")); - + } else { + if (fftPlan->placeness == CLFFT_INPLACE) { + // deal with row + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, CLFFT_FORWARD, + numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, + &rowOutEvents, clInputBuffers, + nullptr, localIntBuffer), + _T("clfftEnqueueTransform for row failed")); + + // deal with column + OPENCL_V(clfftEnqueueTransform( + fftPlan->planY, CLFFT_FORWARD, numQueuesAndEvents, + commQueues, 1, &rowOutEvents, outEvents, + clInputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for column failed")); + } else { + // deal with row + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, CLFFT_FORWARD, + numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, + &rowOutEvents, clInputBuffers, + clOutputBuffers, localIntBuffer), + _T("clfftEnqueueTransform for row failed")); + + // deal with column + OPENCL_V(clfftEnqueueTransform( + fftPlan->planY, CLFFT_FORWARD, numQueuesAndEvents, + commQueues, 1, &rowOutEvents, outEvents, + clOutputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for column failed")); + } + } + } else if (fftPlan->outputLayout == CLFFT_REAL) { + if (fftPlan->planTY) { + cl_mem *mybuffers; + + if ((fftPlan->placeness == CLFFT_INPLACE) || + ((fftPlan->placeness == CLFFT_OUTOFPLACE) && + (fftPlan->length.size() > 2))) + mybuffers = clInputBuffers; + else + mybuffers = &(fftPlan->intBufferC2R); + + cl_event transYOutEvents = nullptr; + cl_event transXOutEvents = nullptr; + + // First transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTY, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &transYOutEvents, + clInputBuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for first transpose failed")); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - //First row - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &transYOutEvents, - &rowOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform for col failed")); - clReleaseEvent(transYOutEvents); - + // First row + OPENCL_V(clfftEnqueueTransform(fftPlan->planY, dir, + numQueuesAndEvents, commQueues, 1, + &transYOutEvents, &rowOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform for col failed")); + clReleaseEvent(transYOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif - //Second transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - &transXOutEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for second transpose failed")); - + // Second transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, &transXOutEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for second transpose failed")); + +#if defined(DEBUGGING) + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); +#endif + // Second Row transform + if (fftPlan->placeness == CLFFT_INPLACE) { + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, + numQueuesAndEvents, commQueues, + 1, &transXOutEvents, outEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for second row failed")); + } else { + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, + commQueues, 1, &transXOutEvents, outEvents, + mybuffers, clOutputBuffers, nullptr), + _T("clfftEnqueueTransform for second row failed")); + } + clReleaseEvent(transXOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, + 0, buffSizeBytes * 2, &output2[0], 0, + NULL, NULL), + _T("Reading the result buffer failed")); #endif + } else { + cl_mem *out_local, *int_local, *out_y; + + if (fftPlan->placeness == CLFFT_INPLACE) { + out_local = nullptr; + int_local = nullptr; + out_y = clInputBuffers; + } else { + if (fftPlan->length.size() > 2) { + out_local = clOutputBuffers; + int_local = nullptr; + out_y = clInputBuffers; + } else { + out_local = clOutputBuffers; + int_local = &(fftPlan->intBufferC2R); + out_y = int_local; + } + } + + // deal with column + OPENCL_V(clfftEnqueueTransform( + fftPlan->planY, CLFFT_BACKWARD, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, int_local, localIntBuffer), + _T("clfftEnqueueTransform for row failed")); + + // deal with row + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, CLFFT_BACKWARD, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, outEvents, out_y, + out_local, localIntBuffer), + _T("clfftEnqueueTransform for column failed")); + } + + } else { + // deal with row first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for row failed")); + + if (fftPlan->placeness == CLFFT_INPLACE) { + // deal with column + OPENCL_V( + clfftEnqueueTransform(fftPlan->planY, dir, numQueuesAndEvents, + commQueues, 1, &rowOutEvents, outEvents, + &localIntBuffer, clInputBuffers, nullptr), + _T("clfftEnqueueTransform for column failed")); + } else { + // deal with column + OPENCL_V( + clfftEnqueueTransform(fftPlan->planY, dir, numQueuesAndEvents, + commQueues, 1, &rowOutEvents, outEvents, + &localIntBuffer, clOutputBuffers, nullptr), + _T("clfftEnqueueTransform for column failed")); - //Second Row transform - if(fftPlan->placeness == CLFFT_INPLACE) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - outEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for second row failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - outEvents, mybuffers, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform for second row failed")); - } - clReleaseEvent(transXOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], + CL_TRUE, 0, buffSizeBytes, + &output2[0], 1, outEvents, NULL), + _T("Reading the result buffer failed")); #endif + } + } + } + + clReleaseEvent(rowOutEvents); + } + if (fftRepo.pStatTimer) { + fftRepo.pStatTimer->AddSample(plHandle, fftPlan, nullptr, 0, nullptr, + std::vector(), + std::vector()); + } - } - else - { - cl_mem *out_local, *int_local, *out_y; - - if(fftPlan->placeness == CLFFT_INPLACE) - { - out_local = NULL; - int_local = NULL; - out_y = clInputBuffers; - } - else - { - if(fftPlan->length.size() > 2) - { - out_local = clOutputBuffers; - int_local = NULL; - out_y = clInputBuffers; - } - else - { - out_local = clOutputBuffers; - int_local = &(fftPlan->intBufferC2R); - out_y = int_local; - } - } - - - // deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, int_local, localIntBuffer ), - _T("clfftEnqueueTransform for row failed")); - - // deal with row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, out_y, out_local, localIntBuffer ), - _T("clfftEnqueueTransform for column failed")); - } - - } - else - { - //deal with row first - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for row failed")); - - - if (fftPlan->placeness==CLFFT_INPLACE) - { - //deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, &localIntBuffer, clInputBuffers, NULL ), - _T("clfftEnqueueTransform for column failed")); - } - else - { - //deal with column - OPENCL_V( clfftEnqueueTransform( fftPlan->planY, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, &localIntBuffer, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform for column failed")); - - #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes, &output2[ 0 ], 1, - outEvents, NULL ), - _T("Reading the result buffer failed") ); - #endif - } - } - } - - clReleaseEvent(rowOutEvents); - - } - - - if( fftRepo.pStatTimer ) - { - fftRepo.pStatTimer->AddSample( plHandle, fftPlan, NULL, 0, NULL, std::vector< size_t >( ), std::vector< size_t >() ); - } - - return CLFFT_SUCCESS; - } - case CLFFT_3D: - { - cl_event rowOutEvents = NULL; + return CLFFT_SUCCESS; + } + case CLFFT_3D: { + cl_event rowOutEvents = nullptr; #if defined(DEBUGGING) - size_t buffersize = fftPlan->length[0] * fftPlan->length[1] *fftPlan->length[2] *fftPlan->batchsize; - size_t buffSizeBytes=sizeof( std::complex< float > )*buffersize; - std::vector< std::complex< float > > output3( buffersize ); + size_t buffersize = fftPlan->length[0] * fftPlan->length[1] * + fftPlan->length[2] * fftPlan->batchsize; + size_t buffSizeBytes = sizeof(std::complex) * buffersize; + std::vector> output3(buffersize); #endif - if(fftPlan->inputLayout == CLFFT_REAL) - { - if(fftPlan->planTX) - { - //First row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, clOutputBuffers, localIntBuffer ), - _T("clfftEnqueueTransform for row failed")); - - cl_mem *mybuffers; - - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = clOutputBuffers; + if (fftPlan->inputLayout == CLFFT_REAL) { + if (fftPlan->planTX) { + // First row + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, clInputBuffers, + clOutputBuffers, localIntBuffer), + _T("clfftEnqueueTransform for row failed")); + + cl_mem *mybuffers; + + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = clOutputBuffers; #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - cl_event transXOutEvents = NULL; - cl_event colOutEvents = NULL; - + cl_event transXOutEvents = nullptr; + cl_event colOutEvents = nullptr; - //First transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - &transXOutEvents, mybuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for first transpose failed")); - // clReleaseEvent(rowOutEvents); + // First transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, &transXOutEvents, + mybuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for first transpose failed")); + // clReleaseEvent(rowOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - - //Second Row transform - OPENCL_V( clfftEnqueueTransform( fftPlan->planZ, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - &colOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform for second row failed")); - clReleaseEvent(transXOutEvents); + // Second Row transform + OPENCL_V(clfftEnqueueTransform(fftPlan->planZ, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, &colOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform for second row failed")); + clReleaseEvent(transXOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //Second transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTY, dir, numQueuesAndEvents, commQueues, 1, &colOutEvents, - outEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for second transpose failed")); - clReleaseEvent(colOutEvents); + // Second transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTY, dir, + numQueuesAndEvents, commQueues, 1, + &colOutEvents, outEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for second transpose failed")); + clReleaseEvent(colOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - } - else - { - cl_mem *tmp_local, *out_local; - - tmp_local = (fftPlan->placeness==CLFFT_INPLACE) ? NULL : clOutputBuffers; - out_local = (fftPlan->placeness==CLFFT_INPLACE) ? clInputBuffers : clOutputBuffers; - - //deal with 2D row first - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, CLFFT_FORWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, tmp_local, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-XY row failed")); - - //deal with 1D Z column - OPENCL_V( clfftEnqueueTransform( fftPlan->planZ, CLFFT_FORWARD, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, out_local, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-Z column failed")); - } - - } - else if(fftPlan->outputLayout == CLFFT_REAL) - { - if(fftPlan->planTZ) - { - cl_mem *mybuffers; - - if (fftPlan->placeness==CLFFT_INPLACE) - mybuffers = clInputBuffers; - else - mybuffers = &(fftPlan->intBufferC2R); - - cl_event transZOutEvents = NULL; - cl_event transXOutEvents = NULL; - - //First transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &transZOutEvents, clInputBuffers, &localIntBuffer, NULL ), - _T("clfftEnqueueTransform for first transpose failed")); - + } else { + cl_mem *tmp_local, *out_local; + + tmp_local = + (fftPlan->placeness == CLFFT_INPLACE) ? nullptr : clOutputBuffers; + out_local = (fftPlan->placeness == CLFFT_INPLACE) ? clInputBuffers + : clOutputBuffers; + + // deal with 2D row first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, CLFFT_FORWARD, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, tmp_local, localIntBuffer), + _T("clfftEnqueueTransform for 3D-XY row failed")); + + // deal with 1D Z column + OPENCL_V(clfftEnqueueTransform(fftPlan->planZ, CLFFT_FORWARD, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, outEvents, out_local, + nullptr, localIntBuffer), + _T("clfftEnqueueTransform for 3D-Z column failed")); + } + + } else if (fftPlan->outputLayout == CLFFT_REAL) { + if (fftPlan->planTZ) { + cl_mem *mybuffers; + + if (fftPlan->placeness == CLFFT_INPLACE) + mybuffers = clInputBuffers; + else + mybuffers = &(fftPlan->intBufferC2R); + + cl_event transZOutEvents = nullptr; + cl_event transXOutEvents = nullptr; + + // First transpose + OPENCL_V(clfftEnqueueTransform( + fftPlan->planTZ, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &transZOutEvents, + clInputBuffers, &localIntBuffer, nullptr), + _T("clfftEnqueueTransform for first transpose failed")); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //First row - OPENCL_V( clfftEnqueueTransform( fftPlan->planZ, dir, numQueuesAndEvents, commQueues, 1, &transZOutEvents, - &rowOutEvents, &localIntBuffer, NULL, NULL ), - _T("clfftEnqueueTransform for col failed")); - clReleaseEvent(transZOutEvents); + // First row + OPENCL_V(clfftEnqueueTransform(fftPlan->planZ, dir, + numQueuesAndEvents, commQueues, 1, + &transZOutEvents, &rowOutEvents, + &localIntBuffer, nullptr, nullptr), + _T("clfftEnqueueTransform for col failed")); + clReleaseEvent(transZOutEvents); +#if defined(DEBUGGING) + OPENCL_V(clEnqueueReadBuffer(*commQueues, mybuffers[0], CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); +#endif + + // Second transpose + OPENCL_V(clfftEnqueueTransform(fftPlan->planTX, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, &transXOutEvents, + &localIntBuffer, mybuffers, nullptr), + _T("clfftEnqueueTransform for second transpose failed")); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, mybuffers[0], CL_TRUE, 0, buffSizeBytes*2, &output2[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif - //Second transpose - OPENCL_V( clfftEnqueueTransform( fftPlan->planTX, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - &transXOutEvents, &localIntBuffer, mybuffers, NULL ), - _T("clfftEnqueueTransform for second transpose failed")); - + // Second Row transform + if (fftPlan->placeness == CLFFT_INPLACE) { + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, outEvents, + clInputBuffers, nullptr, nullptr), + _T("clfftEnqueueTransform for second row failed")); + } else { + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, dir, + numQueuesAndEvents, commQueues, 1, + &transXOutEvents, outEvents, + mybuffers, clOutputBuffers, nullptr), + _T("clfftEnqueueTransform for second row failed")); + } + clReleaseEvent(transXOutEvents); +#if defined(DEBUGGING) + OPENCL_V(clEnqueueReadBuffer(*commQueues, localIntBuffer, CL_TRUE, 0, + buffSizeBytes * 2, &output2[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); +#endif + } else { + cl_mem *out_local, *int_local, *out_z; + + if (fftPlan->placeness == CLFFT_INPLACE) { + out_local = nullptr; + int_local = nullptr; + out_z = clInputBuffers; + } else { + out_local = clOutputBuffers; + int_local = &(fftPlan->intBufferC2R); + out_z = int_local; + } + + // deal with 1D Z column first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planZ, CLFFT_BACKWARD, numQueuesAndEvents, + commQueues, numWaitEvents, waitEvents, &rowOutEvents, + clInputBuffers, int_local, localIntBuffer), + _T("clfftEnqueueTransform for 3D-Z column failed")); + + // deal with 2D row + OPENCL_V(clfftEnqueueTransform(fftPlan->planX, CLFFT_BACKWARD, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, outEvents, out_z, + out_local, localIntBuffer), + _T("clfftEnqueueTransform for 3D-XY row failed")); + } + } else { + if (fftPlan->placeness == CLFFT_INPLACE) { + // deal with 2D row first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, clInputBuffers, + nullptr, localIntBuffer), + _T("clfftEnqueueTransform for 3D-XY row failed")); + + // deal with 1D Z column + OPENCL_V(clfftEnqueueTransform(fftPlan->planZ, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, outEvents, + clInputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for 3D-Z column failed")); + } else { #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], CL_TRUE, + 0, buffSizeBytes, &output3[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif + // deal with 2D row first + OPENCL_V(clfftEnqueueTransform( + fftPlan->planX, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, &rowOutEvents, clInputBuffers, + clOutputBuffers, localIntBuffer), + _T("clfftEnqueueTransform for 3D-XY row failed")); - //Second Row transform - if(fftPlan->placeness == CLFFT_INPLACE) - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - outEvents, clInputBuffers, NULL, NULL ), - _T("clfftEnqueueTransform for second row failed")); - } - else - { - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, 1, &transXOutEvents, - outEvents, mybuffers, clOutputBuffers, NULL ), - _T("clfftEnqueueTransform for second row failed")); - } - clReleaseEvent(transXOutEvents); #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, localIntBuffer, CL_TRUE, 0, buffSizeBytes*2, &output2[0], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], CL_TRUE, + 0, buffSizeBytes, &output3[0], 0, NULL, + NULL), + _T("Reading the result buffer failed")); #endif + // deal with 1D Z column + OPENCL_V(clfftEnqueueTransform(fftPlan->planZ, dir, + numQueuesAndEvents, commQueues, 1, + &rowOutEvents, outEvents, + clOutputBuffers, nullptr, localIntBuffer), + _T("clfftEnqueueTransform for 3D-Z column failed")); +#if defined(DEBUGGING) + OPENCL_V(clEnqueueReadBuffer(*commQueues, clOutputBuffers[0], CL_TRUE, + 0, buffSizeBytes, &output3[0], 1, + outEvents, NULL), + _T("Reading the result buffer failed")); +#endif + } + } + + clReleaseEvent(rowOutEvents); + + if (fftRepo.pStatTimer) { + fftRepo.pStatTimer->AddSample(plHandle, fftPlan, nullptr, 0, nullptr, + std::vector(), + std::vector()); + } + + return CLFFT_SUCCESS; + } + } - } - else - { - cl_mem *out_local, *int_local, *out_z; - - if(fftPlan->placeness == CLFFT_INPLACE) - { - out_local = NULL; - int_local = NULL; - out_z = clInputBuffers; - } - else - { - out_local = clOutputBuffers; - int_local = &(fftPlan->intBufferC2R); - out_z = int_local; - } - - //deal with 1D Z column first - OPENCL_V( clfftEnqueueTransform( fftPlan->planZ, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, int_local, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-Z column failed")); - - //deal with 2D row - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, CLFFT_BACKWARD, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, out_z, out_local, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-XY row failed")); - } - } - else - { - if (fftPlan->placeness==CLFFT_INPLACE) - { - //deal with 2D row first - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-XY row failed")); - - //deal with 1D Z column - OPENCL_V( clfftEnqueueTransform( fftPlan->planZ, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, clInputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-Z column failed")); - } - else - { - #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes, &output3[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); - #endif - - //deal with 2D row first - OPENCL_V( clfftEnqueueTransform( fftPlan->planX, dir, numQueuesAndEvents, commQueues, numWaitEvents, - waitEvents, &rowOutEvents, clInputBuffers, clOutputBuffers, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-XY row failed")); - - #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes, &output3[ 0 ], 0, - NULL, NULL ), - _T("Reading the result buffer failed") ); - #endif - - //deal with 1D Z column - OPENCL_V( clfftEnqueueTransform( fftPlan->planZ, dir, numQueuesAndEvents, commQueues, 1, &rowOutEvents, - outEvents, clOutputBuffers, NULL, localIntBuffer ), - _T("clfftEnqueueTransform for 3D-Z column failed")); - #if defined(DEBUGGING) - OPENCL_V( clEnqueueReadBuffer( *commQueues, clOutputBuffers[0], CL_TRUE, 0, buffSizeBytes, &output3[ 0 ], 1, - outEvents, NULL ), - _T("Reading the result buffer failed") ); - #endif - } - } - - clReleaseEvent(rowOutEvents); - - if( fftRepo.pStatTimer ) - { - fftRepo.pStatTimer->AddSample( plHandle, fftPlan, NULL, 0, NULL, std::vector< size_t >( ), std::vector< size_t >() ); - } - - return CLFFT_SUCCESS; - } - } - - return fftPlan->action->enqueue(plHandle, - dir, - numQueuesAndEvents, - commQueues, - numWaitEvents, - waitEvents, - outEvents, - clInputBuffers, - clOutputBuffers); + return fftPlan->action->enqueue(plHandle, dir, numQueuesAndEvents, commQueues, + numWaitEvents, waitEvents, outEvents, + clInputBuffers, clOutputBuffers); } diff --git a/src/statTimer/dllmain.cpp b/src/statTimer/dllmain.cpp index 9afb3395..6db0a3e1 100644 --- a/src/statTimer/dllmain.cpp +++ b/src/statTimer/dllmain.cpp @@ -17,19 +17,14 @@ // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, + LPVOID lpReserved) { + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; } - diff --git a/src/statTimer/statisticalTimer.CPU.cpp b/src/statTimer/statisticalTimer.CPU.cpp index 4e3c8c2e..99bf0b21 100644 --- a/src/statTimer/statisticalTimer.CPU.cpp +++ b/src/statTimer/statisticalTimer.CPU.cpp @@ -14,397 +14,348 @@ * limitations under the License. * ************************************************************************/ - // StatTimer.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" #include -#include -#include -#include -#include #include +#include +#include +#include #include +#include -#include "statisticalTimer.CPU.h" #include "../library/private.h" +#include "statisticalTimer.CPU.h" -#if defined( __GNUC__ ) - #include +#if defined(__GNUC__) +#include #endif // Format an unsigned number with comma thousands separator // -template< typename T > // T could be 32-bit or 64-bit -std::basic_string commatize (T number) -{ - static TCHAR scratch [8*sizeof(T)]; - - register TCHAR * ptr = scratch + countOf( scratch ); - *(--ptr) = 0; - - for (int digits = 3; ; ) - { - *(--ptr) = '0' + int (number % 10); - number /= 10; - if (0 == number) - break; - if (--digits <= 0) - { - *(--ptr) = ','; - digits = 3; - } - } - - return std::basic_string (ptr); +template // T could be 32-bit or 64-bit +std::basic_string commatize(T number) { + static TCHAR scratch[8 * sizeof(T)]; + + register TCHAR *ptr = scratch + countOf(scratch); + *(--ptr) = 0; + + for (int digits = 3;;) { + *(--ptr) = '0' + int(number % 10); + number /= 10; + if (0 == number) + break; + if (--digits <= 0) { + *(--ptr) = ','; + digits = 3; + } + } + + return std::basic_string(ptr); } // Functor object to help with accumulating values in vectors -template< typename T > -struct Accumulator: public std::unary_function< T, void > -{ - T acc; +template struct Accumulator : public std::unary_function { + T acc; - Accumulator( ): acc( 0 ) {} - void operator( )(T x) { acc += x; } + Accumulator() : acc(0) {} + void operator()(T x) { acc += x; } }; // Unary predicate used for remove_if() algorithm -// Currently, RangeType is expected to be a floating point type, and ValType an integer type -template< typename RangeType, typename ValType > -struct PruneRange -{ - RangeType lower, upper; - - PruneRange( RangeType mean, RangeType stdev ): lower( mean-stdev ), upper( mean+stdev ) {} - - bool operator( )( ValType val ) - { - // These comparisons can be susceptible to signed/unsigned casting problems - // This is why we cast ValType to RangeType, because RangeType should always be floating and signed - if( static_cast< RangeType >( val ) < lower ) - return true; - else if( static_cast< RangeType >( val ) > upper ) - return true; - - return false; - } +// Currently, RangeType is expected to be a floating point type, and +//ValType an integer type +template struct PruneRange { + RangeType lower, upper; + + PruneRange(RangeType mean, RangeType stdev) + : lower(mean - stdev), upper(mean + stdev) {} + + bool operator()(ValType val) { + // These comparisons can be susceptible to signed/unsigned casting problems + // This is why we cast ValType to RangeType, because RangeType should + //always be floating and signed + if (static_cast(val) < lower) + return true; + else if (static_cast(val) > upper) + return true; + + return false; + } }; -CpuStatTimer& -CpuStatTimer::getInstance( ) -{ - static CpuStatTimer timer; - return timer; +CpuStatTimer &CpuStatTimer::getInstance() { + static CpuStatTimer timer; + return timer; } -CpuStatTimer::CpuStatTimer( ): nEvents( 0 ), nSamples( 0 ), normalize( true ) -{ -#if defined( _WIN32 ) - // OS call to get ticks per second2 - ::QueryPerformanceFrequency( reinterpret_cast( &clkFrequency ) ); +CpuStatTimer::CpuStatTimer() : nEvents(0), nSamples(0), normalize(true) { +#if defined(_WIN32) + // OS call to get ticks per second2 + ::QueryPerformanceFrequency(reinterpret_cast(&clkFrequency)); #else - res.tv_sec = 0; - res.tv_nsec = 0; - clkFrequency = 0; - - // clock_getres() return 0 for success - // If the function fails (monotonic clock not supported), we default to a lower resolution timer -// if( ::clock_getres( CLOCK_MONOTONIC, &res ) ) - { - clkFrequency = 1000000; - } -// else -// { -// // Turn time into frequency -// clkFrequency = res.tv_nsec * 1000000000; -// } + res.tv_sec = 0; + res.tv_nsec = 0; + clkFrequency = 0; + + // clock_getres() return 0 for success + // If the function fails (monotonic clock not supported), we default to a + //lower resolution timer + // if( ::clock_getres( CLOCK_MONOTONIC, &res ) ) + { clkFrequency = 1000000; } + // else + // { + // // Turn time into frequency + // clkFrequency = res.tv_nsec * 1000000000; + // } #endif } -CpuStatTimer::~CpuStatTimer( ) -{} +CpuStatTimer::~CpuStatTimer() {} -void -CpuStatTimer::Clear( ) -{ - labelID.clear( ); - clkStart.clear( ); - clkTicks.clear( ); +void CpuStatTimer::Clear() { + labelID.clear(); + clkStart.clear(); + clkTicks.clear(); } -void -CpuStatTimer::Reset( ) -{ - if( nEvents == 0 || nSamples == 0 ) - throw std::runtime_error( "StatisticalTimer::Reserve( ) was not called before Reset( )" ); +void CpuStatTimer::Reset() { + if (nEvents == 0 || nSamples == 0) + throw std::runtime_error( + "StatisticalTimer::Reserve( ) was not called before Reset( )"); - clkStart.clear( ); - clkTicks.clear( ); + clkStart.clear(); + clkTicks.clear(); - clkStart.resize( nEvents ); - clkTicks.resize( nEvents ); + clkStart.resize(nEvents); + clkTicks.resize(nEvents); - for( cl_uint i = 0; i < nEvents; ++i ) - { - clkTicks.at( i ).reserve( nSamples ); - } + for (cl_uint i = 0; i < nEvents; ++i) { + clkTicks.at(i).reserve(nSamples); + } - return; + return; } // The caller can pre-allocate memory, to improve performance. -// nEvents is an approximate value for how many seperate events the caller will think -// they will need, and nSamples is a hint on how many samples we think we will take -// per event -void -CpuStatTimer::Reserve( size_t nEvents, size_t nSamples ) -{ - this->nEvents = std::max< size_t >( 1, nEvents ); - this->nSamples = std::max< size_t >( 1, nSamples ); - - Clear( ); - labelID.reserve( nEvents ); - - clkStart.resize( nEvents ); - clkTicks.resize( nEvents ); - - for( cl_uint i = 0; i < nEvents; ++i ) - { - clkTicks.at( i ).reserve( nSamples ); - } +// nEvents is an approximate value for how many seperate events the caller +//will think they will need, and nSamples is a hint on how many samples we think +//we will take per event +void CpuStatTimer::Reserve(size_t nEvents, size_t nSamples) { + this->nEvents = std::max(1, nEvents); + this->nSamples = std::max(1, nSamples); + + Clear(); + labelID.reserve(nEvents); + + clkStart.resize(nEvents); + clkTicks.resize(nEvents); + + for (cl_uint i = 0; i < nEvents; ++i) { + clkTicks.at(i).reserve(nSamples); + } } -void -CpuStatTimer::setNormalize( bool norm ) -{ - normalize = norm; -} +void CpuStatTimer::setNormalize(bool norm) { normalize = norm; } -void -CpuStatTimer::Start( size_t id ) -{ -#if defined( _WIN32 ) - ::QueryPerformanceCounter( reinterpret_cast( &clkStart.at( id ) ) ); +void CpuStatTimer::Start(size_t id) { +#if defined(_WIN32) + ::QueryPerformanceCounter( + reinterpret_cast(&clkStart.at(id))); #else - if( clkFrequency ) - { - struct timeval s; - gettimeofday( &s, 0 ); - clkStart.at( id ) = (cl_ulong)s.tv_sec * 1000000 + (cl_ulong)s.tv_usec; - } - else - { - - } + if (clkFrequency) { + struct timeval s; + gettimeofday(&s, nullptr); + clkStart.at(id) = (cl_ulong)s.tv_sec * 1000000 + (cl_ulong)s.tv_usec; + } else { + } #endif } -void -CpuStatTimer::Stop( size_t id ) -{ - cl_ulong n; +void CpuStatTimer::Stop(size_t id) { + cl_ulong n; -#if defined( _WIN32 ) - ::QueryPerformanceCounter( reinterpret_cast( &n ) ); +#if defined(_WIN32) + ::QueryPerformanceCounter(reinterpret_cast(&n)); #else - struct timeval s; - gettimeofday( &s, 0 ); - n = (cl_ulong)s.tv_sec * 1000000 + (cl_ulong)s.tv_usec; + struct timeval s; + gettimeofday(&s, nullptr); + n = (cl_ulong)s.tv_sec * 1000000 + (cl_ulong)s.tv_usec; #endif - n -= clkStart.at( id ); - clkStart.at( id ) = 0; - AddSample( id, n ); + n -= clkStart.at(id); + clkStart.at(id) = 0; + AddSample(id, n); } -void -CpuStatTimer::AddSample( const size_t id, const cl_ulong n ) -{ - clkTicks.at( id ).push_back( n ); +void CpuStatTimer::AddSample(const size_t id, const cl_ulong n) { + clkTicks.at(id).push_back(n); } -// This function's purpose is to provide a mapping from a 'friendly' human readable text string -// to an index into internal data structures. -size_t -CpuStatTimer::getUniqueID( const std::string& label, cl_uint groupID ) -{ - // I expect labelID will hardly ever grow beyond 30, so it's not of any use - // to keep this sorted and do a binary search - - labelPair sItem = std::make_pair( label, groupID ); +// This function's purpose is to provide a mapping from a 'friendly' human +//readable text string to an index into internal data structures. +size_t CpuStatTimer::getUniqueID(const std::string &label, cl_uint groupID) { + // I expect labelID will hardly ever grow beyond 30, so it's not of any use + // to keep this sorted and do a binary search - stringVector::iterator iter; - iter = std::find( labelID.begin(), labelID.end(), sItem ); + labelPair sItem = std::make_pair(label, groupID); - if( iter != labelID.end( ) ) - return std::distance( labelID.begin( ), iter ); + stringVector::iterator iter; + iter = std::find(labelID.begin(), labelID.end(), sItem); - labelID.push_back( sItem ); + if (iter != labelID.end()) + return std::distance(labelID.begin(), iter); - return labelID.size( ) - 1; + labelID.push_back(sItem); + return labelID.size() - 1; } -cl_double -CpuStatTimer::getMean( size_t id ) const -{ - if( clkTicks.empty( ) ) - return 0; +cl_double CpuStatTimer::getMean(size_t id) const { + if (clkTicks.empty()) + return 0; - size_t N = clkTicks.at( id ).size( ); + size_t N = clkTicks.at(id).size(); - Accumulator sum = std::for_each( clkTicks.at( id ).begin(), clkTicks.at( id ).end(), Accumulator() ); + Accumulator sum = std::for_each( + clkTicks.at(id).begin(), clkTicks.at(id).end(), Accumulator()); - return static_cast( sum.acc ) / N; + return static_cast(sum.acc) / N; } -cl_double -CpuStatTimer::getVariance( size_t id ) const -{ - if( clkTicks.empty( ) ) - return 0; +cl_double CpuStatTimer::getVariance(size_t id) const { + if (clkTicks.empty()) + return 0; - cl_double mean = getMean( id ); + cl_double mean = getMean(id); - size_t N = clkTicks.at( id ).size( ); - cl_double sum = 0; + size_t N = clkTicks.at(id).size(); + cl_double sum = 0; - for( cl_uint i = 0; i < N; ++i ) - { - cl_double diff = clkTicks.at( id ).at( i ) - mean; - diff *= diff; - sum += diff; - } + for (cl_uint i = 0; i < N; ++i) { + cl_double diff = clkTicks.at(id).at(i) - mean; + diff *= diff; + sum += diff; + } - return sum / N; + return sum / N; } -cl_double -CpuStatTimer::getStdDev( size_t id ) const -{ - cl_double variance = getVariance( id ); +cl_double CpuStatTimer::getStdDev(size_t id) const { + cl_double variance = getVariance(id); - return sqrt( variance ); + return sqrt(variance); } -cl_double -CpuStatTimer::getAverageTime( size_t id ) const -{ - if( normalize ) - return getMean( id ) / clkFrequency; - else - return getMean( id ); +cl_double CpuStatTimer::getAverageTime(size_t id) const { + if (normalize) + return getMean(id) / clkFrequency; + else + return getMean(id); } -cl_double -CpuStatTimer::getMinimumTime( size_t id ) const -{ - clkVector::const_iterator iter = std::min_element( clkTicks.at( id ).begin( ), clkTicks.at( id ).end( ) ); - - if( iter != clkTicks.at( id ).end( ) ) - { - if( normalize ) - return static_cast( *iter ) / clkFrequency; - else - return static_cast( *iter ); - } - else - return 0; +cl_double CpuStatTimer::getMinimumTime(size_t id) const { + auto iter = + std::min_element(clkTicks.at(id).begin(), clkTicks.at(id).end()); + + if (iter != clkTicks.at(id).end()) { + if (normalize) + return static_cast(*iter) / clkFrequency; + else + return static_cast(*iter); + } else + return 0; } -std::vector< size_t > -CpuStatTimer::pruneOutliers( size_t id , cl_double multiple ) -{ - //if( clkTicks.empty( ) ) - // return std::vector< size_t >( ); +std::vector CpuStatTimer::pruneOutliers(size_t id, cl_double multiple) { + // if( clkTicks.empty( ) ) + // return std::vector< size_t >( ); - //cl_double mean = getMean( id ); - //cl_double stdDev = getStdDev( id ); + // cl_double mean = getMean( id ); + // cl_double stdDev = getStdDev( id ); - //clkVector& clks = clkTicks.at( id ); + // clkVector& clks = clkTicks.at( id ); - //// Look on p. 379, "The C++ Standard Library" - //// std::remove_if does not actually erase, it only copies elements, it returns new 'logical' end - //clkVector::iterator newEnd = std::remove_if( clks.begin( ), clks.end( ), PruneRange< cl_double,cl_ulong >( mean, multiple*stdDev ) ); + //// Look on p. 379, "The C++ Standard Library" + //// std::remove_if does not actually erase, it only copies elements, it + ///returns new 'logical' end + // clkVector::iterator newEnd = std::remove_if( clks.begin( ), clks.end( + // ), PruneRange< cl_double,cl_ulong >( mean, multiple*stdDev ) ); - //clkVector::difference_type dist = std::distance( newEnd, clks.end( ) ); + // clkVector::difference_type dist = std::distance( newEnd, clks.end( ) ); - //if( dist != 0 ) - // clks.erase( newEnd, clks.end( ) ); + // if( dist != 0 ) + // clks.erase( newEnd, clks.end( ) ); - //assert( dist < std::numeric_limits< cl_uint >::max( ) ); + // assert( dist < std::numeric_limits< cl_uint >::max( ) ); - return std::vector< size_t >( ); + return std::vector(); } -size_t -CpuStatTimer::pruneOutliers( cl_double multiple ) -{ - size_t tCount = 0; +size_t CpuStatTimer::pruneOutliers(cl_double multiple) { + size_t tCount = 0; - //for( cl_uint l = 0; l < labelID.size( ); ++l ) - //{ - // size_t lCount = pruneOutliers( l , multiple ); - // std::clog << "\tStatisticalTimer:: Pruning " << lCount << " samples from " << labelID[l].first << std::endl; - // tCount += lCount; - //} + // for( cl_uint l = 0; l < labelID.size( ); ++l ) + //{ + // size_t lCount = pruneOutliers( l , multiple ); + // std::clog << "\tStatisticalTimer:: Pruning " << lCount << " samples from + //" << labelID[l].first << std::endl; tCount += lCount; + //} - return tCount; + return tCount; } -void -CpuStatTimer::Print( ) -{ - //double flops = fFunc( ); - - //for( cl_uint i = 0; i < labelID.size( ); ++i ) - //{ - // double timeNs = getAverageTime( i ); - // double gFlops = flops / timeNs; - - // std::cout << labelID[ i ].first << std::endl; - // tout << std::setw( 10 ) << "Time:" << std::setw( 10 ) << commatize( static_cast< cl_ulong >( timeNs ) ) - // << " ns" << std::endl; - // tout << std::setw( 10 ) << "Gflops:" << std::setw( 10 ) << gFlops << std::endl; - //} +void CpuStatTimer::Print() { + // double flops = fFunc( ); + + // for( cl_uint i = 0; i < labelID.size( ); ++i ) + //{ + // double timeNs = getAverageTime( i ); + // double gFlops = flops / timeNs; + + // std::cout << labelID[ i ].first << std::endl; + // tout << std::setw( 10 ) << "Time:" << std::setw( 10 ) << commatize( + //static_cast< cl_ulong >( timeNs ) ) + // << " ns" << std::endl; + // tout << std::setw( 10 ) << "Gflops:" << std::setw( 10 ) << gFlops << + //std::endl; + //} } // Defining an output print operator -std::ostream& -operator<<( std::ostream& os, const CpuStatTimer& st ) -{ - if( st.clkTicks.empty( ) ) - return os; - - std::ios::fmtflags bckup = os.flags( ); - - for( cl_uint l = 0; l < st.labelID.size( ); ++l ) - { - cl_ulong min = 0; - CpuStatTimer::clkVector::const_iterator iter = std::min_element( st.clkTicks.at( l ).begin( ), st.clkTicks.at( l ).end( ) ); - - if( iter != st.clkTicks.at( l ).end( ) ) - min = *iter; - - os << st.labelID[l].first << ", " << st.labelID[l].second << std::fixed << std::endl; - os << "Min:," << min << std::endl; - os << "Mean:," << st.getMean( l ) << std::endl; - os << "StdDev:," << st.getStdDev( l ) << std::endl; - os << "AvgTime:," << st.getAverageTime( l ) << std::endl; - os << "MinTime:," << st.getMinimumTime( l ) << std::endl; - - //for( cl_uint t = 0; t < st.clkTicks[l].size( ); ++t ) - //{ - // os << st.clkTicks[l][t]<< ","; - //} - os << "\n" << std::endl; - - } - - os.flags( bckup ); - - return os; +std::ostream &operator<<(std::ostream &os, const CpuStatTimer &st) { + if (st.clkTicks.empty()) + return os; + + std::ios::fmtflags bckup = os.flags(); + + for (cl_uint l = 0; l < st.labelID.size(); ++l) { + cl_ulong min = 0; + auto iter = + std::min_element(st.clkTicks.at(l).begin(), st.clkTicks.at(l).end()); + + if (iter != st.clkTicks.at(l).end()) + min = *iter; + + os << st.labelID[l].first << ", " << st.labelID[l].second << std::fixed + << std::endl; + os << "Min:," << min << std::endl; + os << "Mean:," << st.getMean(l) << std::endl; + os << "StdDev:," << st.getStdDev(l) << std::endl; + os << "AvgTime:," << st.getAverageTime(l) << std::endl; + os << "MinTime:," << st.getMinimumTime(l) << std::endl; + + // for( cl_uint t = 0; t < st.clkTicks[l].size( ); ++t ) + //{ + // os << st.clkTicks[l][t]<< ","; + //} + os << "\n" << std::endl; + } + + os.flags(bckup); + + return os; } diff --git a/src/statTimer/statisticalTimer.CPU.h b/src/statTimer/statisticalTimer.CPU.h index 76014936..d261966e 100644 --- a/src/statTimer/statisticalTimer.CPU.h +++ b/src/statTimer/statisticalTimer.CPU.h @@ -14,13 +14,12 @@ * limitations under the License. * ************************************************************************/ - #pragma once #ifndef _STATISTICALTIMER_CPU_H_ #define _STATISTICALTIMER_CPU_H_ +#include #include #include -#include #ifdef __FreeBSD__ #include #endif @@ -30,144 +29,147 @@ * \file clfft.StatisticalTimer.CPU.h * \brief A timer class that provides a cross platform timer for use * in timing code progress with a high degree of accuracy. - * This class is implemented entirely in the header, to facilitate inclusion into multiple - * projects without needing to compile an object file for each project. + * This class is implemented entirely in the header, to facilitate + *inclusion into multiple projects without needing to compile an object file for + *each project. */ -class CpuStatTimer : public baseStatTimer -{ - // Private typedefs - typedef std::vector< cl_ulong > clkVector; - typedef std::pair< std::string, cl_uint > labelPair; - typedef std::vector< labelPair > stringVector; - - // In order to calculate statistics , we need to keep a history of our timings - stringVector labelID; - clkVector clkStart; - std::vector< clkVector > clkTicks; - - // How many clockticks in a second - cl_ulong clkFrequency; - - // For linux; the resolution of a high-precision timer - // Mingw32 does not define timespec; can use windows timers -#if !defined( _WIN32 ) - timespec res; +class CpuStatTimer : public baseStatTimer { + // Private typedefs + typedef std::vector clkVector; + typedef std::pair labelPair; + typedef std::vector stringVector; + + // In order to calculate statistics , we need to keep a history + //of our timings + stringVector labelID; + clkVector clkStart; + std::vector clkTicks; + + // How many clockticks in a second + cl_ulong clkFrequency; + + // For linux; the resolution of a high-precision timer + // Mingw32 does not define timespec; can use windows timers +#if !defined(_WIN32) + timespec res; #endif - // Saved sizes for our vectors, used in Reset() to reallocate vectors - clkVector::size_type nEvents, nSamples; - - // This setting controls whether the Timer should convert samples into time by dividing by the - // clock frequency - bool normalize; - - /** - * \fn StatisticalTimer() - * \brief Constructor for StatisticalTimer that initializes the class - * This is private so that user code cannot create their own instantiation. Instead, you - * must go through getInstance( ) to get a reference to the class. - */ - CpuStatTimer( ); - - /** - * \fn ~StatisticalTimer() - * \brief Destructor for StatisticalTimer that cleans up the class - */ - ~CpuStatTimer( ); - - /** - * \fn StatisticalTimer(const StatisticalTimer& ) - * \brief Copy constructors do not make sense for a singleton, disallow copies - */ - CpuStatTimer( const CpuStatTimer& ); - - /** - * \fn operator=( const StatisticalTimer& ) - * \brief Assignment operator does not make sense for a singleton, disallow assignments - */ - CpuStatTimer& operator=( const CpuStatTimer& ); - - friend std::ostream& operator<<( std::ostream& os, const CpuStatTimer& s ); - - /** - * \fn void AddSample( const size_t id, const cl_ulong n ) - * \brief Explicitely add a timing sample into the class - */ - void AddSample( const size_t id, const cl_ulong n ); - - // Calculate the average/mean of data for a given event - cl_double getMean( size_t id ) const; - - // Calculate the variance of data for a given event - // Variance - average of the squared differences between data points and the mean - cl_double getVariance( size_t id ) const; - - // Sqrt of variance, also in units of the original data - cl_double getStdDev( size_t id ) const; - - /** - * \fn double getAverageTime(size_t id) const - * \return Return the arithmetic mean of all the samples that have been saved - */ - cl_double getAverageTime( size_t id ) const; - - /** - * \fn double getMinimumTime(size_t id) const - * \return Return the arithmetic min of all the samples that have been saved - */ - cl_double getMinimumTime( size_t id ) const; + // Saved sizes for our vectors, used in Reset() to reallocate vectors + clkVector::size_type nEvents, nSamples; + + // This setting controls whether the Timer should convert samples into time + //by dividing by the clock frequency + bool normalize; + + /** + * \fn StatisticalTimer() + * \brief Constructor for StatisticalTimer that initializes the class + * This is private so that user code cannot create their own instantiation. + *Instead, you must go through getInstance( ) to get a reference to the class. + */ + CpuStatTimer(); + + /** + * \fn ~StatisticalTimer() + * \brief Destructor for StatisticalTimer that cleans up the class + */ + ~CpuStatTimer() override; + + /** + * \fn StatisticalTimer(const StatisticalTimer& ) + * \brief Copy constructors do not make sense for a singleton, disallow copies + */ + CpuStatTimer(const CpuStatTimer &); + + /** + * \fn operator=( const StatisticalTimer& ) + * \brief Assignment operator does not make sense for a singleton, disallow + * assignments + */ + CpuStatTimer &operator=(const CpuStatTimer &); + + friend std::ostream &operator<<(std::ostream &os, const CpuStatTimer &s); + + /** + * \fn void AddSample( const size_t id, const cl_ulong n ) + * \brief Explicitely add a timing sample into the class + */ + void AddSample(const size_t id, const cl_ulong n); + + // Calculate the average/mean of data for a given event + cl_double getMean(size_t id) const; + + // Calculate the variance of data for a given event + // Variance - average of the squared differences between data points and + //the mean + cl_double getVariance(size_t id) const; + + // Sqrt of variance, also in units of the original data + cl_double getStdDev(size_t id) const; + + /** + * \fn double getAverageTime(size_t id) const + * \return Return the arithmetic mean of all the samples that have been saved + */ + cl_double getAverageTime(size_t id) const; + + /** + * \fn double getMinimumTime(size_t id) const + * \return Return the arithmetic min of all the samples that have been saved + */ + cl_double getMinimumTime(size_t id) const; public: - /** - * \fn getInstance() - * \brief This returns a reference to the singleton timer. Guarantees only 1 timer class is ever - * instantiated within a compilable executable. - */ - static CpuStatTimer& getInstance( ); - - /** - * \fn void Start( size_t id ) - * \brief Start the timer - * \sa Stop(), Reset() - */ - void Start( size_t id ); - - /** - * \fn void Stop( size_t id ) - * \brief Stop the timer - * \sa Start(), Reset() - */ - void Stop( size_t id ); - - /** - * \fn void Reset(void) - * \brief Reset the timer to 0 - * \sa Start(), Stop() - */ - void Clear( ); - - /** - * \fn void Reset(void) - * \brief Reset the timer to 0 - * \sa Start(), Stop() - */ - void Reset( ); - - void Reserve( size_t nEvents, size_t nSamples ); - - size_t getUniqueID( const std::string& label, cl_uint groupID ); - - // Calculate the average/mean of data for a given event - void setNormalize( bool norm ); - - void Print( ); - - // Using the stdDev of the entire population (of an id), eliminate those samples that fall - // outside some specified multiple of the stdDev. This assumes that the population - // form a gaussian curve. - size_t pruneOutliers( cl_double multiple ); - std::vector< size_t > pruneOutliers( size_t id , cl_double multiple ); + /** + * \fn getInstance() + * \brief This returns a reference to the singleton timer. Guarantees only 1 + *timer class is ever instantiated within a compilable executable. + */ + static CpuStatTimer &getInstance(); + + /** + * \fn void Start( size_t id ) + * \brief Start the timer + * \sa Stop(), Reset() + */ + void Start(size_t id) override; + + /** + * \fn void Stop( size_t id ) + * \brief Stop the timer + * \sa Start(), Reset() + */ + void Stop(size_t id) override; + + /** + * \fn void Reset(void) + * \brief Reset the timer to 0 + * \sa Start(), Stop() + */ + void Clear() override; + + /** + * \fn void Reset(void) + * \brief Reset the timer to 0 + * \sa Start(), Stop() + */ + void Reset() override; + + void Reserve(size_t nEvents, size_t nSamples) override; + + size_t getUniqueID(const std::string &label, cl_uint groupID) override; + + // Calculate the average/mean of data for a given event + void setNormalize(bool norm) override; + + void Print() override; + + // Using the stdDev of the entire population (of an id), eliminate those + //samples that fall outside some specified multiple of the stdDev. This + //assumes that the population form a gaussian curve. + size_t pruneOutliers(cl_double multiple) override; + std::vector pruneOutliers(size_t id, cl_double multiple) override; }; #endif // _STATISTICALTIMER_CPU_H_ diff --git a/src/statTimer/statisticalTimer.GPU.cpp b/src/statTimer/statisticalTimer.GPU.cpp index 403178ef..959045be 100644 --- a/src/statTimer/statisticalTimer.GPU.cpp +++ b/src/statTimer/statisticalTimer.GPU.cpp @@ -14,688 +14,618 @@ * limitations under the License. * ************************************************************************/ - // StatTimer.cpp : Defines the exported functions for the DLL application. // +#include "statisticalTimer.GPU.h" +#include "../library/private.h" #include "stdafx.h" #include -#include -#include #include -#include "statisticalTimer.GPU.h" -#include "../library/private.h" +#include +#include // Format an unsigned number with comma thousands separator // -template< typename T > // T could be 32-bit or 64-bit -std::basic_string commatize (T number) -{ - static TCHAR scratch [8*sizeof(T)]; - - register TCHAR * ptr = scratch + countOf( scratch ); - *(--ptr) = 0; - - for (int digits = 3; ; ) - { - *(--ptr) = '0' + int (number % 10); - number /= 10; - if (0 == number) - break; - if (--digits <= 0) - { - *(--ptr) = ','; - digits = 3; - } - } - - return std::basic_string (ptr); +template // T could be 32-bit or 64-bit +std::basic_string commatize(T number) { + static TCHAR scratch[8 * sizeof(T)]; + + register TCHAR *ptr = scratch + countOf(scratch); + *(--ptr) = 0; + + for (int digits = 3;;) { + *(--ptr) = '0' + int(number % 10); + number /= 10; + if (0 == number) + break; + if (--digits <= 0) { + *(--ptr) = ','; + digits = 3; + } + } + + return std::basic_string(ptr); } // Functor object to help with accumulating values in vectors -template< typename T > -struct Accumulator: public std::unary_function< T, void > -{ - T acc; +template struct Accumulator : public std::unary_function { + T acc; - Accumulator( ): acc( 0 ) {} - void operator( )(T x) { acc += x; } + Accumulator() : acc(0) {} + void operator()(T x) { acc += x; } }; // Functor object to help with accumulating values in vectors -template< > -struct Accumulator< StatData > -{ - StatData acc; - - Accumulator( ) {} - void operator( )( const StatData& x ) - { - acc.deltaNanoSec += x.deltaNanoSec; - } -}; +template <> struct Accumulator { + StatData acc; + Accumulator() {} + void operator()(const StatData &x) { acc.deltaNanoSec += x.deltaNanoSec; } +}; // Unary predicate used for remove_if() algorithm -// Currently, RangeType is expected to be a floating point type, and ValType an integer type -template< typename T, typename R > -struct PruneRange: public std::binary_function< T, R, bool > -{ - R lower, upper; - - PruneRange( R mean, R stdev ): lower( mean-stdev ), upper( mean+stdev ) {} - - bool operator( )( T val ) - { - // These comparisons can be susceptible to signed/unsigned casting problems - // This is why we cast ValType to RangeType, because RangeType should always be floating and signed - if( static_cast< R >( val ) < lower ) - return true; - else if( static_cast< R >( val ) > upper ) - return true; - - return false; - } +// Currently, RangeType is expected to be a floating point type, and +//ValType an integer type +template +struct PruneRange : public std::binary_function { + R lower, upper; + + PruneRange(R mean, R stdev) : lower(mean - stdev), upper(mean + stdev) {} + + bool operator()(T val) { + // These comparisons can be susceptible to signed/unsigned casting problems + // This is why we cast ValType to RangeType, because RangeType should + //always be floating and signed + if (static_cast(val) < lower) + return true; + else if (static_cast(val) > upper) + return true; + + return false; + } }; // Template specialization for StatData datatypes -template< > -struct PruneRange< StatData, cl_double > -{ - StatData mean; - cl_double stdDev; - - PruneRange( StatData m, cl_double s ): mean( m ), stdDev( s ) {} - - bool operator( )( StatData val ) - { - // These comparisons can be susceptible to signed/unsigned casting problems - // This is why we cast ValType to RangeType, because RangeType should always be floating and signed - if( val.doubleNanoSec < (mean.doubleNanoSec - stdDev) ) - return true; - else if( val.doubleNanoSec > (mean.doubleNanoSec + stdDev) ) - return true; - - return false; - } +template <> struct PruneRange { + StatData mean; + cl_double stdDev; + + PruneRange(StatData m, cl_double s) : mean(m), stdDev(s) {} + + bool operator()(StatData val) { + // These comparisons can be susceptible to signed/unsigned casting problems + // This is why we cast ValType to RangeType, because RangeType should + //always be floating and signed + if (val.doubleNanoSec < (mean.doubleNanoSec - stdDev)) + return true; + else if (val.doubleNanoSec > (mean.doubleNanoSec + stdDev)) + return true; + + return false; + } }; // Sorting operator for struct StatData, such that it can be used in a map -bool operator<( const StatData& lhs, const StatData& rhs) -{ - if( lhs.deltaNanoSec < rhs.deltaNanoSec ) - return true; - else - return false; +bool operator<(const StatData &lhs, const StatData &rhs) { + if (lhs.deltaNanoSec < rhs.deltaNanoSec) + return true; + else + return false; } -GpuStatTimer& -GpuStatTimer::getInstance( ) -{ - static GpuStatTimer timer; - return timer; +GpuStatTimer &GpuStatTimer::getInstance() { + static GpuStatTimer timer; + return timer; } -GpuStatTimer::GpuStatTimer( ): nEvents( 0 ), nSamples( 0 ), currID( 0 ), currSample( 0 ), currRecord( 0 ) -{} +GpuStatTimer::GpuStatTimer() + : nEvents(0), nSamples(0), currID(0), currSample(0), currRecord(0) {} -GpuStatTimer::~GpuStatTimer( ) -{} +GpuStatTimer::~GpuStatTimer() {} -void -GpuStatTimer::Clear( ) -{ - labelID.clear( ); - timerData.clear( ); +void GpuStatTimer::Clear() { + labelID.clear(); + timerData.clear(); - nEvents = 0; - nSamples = 0; - currID = 0; - currSample = 0; - currRecord = 0; + nEvents = 0; + nSamples = 0; + currID = 0; + currSample = 0; + currRecord = 0; } // The caller can pre-allocate memory, to improve performance. -// nEvents is an approximate value for how many seperate events the caller will think -// they will need, and nSamples is a hint on how many samples we think we will take -// per event -void -GpuStatTimer::Reserve( size_t nE, size_t nS ) -{ - Clear( ); - nEvents = std::max< size_t >( 1, nE ); - nSamples = std::max< size_t >( 1, nS ); - - labelID.reserve( nEvents ); - timerData.resize( nEvents ); +// nEvents is an approximate value for how many seperate events the caller +//will think they will need, and nSamples is a hint on how many samples we think +//we will take per event +void GpuStatTimer::Reserve(size_t nE, size_t nS) { + Clear(); + nEvents = std::max(1, nE); + nSamples = std::max(1, nS); + + labelID.reserve(nEvents); + timerData.resize(nEvents); } -void -GpuStatTimer::Reset( ) -{ - if( nEvents == 0 || nSamples == 0 ) - throw std::runtime_error( "StatisticalTimer::Reserve( ) was not called before Reset( )" ); +void GpuStatTimer::Reset() { + if (nEvents == 0 || nSamples == 0) + throw std::runtime_error( + "StatisticalTimer::Reserve( ) was not called before Reset( )"); - ReleaseEvents(); - Reserve( nEvents, nSamples ); + ReleaseEvents(); + Reserve(nEvents, nSamples); - return; + return; } -void -GpuStatTimer::setNormalize( bool norm ) -{ -} - -void -GpuStatTimer::Start( size_t id ) -{ - currID = id; - currSample = 0; -} +void GpuStatTimer::setNormalize(bool norm) {} -void -GpuStatTimer::Stop( size_t id ) -{ - ++currRecord; +void GpuStatTimer::Start(size_t id) { + currID = id; + currSample = 0; } -void -GpuStatTimer::AddSample( clfftPlanHandle plHandle, FFTPlan* plan, cl_kernel kern, cl_uint numEvents, cl_event* ev, - const std::vector< size_t >& gWorkSize, const std::vector< size_t >& lWorkSize ) -{ - if( (numEvents != 0) && (ev == NULL) ) - return; - - if( timerData.empty( ) ) - return; - - for( size_t i = 0; i < numEvents; ++i ) - { - ::clRetainEvent(ev[i]); - } - - if( currRecord == 0 ) - { - timerData.at( currID ).push_back( StatDataVec( ) ); - timerData.at( currID ).back( ).reserve( nSamples ); - timerData.at( currID ).back( ).push_back( StatData( plHandle, plan, kern, numEvents, ev, gWorkSize, lWorkSize) ); - } - else - { - timerData.at( currID ).at( currSample ) - .push_back( StatData( plHandle, plan, kern, numEvents, ev, gWorkSize, lWorkSize ) ); - ++currSample; - } +void GpuStatTimer::Stop(size_t id) { ++currRecord; } + +void GpuStatTimer::AddSample(clfftPlanHandle plHandle, FFTPlan *plan, + cl_kernel kern, cl_uint numEvents, cl_event *ev, + const std::vector &gWorkSize, + const std::vector &lWorkSize) { + if ((numEvents != 0) && (ev == nullptr)) + return; + + if (timerData.empty()) + return; + + for (size_t i = 0; i < numEvents; ++i) { + ::clRetainEvent(ev[i]); + } + + if (currRecord == 0) { + timerData.at(currID).push_back(StatDataVec()); + timerData.at(currID).back().reserve(nSamples); + timerData.at(currID).back().push_back( + StatData(plHandle, plan, kern, numEvents, ev, gWorkSize, lWorkSize)); + } else { + timerData.at(currID) + .at(currSample) + .push_back(StatData(plHandle, plan, kern, numEvents, ev, gWorkSize, + lWorkSize)); + ++currSample; + } } -// This function's purpose is to provide a mapping from a 'friendly' human readable text string -// to an index into internal data structures. -size_t -GpuStatTimer::getUniqueID( const std::string& label, cl_uint groupID ) -{ - // I expect labelID will hardly ever grow beyond 30, so it's not of any use - // to keep this sorted and do a binary search +// This function's purpose is to provide a mapping from a 'friendly' human +//readable text string to an index into internal data structures. +size_t GpuStatTimer::getUniqueID(const std::string &label, cl_uint groupID) { + // I expect labelID will hardly ever grow beyond 30, so it's not of any use + // to keep this sorted and do a binary search - idPair sItem = std::make_pair( label, groupID ); + idPair sItem = std::make_pair(label, groupID); - idVector::iterator iter; - iter = std::find( labelID.begin(), labelID.end(), sItem ); + idVector::iterator iter; + iter = std::find(labelID.begin(), labelID.end(), sItem); - if( iter != labelID.end( ) ) - return std::distance( labelID.begin( ), iter ); + if (iter != labelID.end()) + return std::distance(labelID.begin(), iter); - labelID.push_back( sItem ); - - return labelID.size( ) - 1; + labelID.push_back(sItem); + return labelID.size() - 1; } -void GpuStatTimer::ReleaseEvents() -{ - for( cl_uint id = 0; id < labelID.size( ); ++id ) - { - for( size_t s = 0; s < timerData.at( id ).size( ); ++s ) - { - for( size_t n = 0; n < timerData.at( id ).at( s ).size( ); ++n ) - { - StatData& sd = timerData[ id ][ s ][ n ]; - - for( size_t i = 0; i < sd.outEvents.size( ); ++i ) - { - ::clReleaseEvent(sd.outEvents[ i ]); - } - - } - } - } +void GpuStatTimer::ReleaseEvents() { + for (cl_uint id = 0; id < labelID.size(); ++id) { + for (size_t s = 0; s < timerData.at(id).size(); ++s) { + for (size_t n = 0; n < timerData.at(id).at(s).size(); ++n) { + StatData &sd = timerData[id][s][n]; + + for (auto & outEvent : sd.outEvents) { + ::clReleaseEvent(outEvent); + } + } + } + } } -void GpuStatTimer::queryOpenCL( size_t id ) -{ - for( size_t s = 0; s < timerData.at( id ).size( ); ++s ) - { - for( size_t n = 0; n < timerData.at( id ).at( s ).size( ); ++n ) - { - StatData& sd = timerData[ id ][ s ][ n ]; - - cl_ulong profStart, profEnd = 0; - sd.deltaNanoSec = 0; - - for( size_t i = 0; i < sd.outEvents.size( ); ++i ) - { - if( ::clGetEventProfilingInfo( sd.outEvents[ i ], CL_PROFILING_COMMAND_START, sizeof( cl_ulong ), &profStart, NULL ) != CL_SUCCESS ) - { - profStart = 0; - } - - if( ::clGetEventProfilingInfo( sd.outEvents[ i ], CL_PROFILING_COMMAND_END, sizeof( cl_ulong ), &profEnd, NULL ) != CL_SUCCESS ) - { - profEnd = 0; - } - sd.deltaNanoSec += (profEnd - profStart); - } - - sd.doubleNanoSec = static_cast< cl_double >( sd.deltaNanoSec ); - } - } +void GpuStatTimer::queryOpenCL(size_t id) { + for (size_t s = 0; s < timerData.at(id).size(); ++s) { + for (size_t n = 0; n < timerData.at(id).at(s).size(); ++n) { + StatData &sd = timerData[id][s][n]; + + cl_ulong profStart, profEnd = 0; + sd.deltaNanoSec = 0; + + for (size_t i = 0; i < sd.outEvents.size(); ++i) { + if (::clGetEventProfilingInfo( + sd.outEvents[i], CL_PROFILING_COMMAND_START, sizeof(cl_ulong), + &profStart, nullptr) != CL_SUCCESS) { + profStart = 0; + } + + if (::clGetEventProfilingInfo(sd.outEvents[i], CL_PROFILING_COMMAND_END, + sizeof(cl_ulong), &profEnd, + nullptr) != CL_SUCCESS) { + profEnd = 0; + } + sd.deltaNanoSec += (profEnd - profStart); + } + + sd.doubleNanoSec = static_cast(sd.deltaNanoSec); + } + } } -std::vector< StatData > -GpuStatTimer::getMean( size_t id ) -{ - // Prep the data; query openCL for the timer information - queryOpenCL( id ); +std::vector GpuStatTimer::getMean(size_t id) { + // Prep the data; query openCL for the timer information + queryOpenCL(id); - std::vector< StatData > meanVec; - for( size_t s = 0; s < timerData.at( id ).size( ); ++s ) - { - Accumulator< StatData > sum = std::for_each( timerData.at( id ).at( s ).begin( ), timerData.at( id ).at( s ).end( ), - Accumulator< StatData >() ); + std::vector meanVec; + for (size_t s = 0; s < timerData.at(id).size(); ++s) { + Accumulator sum = + std::for_each(timerData.at(id).at(s).begin(), + timerData.at(id).at(s).end(), Accumulator()); - StatData tmp = timerData[ id ][ s ].front( ); - tmp.doubleNanoSec = static_cast< cl_double >( sum.acc.deltaNanoSec ) / timerData.at( id ).at( s ).size( ); - meanVec.push_back( tmp ); - } + StatData tmp = timerData[id][s].front(); + tmp.doubleNanoSec = static_cast(sum.acc.deltaNanoSec) / + timerData.at(id).at(s).size(); + meanVec.push_back(tmp); + } - return meanVec; + return meanVec; } -std::vector< StatData > -GpuStatTimer::getVariance( size_t id ) -{ - std::vector< StatData > variance = getMean( id ); - - for( cl_uint v = 0; v < variance.size( ); ++v ) - { - double sum = 0; - for( cl_uint n = 0; n < timerData[ id ][ v ].size( ); ++n ) - { - cl_double diff = static_cast< cl_double >( timerData[ id ][ v ][ n ].deltaNanoSec ) - variance[ v ].doubleNanoSec; - diff *= diff; - sum += diff; - } - - variance[ v ].doubleNanoSec = sum / timerData[ id ][ v ].size( ); - } - - return variance; +std::vector GpuStatTimer::getVariance(size_t id) { + std::vector variance = getMean(id); + + for (cl_uint v = 0; v < variance.size(); ++v) { + double sum = 0; + for (cl_uint n = 0; n < timerData[id][v].size(); ++n) { + cl_double diff = + static_cast(timerData[id][v][n].deltaNanoSec) - + variance[v].doubleNanoSec; + diff *= diff; + sum += diff; + } + + variance[v].doubleNanoSec = sum / timerData[id][v].size(); + } + + return variance; } -std::vector< StatData > -GpuStatTimer::getStdDev( size_t id ) -{ - std::vector< StatData > stddev = getVariance( id ); +std::vector GpuStatTimer::getStdDev(size_t id) { + std::vector stddev = getVariance(id); - for( cl_uint v = 0; v < stddev.size( ); ++v ) - { - stddev[ v ].doubleNanoSec = sqrt( stddev[ v ].doubleNanoSec ); - } + for (auto & v : stddev) { + v.doubleNanoSec = sqrt(v.doubleNanoSec); + } - return stddev; + return stddev; } -std::vector< StatData > -GpuStatTimer::getAverageTime( size_t id ) -{ - return getMean( id ); +std::vector GpuStatTimer::getAverageTime(size_t id) { + return getMean(id); } -std::vector< StatData > -GpuStatTimer::getMinimumTime( size_t id ) -{ - // Prep the data; query openCL for the timer information - queryOpenCL( id ); - - std::vector< StatData > minTime; - for( size_t s = 0; s < timerData.at( id ).size( ); ++s ) - { - StatDataVec::iterator iter - = std::min_element( timerData.at( id ).at( s ).begin( ), timerData.at( id ).at( s ).end( ) ); - - if( iter != timerData.at( id ).at( s ).end( ) ) - { - iter->doubleNanoSec = static_cast< cl_double >( iter->deltaNanoSec ) / timerData.at( id ).at( s ).size( ); - minTime.push_back( *iter ); - } - else - return std::vector< StatData >( ); - } - - return minTime; +std::vector GpuStatTimer::getMinimumTime(size_t id) { + // Prep the data; query openCL for the timer information + queryOpenCL(id); + + std::vector minTime; + for (auto & s : timerData.at(id)) { + auto iter = std::min_element( + s.begin(), s.end()); + + if (iter != s.end()) { + iter->doubleNanoSec = static_cast(iter->deltaNanoSec) / + s.size(); + minTime.push_back(*iter); + } else + return std::vector(); + } + + return minTime; } -std::vector< size_t > -GpuStatTimer::pruneOutliers( size_t id , cl_double multiple ) -{ - std::vector< StatData > mean = getMean( id ); - std::vector< StatData > stdDev = getStdDev( id ); +std::vector GpuStatTimer::pruneOutliers(size_t id, cl_double multiple) { + std::vector mean = getMean(id); + std::vector stdDev = getStdDev(id); - std::vector< size_t > totalPrune; - for( size_t s = 0; s < timerData.at( id ).size( ); ++s ) - { - // Look on p. 379, "The C++ Standard Library" - // std::remove_if does not actually erase, it only copies elements, it returns new 'logical' end - StatDataVec::iterator newEnd = std::remove_if( timerData.at( id ).at( s ).begin( ), timerData.at( id ).at( s ).end( ), - PruneRange< StatData,cl_double >( mean[ s ], multiple * stdDev[ s ].doubleNanoSec ) ); + std::vector totalPrune; + for (size_t s = 0; s < timerData.at(id).size(); ++s) { + // Look on p. 379, "The C++ Standard Library" + // std::remove_if does not actually erase, it only copies elements, it + //returns new 'logical' end + auto newEnd = std::remove_if( + timerData.at(id).at(s).begin(), timerData.at(id).at(s).end(), + PruneRange(mean[s], + multiple * stdDev[s].doubleNanoSec)); - StatDataVec::difference_type dist = std::distance( newEnd, timerData.at( id ).at( s ).end( ) ); + StatDataVec::difference_type dist = + std::distance(newEnd, timerData.at(id).at(s).end()); - if( dist != 0 ) - timerData.at( id ).at( s ).erase( newEnd, timerData.at( id ).at( s ).end( ) ); + if (dist != 0) + timerData.at(id).at(s).erase(newEnd, timerData.at(id).at(s).end()); - totalPrune.push_back( dist ); - } + totalPrune.push_back(dist); + } - return totalPrune; + return totalPrune; } -size_t -GpuStatTimer::pruneOutliers( cl_double multiple ) -{ - const int tableWidth = 60; - const int tableHalf = tableWidth / 2; - const int tableThird = tableWidth / 3; - const int tableFourth = tableWidth / 4; - const int tableFifth = tableWidth / 5; - - // Print label of timer, in a header - std::string header( "StdDev" ); - size_t sizeTitle = (header.size( ) + 6) /2; - - std::cout << std::endl; - std::cout << std::setfill( '=' ) << std::setw( tableHalf ) << header << " ( " << multiple << " )" - << std::setw( tableHalf - sizeTitle ) << "=" << std::endl; - tout << std::setfill( _T( ' ' ) ); - - size_t tCount = 0; - for( cl_uint l = 0; l < labelID.size( ); ++l ) - { - std::vector< size_t > lCount = pruneOutliers( l , multiple ); - - for( cl_uint c = 0; c < lCount.size( ); ++c ) - { - std::cout << labelID[l].first << "[ " << c << " ]" << ": Pruning " << lCount[ c ] << " samples out of " << currRecord << std::endl; - tCount += lCount[ c ]; - } - } - - return tCount; +size_t GpuStatTimer::pruneOutliers(cl_double multiple) { + const int tableWidth = 60; + const int tableHalf = tableWidth / 2; + const int tableThird = tableWidth / 3; + const int tableFourth = tableWidth / 4; + const int tableFifth = tableWidth / 5; + + // Print label of timer, in a header + std::string header("StdDev"); + size_t sizeTitle = (header.size() + 6) / 2; + + std::cout << std::endl; + std::cout << std::setfill('=') << std::setw(tableHalf) << header << " ( " + << multiple << " )" << std::setw(tableHalf - sizeTitle) << "=" + << std::endl; + tout << std::setfill(_T(' ')); + + size_t tCount = 0; + for (cl_uint l = 0; l < labelID.size(); ++l) { + std::vector lCount = pruneOutliers(l, multiple); + + for (cl_uint c = 0; c < lCount.size(); ++c) { + std::cout << labelID[l].first << "[ " << c << " ]" + << ": Pruning " << lCount[c] << " samples out of " << currRecord + << std::endl; + tCount += lCount[c]; + } + } + + return tCount; } -void -GpuStatTimer::Print( ) -{ - const int tableWidth = 60; - const int tableHalf = tableWidth / 2; - const int tableThird = tableWidth / 3; - const int tableFourth = tableWidth / 4; - const int tableFifth = tableWidth / 5; - - for( cl_uint id = 0; id < labelID.size( ); ++id ) - { - size_t halfString = labelID[ id ].first.size( ) / 2; - - // Print label of timer, in a header - std::cout << std::endl << std::setw( tableHalf + halfString ) << std::setfill( '=' ) << labelID[ id ].first - << std::setw( tableHalf - halfString ) << "=" << std::endl; - tout << std::setfill( _T( ' ' ) ); - - std::vector< StatData > mean = getMean( id ); - - // Print each individual dimension - tstringstream catLengths; - for( cl_uint t = 0; t < mean.size( ); ++t ) - { - cl_double time = 0; - if( mean[ t ].kernel == NULL ) - { - for( cl_uint m = 0; m < t; ++m ) - { - if( mean[ m ].plHandle == mean[ t ].planX || - mean[ m ].plHandle == mean[ t ].planY || - mean[ m ].plHandle == mean[ t ].planZ || - mean[ m ].plHandle == mean[ t ].planTX || - mean[ m ].plHandle == mean[ t ].planTY || - mean[ m ].plHandle == mean[ t ].planTZ || - mean[ m ].plHandle == mean[ t ].planRCcopy || - mean[ m ].plHandle == mean[ t ].planCopy ) - { - time += mean[ m ].doubleNanoSec; - } - } - mean[ t ].doubleNanoSec = time; - } - else - { - time = mean[ t ].doubleNanoSec; - } - double gFlops = mean[ t ].calcFlops( ) / time; - - tout << std::setw( tableFourth ) << _T( "Handle:" ) - << std::setw( tableThird ) << mean[ t ].plHandle << std::endl; - - if( mean[ t ].kernel != 0 ) - { - tout << std::setw( tableFourth ) << _T( "Kernel:" ) - << std::setw( tableThird ) << reinterpret_cast( mean[ t ].kernel ) << std::endl; - } - - if( ( mean[ t ].planX + mean[ t ].planY + mean[ t ].planZ ) > 0 || - ( mean[ t ].planTX + mean[ t ].planTY + mean[ t ].planTZ ) > 0 || - ( mean[ t ].planRCcopy + mean[ t ].planCopy ) > 0 ) - { - tout << std::setw( tableFourth ) << _T( "Child Handles:" ); - catLengths.str( _T( "" ) ); - catLengths << _T( "(" ); - if( mean[ t ].planX != 0 ) - catLengths << mean[ t ].planX; - if( mean[ t ].planTX != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planTX; - } - if( mean[ t ].planY != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planY; - } - if( mean[ t ].planTY != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planTY; - } - if( mean[ t ].planZ != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planZ; - } - if( mean[ t ].planTZ != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planTZ; - } - if( mean[ t ].planRCcopy != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planRCcopy; - } - if( mean[ t ].planCopy != 0 ) - { - catLengths << _T( "," ); - catLengths << mean[ t ].planCopy; - } - catLengths << _T( ")" ); - tout << std::setw( tableThird ) << catLengths.str( ) << std::endl; - } - - if( mean[ t ].outEvents.size( ) != 0 ) - { - tout << std::setw( tableFourth ) << _T( "OutEvents:" ) << std::setw( tableThird ); - for( size_t i = 0; i < mean[ t ].outEvents.size( ); ++i ) - { - tout << mean[ t ].outEvents[ i ]; - if( i < (mean[ t ].outEvents.size( )-1) ) - { - tout << _T( "," ) << std::endl; - tout << std::setw( tableFourth+tableThird ); - } - } - tout << std::endl; - } - - - tout << std::setw(tableFourth) << _T("Generator:"); - switch(mean[t].gen) - { - case Stockham: tout << std::setw(tableThird) << _T("Stockham"); break; - case Transpose_GCN: tout << std::setw(tableThird) << _T("Transpose_GCN"); break; - case Transpose_SQUARE: tout << std::setw(tableThird) << _T("Transpose_SQUARE"); break; - case Transpose_NONSQUARE: tout << std::setw(tableThird) << _T("Transpose_NONSQUARE"); break; - case Copy: tout << std::setw(tableThird) << _T("Copy"); break; - } - tout << std::endl; - - - tout << std::setw( tableFourth ) << _T( "Length:" ); - catLengths.str( _T( "" ) ); - catLengths << _T( "(" ); - for( size_t i = 0; i < mean[ t ].lengths.size( ); ++i ) - { - catLengths << mean[ t ].lengths.at( i ); - if( i < (mean[ t ].lengths.size( )-1) ) - catLengths << _T( "," ); - } - catLengths << _T( ")" ); - tout << std::setw( tableThird ) << catLengths.str( ) << std::endl; - - if( mean[ t ].batchSize > 1 ) - { - tout << std::setw( tableFourth ) << _T( "Batch:" ) - << std::setw( tableThird ) << mean[ t ].batchSize << std::endl; - } - - tout << std::setw(tableFourth) << _T("Placeness:") << std::setw(tableThird) - << ( mean[t].placeness == CLFFT_INPLACE ? "InPlace": "OutOfPlace" ) << std::endl; - - tout << std::setw(tableFourth) << _T("Input Dist:") << std::setw(tableThird) << mean[t].iDist << std::endl; - tout << std::setw(tableFourth) << _T("Output Dist:") << std::setw(tableThird) << mean[t].oDist << std::endl; - - tout << std::setw( tableFourth ) << _T( "Input Stride:" ); - - catLengths.str( _T( "" ) ); - catLengths << _T( "(" ); - for( size_t i = 0; i < mean[ t ].inStride.size( ); ++i ) - { - catLengths << mean[ t ].inStride.at( i ); - if( i < (mean[ t ].inStride.size( )-1) ) - catLengths << _T( "," ); - } - catLengths << _T( ")" ); - tout << std::setw( tableThird ) << catLengths.str( ) << std::endl; - - tout << std::setw( tableFourth ) << _T( "Output Stride:" ); - - catLengths.str( _T( "" ) ); - catLengths << _T( "(" ); - for( size_t i = 0; i < mean[ t ].outStride.size( ); ++i ) - { - catLengths << mean[ t ].outStride.at( i ); - if( i < (mean[ t ].outStride.size( )-1) ) - catLengths << _T( "," ); - } - catLengths << _T( ")" ); - tout << std::setw( tableThird ) << catLengths.str( ) << std::endl; - - if( mean[ t ].enqueueWorkSize.size( ) != 0 ) - { - tout << std::setw( tableFourth ) << _T( "Global Work:" ); - catLengths.str( _T( "" ) ); - catLengths << _T( "(" ); - for( size_t i = 0; i < mean[ t ].enqueueWorkSize.size( ); ++i ) - { - catLengths << mean[ t ].enqueueWorkSize.at( i ); - if( i < (mean[ t ].enqueueWorkSize.size( )-1) ) - catLengths << _T( "," ); - } - catLengths << _T( ")" ); - tout << std::setw( tableThird ) << catLengths.str( ) << std::endl; - - tout << std::setw(tableFourth) << _T("Local Work:"); - catLengths.str(_T("")); - catLengths << _T("("); - for (size_t i = 0; i < mean[t].enqueueLocalWorkSize.size(); ++i) - { - catLengths << mean[t].enqueueLocalWorkSize.at(i); - if (i < (mean[t].enqueueLocalWorkSize.size() - 1)) - catLengths << _T(","); - } - catLengths << _T(")"); - tout << std::setw(tableThird) << catLengths.str() << std::endl; - } - - tout << std::setw( tableFourth ) << _T( "Gflops:" ) - << std::setw( 2*tableFourth ) << gFlops << std::endl; - tout << std::setw( tableFourth ) << _T( "Time (ns):" ) - << std::setw( 3*tableFourth ) << commatize( static_cast< cl_ulong >( time ) ) << std::endl; - tout << std::endl; - } - } +void GpuStatTimer::Print() { + const int tableWidth = 60; + const int tableHalf = tableWidth / 2; + const int tableThird = tableWidth / 3; + const int tableFourth = tableWidth / 4; + const int tableFifth = tableWidth / 5; + + for (cl_uint id = 0; id < labelID.size(); ++id) { + size_t halfString = labelID[id].first.size() / 2; + + // Print label of timer, in a header + std::cout << std::endl + << std::setw(tableHalf + halfString) << std::setfill('=') + << labelID[id].first << std::setw(tableHalf - halfString) << "=" + << std::endl; + tout << std::setfill(_T(' ')); + + std::vector mean = getMean(id); + + // Print each individual dimension + tstringstream catLengths; + for (cl_uint t = 0; t < mean.size(); ++t) { + cl_double time = 0; + if (mean[t].kernel == nullptr) { + for (cl_uint m = 0; m < t; ++m) { + if (mean[m].plHandle == mean[t].planX || + mean[m].plHandle == mean[t].planY || + mean[m].plHandle == mean[t].planZ || + mean[m].plHandle == mean[t].planTX || + mean[m].plHandle == mean[t].planTY || + mean[m].plHandle == mean[t].planTZ || + mean[m].plHandle == mean[t].planRCcopy || + mean[m].plHandle == mean[t].planCopy) { + time += mean[m].doubleNanoSec; + } + } + mean[t].doubleNanoSec = time; + } else { + time = mean[t].doubleNanoSec; + } + double gFlops = mean[t].calcFlops() / time; + + tout << std::setw(tableFourth) << _T( "Handle:" ) << std::setw(tableThird) + << mean[t].plHandle << std::endl; + + if (mean[t].kernel != nullptr) { + tout << std::setw(tableFourth) << _T( "Kernel:" ) + << std::setw(tableThird) + << reinterpret_cast(mean[t].kernel) << std::endl; + } + + if ((mean[t].planX + mean[t].planY + mean[t].planZ) > 0 || + (mean[t].planTX + mean[t].planTY + mean[t].planTZ) > 0 || + (mean[t].planRCcopy + mean[t].planCopy) > 0) { + tout << std::setw(tableFourth) << _T( "Child Handles:" ); + catLengths.str(_T( "" )); + catLengths << _T( "(" ); + if (mean[t].planX != 0) + catLengths << mean[t].planX; + if (mean[t].planTX != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planTX; + } + if (mean[t].planY != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planY; + } + if (mean[t].planTY != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planTY; + } + if (mean[t].planZ != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planZ; + } + if (mean[t].planTZ != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planTZ; + } + if (mean[t].planRCcopy != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planRCcopy; + } + if (mean[t].planCopy != 0) { + catLengths << _T( "," ); + catLengths << mean[t].planCopy; + } + catLengths << _T( ")" ); + tout << std::setw(tableThird) << catLengths.str() << std::endl; + } + + if (mean[t].outEvents.size() != 0) { + tout << std::setw(tableFourth) << _T( "OutEvents:" ) + << std::setw(tableThird); + for (size_t i = 0; i < mean[t].outEvents.size(); ++i) { + tout << mean[t].outEvents[i]; + if (i < (mean[t].outEvents.size() - 1)) { + tout << _T( "," ) << std::endl; + tout << std::setw(tableFourth + tableThird); + } + } + tout << std::endl; + } + + tout << std::setw(tableFourth) << _T("Generator:"); + switch (mean[t].gen) { + case Stockham: + tout << std::setw(tableThird) << _T("Stockham"); + break; + case Transpose_GCN: + tout << std::setw(tableThird) << _T("Transpose_GCN"); + break; + case Transpose_SQUARE: + tout << std::setw(tableThird) << _T("Transpose_SQUARE"); + break; + case Transpose_NONSQUARE: + tout << std::setw(tableThird) << _T("Transpose_NONSQUARE"); + break; + case Copy: + tout << std::setw(tableThird) << _T("Copy"); + break; + } + tout << std::endl; + + tout << std::setw(tableFourth) << _T( "Length:" ); + catLengths.str(_T( "" )); + catLengths << _T( "(" ); + for (size_t i = 0; i < mean[t].lengths.size(); ++i) { + catLengths << mean[t].lengths.at(i); + if (i < (mean[t].lengths.size() - 1)) + catLengths << _T( "," ); + } + catLengths << _T( ")" ); + tout << std::setw(tableThird) << catLengths.str() << std::endl; + + if (mean[t].batchSize > 1) { + tout << std::setw(tableFourth) << _T( "Batch:" ) + << std::setw(tableThird) << mean[t].batchSize << std::endl; + } + + tout << std::setw(tableFourth) << _T("Placeness:") + << std::setw(tableThird) + << (mean[t].placeness == CLFFT_INPLACE ? "InPlace" : "OutOfPlace") + << std::endl; + + tout << std::setw(tableFourth) << _T("Input Dist:") + << std::setw(tableThird) << mean[t].iDist << std::endl; + tout << std::setw(tableFourth) << _T("Output Dist:") + << std::setw(tableThird) << mean[t].oDist << std::endl; + + tout << std::setw(tableFourth) << _T( "Input Stride:" ); + + catLengths.str(_T( "" )); + catLengths << _T( "(" ); + for (size_t i = 0; i < mean[t].inStride.size(); ++i) { + catLengths << mean[t].inStride.at(i); + if (i < (mean[t].inStride.size() - 1)) + catLengths << _T( "," ); + } + catLengths << _T( ")" ); + tout << std::setw(tableThird) << catLengths.str() << std::endl; + + tout << std::setw(tableFourth) << _T( "Output Stride:" ); + + catLengths.str(_T( "" )); + catLengths << _T( "(" ); + for (size_t i = 0; i < mean[t].outStride.size(); ++i) { + catLengths << mean[t].outStride.at(i); + if (i < (mean[t].outStride.size() - 1)) + catLengths << _T( "," ); + } + catLengths << _T( ")" ); + tout << std::setw(tableThird) << catLengths.str() << std::endl; + + if (mean[t].enqueueWorkSize.size() != 0) { + tout << std::setw(tableFourth) << _T( "Global Work:" ); + catLengths.str(_T( "" )); + catLengths << _T( "(" ); + for (size_t i = 0; i < mean[t].enqueueWorkSize.size(); ++i) { + catLengths << mean[t].enqueueWorkSize.at(i); + if (i < (mean[t].enqueueWorkSize.size() - 1)) + catLengths << _T( "," ); + } + catLengths << _T( ")" ); + tout << std::setw(tableThird) << catLengths.str() << std::endl; + + tout << std::setw(tableFourth) << _T("Local Work:"); + catLengths.str(_T("")); + catLengths << _T("("); + for (size_t i = 0; i < mean[t].enqueueLocalWorkSize.size(); ++i) { + catLengths << mean[t].enqueueLocalWorkSize.at(i); + if (i < (mean[t].enqueueLocalWorkSize.size() - 1)) + catLengths << _T(","); + } + catLengths << _T(")"); + tout << std::setw(tableThird) << catLengths.str() << std::endl; + } + + tout << std::setw(tableFourth) << _T( "Gflops:" ) + << std::setw(2 * tableFourth) << gFlops << std::endl; + tout << std::setw(tableFourth) << _T( "Time (ns):" ) + << std::setw(3 * tableFourth) + << commatize(static_cast(time)) << std::endl; + tout << std::endl; + } + } } // Defining an output print operator -std::ostream& -operator<<( std::ostream& os, const GpuStatTimer& st ) -{ - //if( st.clkTicks.empty( ) ) - // return os; +std::ostream &operator<<(std::ostream &os, const GpuStatTimer &st) { + // if( st.clkTicks.empty( ) ) + // return os; - //std::ios::fmtflags bckup = os.flags( ); + // std::ios::fmtflags bckup = os.flags( ); - //for( cl_uint l = 0; l < st.labelID.size( ); ++l ) - //{ - // cl_ulong min = 0; - // clkVector::const_iterator iter = std::min_element( st.clkTicks.at( l ).begin( ), st.clkTicks.at( l ).end( ) ); + // for( cl_uint l = 0; l < st.labelID.size( ); ++l ) + //{ + // cl_ulong min = 0; + // clkVector::const_iterator iter = std::min_element( st.clkTicks.at( l + //).begin( ), st.clkTicks.at( l ).end( ) ); - // if( iter != st.clkTicks.at( l ).end( ) ) - // min = *iter; + // if( iter != st.clkTicks.at( l ).end( ) ) + // min = *iter; - // os << st.labelID[l].first << ", " << st.labelID[l].second << std::fixed << std::endl; - // os << "Min:," << min << std::endl; - // os << "Mean:," << st.getMean( l ) << std::endl; - // os << "StdDev:," << st.getStdDev( l ) << std::endl; - // os << "AvgTime:," << st.getAverageTime( l ) << std::endl; - // os << "MinTime:," << st.getMinimumTime( l ) << std::endl; + // os << st.labelID[l].first << ", " << st.labelID[l].second << std::fixed + //<< std::endl; os << "Min:," << min << std::endl; os << "Mean:," << + //st.getMean( l ) << std::endl; os << "StdDev:," << st.getStdDev( l ) << + //std::endl; os << "AvgTime:," << st.getAverageTime( l ) << std::endl; os << + //"MinTime:," << st.getMinimumTime( l ) << std::endl; - // //for( cl_uint t = 0; t < st.clkTicks[l].size( ); ++t ) - // //{ - // // os << st.clkTicks[l][t]<< ","; - // //} - // os << "\n" << std::endl; + // //for( cl_uint t = 0; t < st.clkTicks[l].size( ); ++t ) + // //{ + // // os << st.clkTicks[l][t]<< ","; + // //} + // os << "\n" << std::endl; - //} + //} - //os.flags( bckup ); + // os.flags( bckup ); - return os; + return os; } diff --git a/src/statTimer/statisticalTimer.GPU.h b/src/statTimer/statisticalTimer.GPU.h index 5b65ffc5..23992d3c 100644 --- a/src/statTimer/statisticalTimer.GPU.h +++ b/src/statTimer/statisticalTimer.GPU.h @@ -14,243 +14,242 @@ * limitations under the License. * ************************************************************************/ - #pragma once #ifndef _STATISTICALTIMER_GPU_H_ #define _STATISTICALTIMER_GPU_H_ -#include -#include +#include "../library/plan.h" +#include "statisticalTimer.h" #include #include -#include "statisticalTimer.h" -#include "../library/plan.h" +#include +#include /** * \file clfft.StatisticalTimer.GPU.h * \brief A timer class that provides a cross platform timer for use * in timing code progress with a high degree of accuracy. - * This class is implemented entirely in the header, to facilitate inclusion into multiple - * projects without needing to compile an object file for each project. + * This class is implemented entirely in the header, to facilitate + *inclusion into multiple projects without needing to compile an object file for + *each project. */ -struct StatData -{ - cl_kernel kernel; - cl_ulong deltaNanoSec; - double doubleNanoSec; - size_t batchSize; - clfftDim dim; - clfftPlanHandle plHandle; - clfftPlanHandle planX; - clfftPlanHandle planY; - clfftPlanHandle planZ; - clfftPlanHandle planTX; - clfftPlanHandle planTY; - clfftPlanHandle planTZ; - - clfftPlanHandle planRCcopy; - clfftPlanHandle planCopy; - - clfftGenerators gen; - - std::vector< size_t > lengths; - std::vector< size_t > inStride; - std::vector< size_t > outStride; - size_t iDist; - size_t oDist; - clfftResultLocation placeness; - std::vector< size_t > enqueueLocalWorkSize; - std::vector< size_t > enqueueWorkSize; - std::vector< cl_event > outEvents; - - StatData( ): deltaNanoSec( 0 ) - {} - - StatData( clfftPlanHandle id, FFTPlan* plan, cl_kernel kern, cl_uint nEv, cl_event* Ev, - const std::vector< size_t >& gWorkSize, const std::vector< size_t >& lWorkSize): - deltaNanoSec( 0 ), kernel( kern ), batchSize( plan->batchsize ), dim( plan->dim ), - plHandle( id ), planX( plan->planX ), planY( plan->planY ), planZ( plan->planZ ), - planTX( plan->planTX ), planTY( plan->planTY ), planTZ( plan->planTZ ), - planRCcopy( plan->planRCcopy ), planCopy( plan->planCopy ), gen(plan->gen), - inStride( plan->inStride ), outStride( plan->outStride ), iDist( plan->iDist ), oDist( plan->oDist ), - lengths( plan->length ), enqueueWorkSize( gWorkSize ), enqueueLocalWorkSize( lWorkSize ), placeness( plan->placeness ) - { - for( cl_uint e = 0; e < nEv; ++e ) - { - outEvents.push_back( Ev[ e ] ); - } - } - - double calcFlops( ) - { - size_t fftLength = 0; - size_t dimIndex = 0; - - if( dim == CLFFT_1D ) - { - fftLength = lengths.at( 0 ); - dimIndex = 1; - } - else if( dim == CLFFT_2D ) - { - fftLength = lengths.at( 0 ) * lengths.at( 1 ); - dimIndex = 2; - } - else if( dim == CLFFT_3D ) - { - fftLength = lengths.at( 0 ) * lengths.at( 1 ) * lengths.at( 2 ); - dimIndex = 3; - } - - size_t cumulativeBatch = 1; - for( ; dimIndex < lengths.size(); ++dimIndex ) - { - cumulativeBatch *= std::max< size_t >( 1, lengths[ dimIndex ] ); - } - cumulativeBatch *= batchSize; - - double flops = cumulativeBatch * 5 * fftLength * ( log( static_cast< double >( fftLength ) ) / log( 2.0 ) ); - - return flops; - } - +struct StatData { + cl_kernel kernel; + cl_ulong deltaNanoSec; + double doubleNanoSec; + size_t batchSize; + clfftDim dim; + clfftPlanHandle plHandle; + clfftPlanHandle planX; + clfftPlanHandle planY; + clfftPlanHandle planZ; + clfftPlanHandle planTX; + clfftPlanHandle planTY; + clfftPlanHandle planTZ; + + clfftPlanHandle planRCcopy; + clfftPlanHandle planCopy; + + clfftGenerators gen; + + std::vector lengths; + std::vector inStride; + std::vector outStride; + size_t iDist; + size_t oDist; + clfftResultLocation placeness; + std::vector enqueueLocalWorkSize; + std::vector enqueueWorkSize; + std::vector outEvents; + + StatData() : deltaNanoSec(0) {} + + StatData(clfftPlanHandle id, FFTPlan *plan, cl_kernel kern, cl_uint nEv, + cl_event *Ev, const std::vector &gWorkSize, + const std::vector &lWorkSize) + : deltaNanoSec(0), kernel(kern), batchSize(plan->batchsize), + dim(plan->dim), plHandle(id), planX(plan->planX), planY(plan->planY), + planZ(plan->planZ), planTX(plan->planTX), planTY(plan->planTY), + planTZ(plan->planTZ), planRCcopy(plan->planRCcopy), + planCopy(plan->planCopy), gen(plan->gen), inStride(plan->inStride), + outStride(plan->outStride), iDist(plan->iDist), oDist(plan->oDist), + lengths(plan->length), enqueueWorkSize(gWorkSize), + enqueueLocalWorkSize(lWorkSize), placeness(plan->placeness) { + for (cl_uint e = 0; e < nEv; ++e) { + outEvents.push_back(Ev[e]); + } + } + + double calcFlops() { + size_t fftLength = 0; + size_t dimIndex = 0; + + if (dim == CLFFT_1D) { + fftLength = lengths.at(0); + dimIndex = 1; + } else if (dim == CLFFT_2D) { + fftLength = lengths.at(0) * lengths.at(1); + dimIndex = 2; + } else if (dim == CLFFT_3D) { + fftLength = lengths.at(0) * lengths.at(1) * lengths.at(2); + dimIndex = 3; + } + + size_t cumulativeBatch = 1; + for (; dimIndex < lengths.size(); ++dimIndex) { + cumulativeBatch *= std::max(1, lengths[dimIndex]); + } + cumulativeBatch *= batchSize; + + double flops = cumulativeBatch * 5 * fftLength * + (log(static_cast(fftLength)) / log(2.0)); + + return flops; + } }; // Sorting operator for struct StatData, such that it can be used in a map -bool operator<( const StatData& lhs, const StatData& rhs); - -class GpuStatTimer : public baseStatTimer -{ - // Typedefs to handle the data that we store - typedef std::vector< StatData > StatDataVec; - typedef std::vector< StatDataVec > PerEnqueueVec; - - // In order to calculate statistics , we need to keep a history of our timings - std::vector< PerEnqueueVec > timerData; - - // Typedefs to handle the identifiers we use for our timers - typedef std::pair< std::string, cl_uint > idPair; - typedef std::vector< idPair > idVector; - idVector labelID; - - // Between each Start/Stop pair, we need to count how many AddSamples were made. - size_t currSample, currRecord; - - // Saved sizes for our vectors, used in Reset() to reallocate vectors - StatDataVec::size_type nEvents, nSamples; - size_t currID; - - /** - * \fn GpuStatTimer() - * \brief Constructor for StatisticalTimer that initializes the class - * This is private so that user code cannot create their own instantiation. Instead, you - * must go through getInstance( ) to get a reference to the class. - */ - GpuStatTimer( ); - - /** - * \fn ~GpuStatTimer() - * \brief Destructor for StatisticalTimer that cleans up the class - */ - ~GpuStatTimer( ); - - /** - * \fn GpuStatTimer(const StatisticalTimer& ) - * \brief Copy constructors do not make sense for a singleton, disallow copies - */ - GpuStatTimer( const GpuStatTimer& ); - - /** - * \fn operator=( const StatisticalTimer& ) - * \brief Assignment operator does not make sense for a singleton, disallow assignments - */ - GpuStatTimer& operator=( const GpuStatTimer& ); - - friend std::ostream& operator<<( std::ostream& os, const GpuStatTimer& s ); - - // Calculate the average/mean of data for a given event - std::vector< StatData > getMean( size_t id ); - - // Calculate the variance of data for a given event - // Variance - average of the squared differences between data points and the mean - std::vector< StatData > getVariance( size_t id ); - - // Sqrt of variance, also in units of the original data - std::vector< StatData > getStdDev( size_t id ); - - /** - * \fn double getAverageTime(size_t id) const - * \return Return the arithmetic mean of all the samples that have been saved - */ - std::vector< StatData > getAverageTime( size_t id ); - - /** - * \fn double getMinimumTime(size_t id) const - * \return Return the arithmetic min of all the samples that have been saved - */ - std::vector< StatData > getMinimumTime( size_t id ); - - void queryOpenCL( size_t id ); - - void ReleaseEvents(); +bool operator<(const StatData &lhs, const StatData &rhs); + +class GpuStatTimer : public baseStatTimer { + // Typedefs to handle the data that we store + typedef std::vector StatDataVec; + typedef std::vector PerEnqueueVec; + + // In order to calculate statistics , we need to keep a history + //of our timings + std::vector timerData; + + // Typedefs to handle the identifiers we use for our timers + typedef std::pair idPair; + typedef std::vector idVector; + idVector labelID; + + // Between each Start/Stop pair, we need to count how many AddSamples were + //made. + size_t currSample, currRecord; + + // Saved sizes for our vectors, used in Reset() to reallocate vectors + StatDataVec::size_type nEvents, nSamples; + size_t currID; + + /** + * \fn GpuStatTimer() + * \brief Constructor for StatisticalTimer that initializes the class + * This is private so that user code cannot create their own instantiation. + *Instead, you must go through getInstance( ) to get a reference to the class. + */ + GpuStatTimer(); + + /** + * \fn ~GpuStatTimer() + * \brief Destructor for StatisticalTimer that cleans up the class + */ + ~GpuStatTimer() override ; + + /** + * \fn GpuStatTimer(const StatisticalTimer& ) + * \brief Copy constructors do not make sense for a singleton, disallow copies + */ + GpuStatTimer(const GpuStatTimer &); + + /** + * \fn operator=( const StatisticalTimer& ) + * \brief Assignment operator does not make sense for a singleton, disallow + * assignments + */ + GpuStatTimer &operator=(const GpuStatTimer &); + + friend std::ostream &operator<<(std::ostream &os, const GpuStatTimer &s); + + // Calculate the average/mean of data for a given event + std::vector getMean(size_t id); + + // Calculate the variance of data for a given event + // Variance - average of the squared differences between data points and + //the mean + std::vector getVariance(size_t id); + + // Sqrt of variance, also in units of the original data + std::vector getStdDev(size_t id); + + /** + * \fn double getAverageTime(size_t id) const + * \return Return the arithmetic mean of all the samples that have been saved + */ + std::vector getAverageTime(size_t id); + + /** + * \fn double getMinimumTime(size_t id) const + * \return Return the arithmetic min of all the samples that have been saved + */ + std::vector getMinimumTime(size_t id); + + void queryOpenCL(size_t id); + + void ReleaseEvents(); public: - /** - * \fn getInstance() - * \brief This returns a reference to the singleton timer. Guarantees only 1 timer class is ever - * instantiated within a compilable executable. - */ - static GpuStatTimer& getInstance( ); - - /** - * \fn void Start( size_t id ) - * \brief Start the timer - * \sa Stop(), Reset() - */ - void Start( size_t id ); - - /** - * \fn void Stop( size_t id ) - * \brief Stop the timer - * \sa Start(), Reset() - */ - void Stop( size_t id ); - - /** - * \fn void AddSample( const cl_event ev ) - * \brief Explicitely add a timing sample into the class - */ - virtual void AddSample( clfftPlanHandle plHandle, FFTPlan* plan, cl_kernel kern, cl_uint numQueuesAndEvents, cl_event* ev, - const std::vector< size_t >& gWorkSize, const std::vector< size_t >& lWorkSize ); - - /** - * \fn void Reset(void) - * \brief Reset the timer to 0 - * \sa Start(), Stop() - */ - void Clear( ); - - /** - * \fn void Reset(void) - * \brief Reset the timer to 0 - * \sa Start(), Stop() - */ - void Reset( ); - - void Reserve( size_t nEvents, size_t nSamples ); - - size_t getUniqueID( const std::string& label, cl_uint groupID ); - - // Calculate the average/mean of data for a given event - void setNormalize( bool norm ); - - void Print( ); - - // Using the stdDev of the entire population (of an id), eliminate those samples that fall - // outside some specified multiple of the stdDev. This assumes that the population - // form a gaussian curve. - size_t pruneOutliers( cl_double multiple ); - std::vector< size_t > pruneOutliers( size_t id , cl_double multiple ); + /** + * \fn getInstance() + * \brief This returns a reference to the singleton timer. Guarantees only 1 + *timer class is ever instantiated within a compilable executable. + */ + static GpuStatTimer &getInstance(); + + /** + * \fn void Start( size_t id ) + * \brief Start the timer + * \sa Stop(), Reset() + */ + void Start(size_t id) override ; + + /** + * \fn void Stop( size_t id ) + * \brief Stop the timer + * \sa Start(), Reset() + */ + void Stop(size_t id) override ; + + /** + * \fn void AddSample( const cl_event ev ) + * \brief Explicitely add a timing sample into the class + */ + virtual void AddSample(clfftPlanHandle plHandle, FFTPlan *plan, + cl_kernel kern, cl_uint numQueuesAndEvents, + cl_event *ev, const std::vector &gWorkSize, + const std::vector &lWorkSize); + + /** + * \fn void Reset(void) + * \brief Reset the timer to 0 + * \sa Start(), Stop() + */ + void Clear() override ; + + /** + * \fn void Reset(void) + * \brief Reset the timer to 0 + * \sa Start(), Stop() + */ + void Reset() override ; + + void Reserve(size_t nEvents, size_t nSamples) override ; + + size_t getUniqueID(const std::string &label, + cl_uint groupID) override ; + + // Calculate the average/mean of data for a given event + void setNormalize(bool norm) override ; + + void Print() override ; + + // Using the stdDev of the entire population (of an id), eliminate those + //samples that fall outside some specified multiple of the stdDev. This + //assumes that the population form a gaussian curve. + size_t pruneOutliers(cl_double multiple) override ; + std::vector pruneOutliers(size_t id, + cl_double multiple) override ; }; #endif // _STATISTICALTIMER_GPU_H_ diff --git a/src/statTimer/statisticalTimer.extern.cpp b/src/statTimer/statisticalTimer.extern.cpp index 3af90a7c..0501041d 100644 --- a/src/statTimer/statisticalTimer.extern.cpp +++ b/src/statTimer/statisticalTimer.extern.cpp @@ -14,22 +14,21 @@ * limitations under the License. * ************************************************************************/ - // StatTimer.cpp : Defines the exported functions for the DLL application. // -#include "stdafx.h" #include "statisticalTimer.extern.h" #include "statisticalTimer.CPU.h" #include "statisticalTimer.GPU.h" +#include "stdafx.h" -// Even though the individual getInstance functions of the timer classes return references, -// we convert those to pointers before returning from here so that the clients can initialize -// their local variables to NULL, which refernces do not allow. -baseStatTimer* getStatTimer( const clfftTimerType type ) -{ - if( type == CLFFT_CPU ) - return &CpuStatTimer::getInstance( ); +// Even though the individual getInstance functions of the timer classes +//return references, we convert those to pointers before returning from here so +//that the clients can initialize their local variables to NULL, which refernces +//do not allow. +baseStatTimer *getStatTimer(const clfftTimerType type) { + if (type == CLFFT_CPU) + return &CpuStatTimer::getInstance(); - return &GpuStatTimer::getInstance( ); + return &GpuStatTimer::getInstance(); } diff --git a/src/statTimer/statisticalTimer.extern.h b/src/statTimer/statisticalTimer.extern.h index 84999d65..6b8350e1 100644 --- a/src/statTimer/statisticalTimer.extern.h +++ b/src/statTimer/statisticalTimer.extern.h @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - #pragma once #ifndef _STATISTICALTIMER_EXTERN_H_ #define _STATISTICALTIMER_EXTERN_H_ @@ -25,49 +24,51 @@ * \file clfft.StatisticalTimer.extern.h * \brief A timer class that provides a cross platform timer for use * in timing code progress with a high degree of accuracy. - * This class is implemented entirely in the header, to facilitate inclusion into multiple - * projects without needing to compile an object file for each project. + * This class is implemented entirely in the header, to facilitate + *inclusion into multiple projects without needing to compile an object file for + *each project. */ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the STATTIMER_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// STATTIMER_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. -#if defined( _WIN32 ) - #if !defined( __cplusplus ) - #define inline __inline - #endif +// The following ifdef block is the standard way of creating macros which make +// exporting from a DLL simpler. All files within this DLL are compiled with the +// STATTIMER_EXPORTS symbol defined on the command line. this symbol should not +// be defined on any project that uses this DLL. This way any other project +// whose source files include this file see STATTIMER_API functions as being +// imported from a DLL, whereas this DLL sees symbols defined with this macro as +// being exported. +#if defined(_WIN32) +#if !defined(__cplusplus) +#define inline __inline +#endif - #if defined( CLFFT_STATIC ) - #define STATTIMER_API - #elif defined( STATTIMER_EXPORTS ) - #define STATTIMER_API __declspec( dllexport ) - #else - #define STATTIMER_API __declspec( dllimport ) - #endif +#if defined(CLFFT_STATIC) +#define STATTIMER_API +#elif defined(STATTIMER_EXPORTS) +#define STATTIMER_API __declspec(dllexport) +#else +#define STATTIMER_API __declspec(dllimport) +#endif #else - #define STATTIMER_API +#define STATTIMER_API #endif // The type of timer to be returned from ::getStatTimer( ) -typedef enum clfftTimerType_ -{ - CLFFT_GPU = 1, - CLFFT_CPU, +typedef enum clfftTimerType_ { + CLFFT_GPU = 1, + CLFFT_CPU, } clfftTimerType; -// Table of typedef definitions for all exported functions from this shared module. -// Clients of this module can use these typedefs to help create function pointers -// that can be initialized to point to the functions exported from this module. -typedef baseStatTimer* (*PFGETSTATTIMER)( const clfftTimerType type ); +// Table of typedef definitions for all exported functions from this shared +//module. Clients of this module can use these typedefs to help create function +//pointers that can be initialized to point to the functions exported from this +//module. +typedef baseStatTimer *(*PFGETSTATTIMER)(const clfftTimerType type); - /** - * \fn getInstance() - * \brief This returns a reference to the singleton timer. Guarantees only 1 timer class is ever - * instantiated within a compilable executable. - */ -extern "C" STATTIMER_API baseStatTimer* getStatTimer( const clfftTimerType type ); +/** + * \fn getInstance() + * \brief This returns a reference to the singleton timer. Guarantees only 1 + *timer class is ever instantiated within a compilable executable. + */ +extern "C" STATTIMER_API baseStatTimer *getStatTimer(const clfftTimerType type); #endif // _STATISTICALTIMER_EXTERN_H_ diff --git a/src/statTimer/statisticalTimer.h b/src/statTimer/statisticalTimer.h index 58c03b70..ef9b1d9a 100644 --- a/src/statTimer/statisticalTimer.h +++ b/src/statTimer/statisticalTimer.h @@ -14,13 +14,12 @@ * limitations under the License. * ************************************************************************/ - #pragma once #ifndef _STATISTICALTIMER_H_ #define _STATISTICALTIMER_H_ -#include #include #include +#include #include "../include/clFFT.h" @@ -28,18 +27,18 @@ * \file clfft.StatisticalTimer.h * \brief A timer class that provides a cross platform timer for use * in timing code progress with a high degree of accuracy. - * This class is implemented entirely in the header, to facilitate inclusion into multiple - * projects without needing to compile an object file for each project. + * This class is implemented entirely in the header, to facilitate + *inclusion into multiple projects without needing to compile an object file for + *each project. */ -// Definition of a functor object that is passed by reference into the Print statement -// of the timing class. -// Functor object to help with accumulating values in vectors -template< typename A, typename R > -class flopsFunc: public std::unary_function< A, R > -{ +// Definition of a functor object that is passed by reference into the +//Print statement of the timing class. Functor object to help with accumulating +//values in vectors +template +class flopsFunc : public std::unary_function { public: - virtual typename std::unary_function::result_type operator( )( ) = 0; + virtual typename std::unary_function::result_type operator()() = 0; }; /** @@ -47,60 +46,60 @@ class flopsFunc: public std::unary_function< A, R > * \brief Counter that provides a fairly accurate timing mechanism for both * windows and linux. This timer is used extensively in all the samples. */ -class baseStatTimer -{ +class baseStatTimer { protected: - /** - * \fn ~baseStatTimer() - * \brief Destructor for StatisticalTimer that cleans up the class - */ - virtual ~baseStatTimer( ){ }; + /** + * \fn ~baseStatTimer() + * \brief Destructor for StatisticalTimer that cleans up the class + */ + virtual ~baseStatTimer(){}; -// friend std::ostream& operator<<( std::ostream& os, const baseStatTimer& s ); + // friend std::ostream& operator<<( std::ostream& os, const baseStatTimer& + //s ); public: - /** - * \fn void Start( sTimerID id ) - * \brief Start the timer - * \sa Stop(), Reset() - */ - virtual void Start( size_t id ) = 0; - - /** - * \fn void Stop( size_t id ) - * \brief Stop the timer - * \sa Start(), Reset() - */ - virtual void Stop( size_t id ) = 0; - - /** - * \fn void Reset(void) - * \brief Reset the timer to 0 - * \sa Start(), Stop() - */ - virtual void Clear( ) = 0; - - /** - * \fn void Reset(void) - * \brief Reset the timer to 0 - * \sa Start(), Stop() - */ - virtual void Reset( ) = 0; - - virtual void Reserve( size_t nEvents, size_t nSamples ) = 0; - - virtual size_t getUniqueID( const std::string& label, cl_uint groupID ) = 0; - - // Calculate the average/mean of data for a given event - virtual void setNormalize( bool norm ) = 0; - - virtual void Print( ) = 0; - - // Using the stdDev of the entire population (of an id), eliminate those samples that fall - // outside some specified multiple of the stdDev. This assumes that the population - // form a gaussian curve. - virtual size_t pruneOutliers( cl_double multiple ) = 0; - virtual std::vector< size_t > pruneOutliers( size_t id , cl_double multiple ) = 0; + /** + * \fn void Start( sTimerID id ) + * \brief Start the timer + * \sa Stop(), Reset() + */ + virtual void Start(size_t id) = 0; + + /** + * \fn void Stop( size_t id ) + * \brief Stop the timer + * \sa Start(), Reset() + */ + virtual void Stop(size_t id) = 0; + + /** + * \fn void Reset(void) + * \brief Reset the timer to 0 + * \sa Start(), Stop() + */ + virtual void Clear() = 0; + + /** + * \fn void Reset(void) + * \brief Reset the timer to 0 + * \sa Start(), Stop() + */ + virtual void Reset() = 0; + + virtual void Reserve(size_t nEvents, size_t nSamples) = 0; + + virtual size_t getUniqueID(const std::string &label, cl_uint groupID) = 0; + + // Calculate the average/mean of data for a given event + virtual void setNormalize(bool norm) = 0; + + virtual void Print() = 0; + + // Using the stdDev of the entire population (of an id), eliminate those + //samples that fall outside some specified multiple of the stdDev. This + //assumes that the population form a gaussian curve. + virtual size_t pruneOutliers(cl_double multiple) = 0; + virtual std::vector pruneOutliers(size_t id, cl_double multiple) = 0; }; #endif // _STATISTICALTIMER_H_ diff --git a/src/statTimer/stdafx.cpp b/src/statTimer/stdafx.cpp index d87a55d8..3186bb85 100644 --- a/src/statTimer/stdafx.cpp +++ b/src/statTimer/stdafx.cpp @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - // stdafx.cpp : source file that includes just the standard includes // clfft.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information diff --git a/src/statTimer/stdafx.h b/src/statTimer/stdafx.h index 774fef75..99296432 100644 --- a/src/statTimer/stdafx.h +++ b/src/statTimer/stdafx.h @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently @@ -33,19 +32,19 @@ #include //#include //#include -#include +#include //#include // _WIN32 is defined for both 32 & 64 bit environments -#if defined( _WIN32 ) +#if defined(_WIN32) // #include - #include "targetver.h" +#include "targetver.h" -#if !defined( NOMINMAX ) - #define NOMINMAX +#if !defined(NOMINMAX) +#define NOMINMAX #endif - #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - // Windows Header Files: - #include +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include #endif diff --git a/src/statTimer/targetver.h b/src/statTimer/targetver.h index dafe7141..f5031add 100644 --- a/src/statTimer/targetver.h +++ b/src/statTimer/targetver.h @@ -18,7 +18,8 @@ // Including SDKDDKVer.h defines the highest available Windows platform. -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. +// If you wish to build your application for a previous Windows platform, +// include WinSDKVer.h and set the _WIN32_WINNT macro to the platform you wish +// to support before including SDKDDKVer.h. #include diff --git a/src/tests/accuracy_test_common.cpp b/src/tests/accuracy_test_common.cpp index 8561b143..f12a42ac 100644 --- a/src/tests/accuracy_test_common.cpp +++ b/src/tests/accuracy_test_common.cpp @@ -14,42 +14,39 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include /*****************************************************/ -clfftResultLocation cl_placeness( placeness::placeness_t placeness ) -{ - if( placeness == placeness::in_place ) - return CLFFT_INPLACE; - else if( placeness == placeness::out_of_place ) - return CLFFT_OUTOFPLACE; - else - throw std::runtime_error( "invalid placeness" ); +clfftResultLocation cl_placeness(placeness::placeness_t placeness) { + if (placeness == placeness::in_place) + return CLFFT_INPLACE; + else if (placeness == placeness::out_of_place) + return CLFFT_OUTOFPLACE; + else + throw std::runtime_error("invalid placeness"); } /*****************************************************/ -clfftLayout cl_layout( layout::buffer_layout_t layout_in ) -{ - if( layout_in == layout::real ) - return CLFFT_REAL; - else if( layout_in == layout::hermitian_planar ) - return CLFFT_HERMITIAN_PLANAR; - else if( layout_in == layout::complex_planar ) - return CLFFT_COMPLEX_PLANAR; - else if( layout_in == layout::hermitian_interleaved ) - return CLFFT_HERMITIAN_INTERLEAVED; - else if( layout_in == layout::complex_interleaved ) - return CLFFT_COMPLEX_INTERLEAVED; - else - throw std::runtime_error( "invalid layout_in" ); +clfftLayout cl_layout(layout::buffer_layout_t layout_in) { + if (layout_in == layout::real) + return CLFFT_REAL; + else if (layout_in == layout::hermitian_planar) + return CLFFT_HERMITIAN_PLANAR; + else if (layout_in == layout::complex_planar) + return CLFFT_COMPLEX_PLANAR; + else if (layout_in == layout::hermitian_interleaved) + return CLFFT_HERMITIAN_INTERLEAVED; + else if (layout_in == layout::complex_interleaved) + return CLFFT_COMPLEX_INTERLEAVED; + else + throw std::runtime_error("invalid layout_in"); } diff --git a/src/tests/accuracy_test_common.h b/src/tests/accuracy_test_common.h index afb7067b..8440e955 100644 --- a/src/tests/accuracy_test_common.h +++ b/src/tests/accuracy_test_common.h @@ -14,106 +14,89 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" -#include "cl_transform.h" #include "buffer.h" +#include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" #include #include -namespace placeness -{ - enum placeness_t { in_place = CLFFT_INPLACE, out_of_place = CLFFT_OUTOFPLACE }; +namespace placeness { +enum placeness_t { in_place = CLFFT_INPLACE, out_of_place = CLFFT_OUTOFPLACE }; } enum data_pattern { impulse, sawtooth, value, erratic }; -namespace direction -{ - enum direction_t { forward, backward }; +namespace direction { +enum direction_t { forward, backward }; } -clfftResultLocation cl_placeness( placeness::placeness_t placeness ); -clfftLayout cl_layout( layout::buffer_layout_t layout_in ); - +clfftResultLocation cl_placeness(placeness::placeness_t placeness); +clfftLayout cl_layout(layout::buffer_layout_t layout_in); /*****************************************************/ /*****************************************************/ // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() -template< class T, class cl_T, class fftw_T > -void complex_to_complex( data_pattern pattern, direction::direction_t direction, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, c2c ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - reference.set_all_data_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - if( direction == direction::forward ) - { - test_fft.set_forward_transform(); - test_fft.forward_scale( scale ); - - reference.set_forward_transform(); - reference.forward_scale( scale ); - } - else if( direction == direction::backward ) - { - test_fft.set_backward_transform(); - test_fft.backward_scale( scale ); - - reference.set_backward_transform(); - reference.backward_scale( scale ); - } - else - throw std::runtime_error( "invalid direction in complex_to_complex()" ); - reference.transform(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void complex_to_complex(data_pattern pattern, direction::direction_t direction, + std::vector lengths, size_t batch, + std::vector input_strides, + std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, + layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, c2c); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + reference.set_all_data_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + if (direction == direction::forward) { + test_fft.set_forward_transform(); + test_fft.forward_scale(scale); + + reference.set_forward_transform(); + reference.forward_scale(scale); + } else if (direction == direction::backward) { + test_fft.set_backward_transform(); + test_fft.backward_scale(scale); + + reference.set_backward_transform(); + reference.backward_scale(scale); + } else + throw std::runtime_error("invalid direction in complex_to_complex()"); + reference.transform(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -121,86 +104,71 @@ void complex_to_complex( data_pattern pattern, direction::direction_t direction, // complex to complex transform with precallback // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() -template< class T, class cl_T, class fftw_T > -void precallback_complex_to_complex( data_pattern pattern, direction::direction_t direction, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, T scale = 1.0f, bool hasUserDatatype = false ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, c2c ); - - //initialize input - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - reference.set_all_data_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - //set precallback values - if (hasUserDatatype) - { - test_fft.set_input_precallback_userdatatype(); - } - else - { - test_fft.set_input_precallback(); - } - reference.set_input_precallback(); - - if( direction == direction::forward ) - { - test_fft.set_forward_transform(); - test_fft.forward_scale( scale ); - - reference.set_forward_transform(); - reference.forward_scale( scale ); - } - else if( direction == direction::backward ) - { - test_fft.set_backward_transform(); - test_fft.backward_scale( scale ); - - reference.set_backward_transform(); - reference.backward_scale( scale ); - } - else - throw std::runtime_error( "invalid direction in complex_to_complex()" ); - - reference.transform(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void precallback_complex_to_complex( + data_pattern pattern, direction::direction_t direction, + std::vector lengths, size_t batch, + std::vector input_strides, std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f, + bool hasUserDatatype = false) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, c2c); + + // initialize input + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + reference.set_all_data_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + // set precallback values + if (hasUserDatatype) { + test_fft.set_input_precallback_userdatatype(); + } else { + test_fft.set_input_precallback(); + } + reference.set_input_precallback(); + + if (direction == direction::forward) { + test_fft.set_forward_transform(); + test_fft.forward_scale(scale); + + reference.set_forward_transform(); + reference.forward_scale(scale); + } else if (direction == direction::backward) { + test_fft.set_backward_transform(); + test_fft.backward_scale(scale); + + reference.set_backward_transform(); + reference.backward_scale(scale); + } else + throw std::runtime_error("invalid direction in complex_to_complex()"); + + reference.transform(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -208,87 +176,72 @@ void precallback_complex_to_complex( data_pattern pattern, direction::direction_ // complex to complex transform with postcallback // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() -template< class T, class cl_T, class fftw_T > -void postcallback_complex_to_complex( data_pattern pattern, direction::direction_t direction, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, T scale = 1.0f, bool hasUserDatatype = false ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, c2c ); - - //initialize input - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - reference.set_all_data_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - //set postcallback values - if (hasUserDatatype) - { - //test_fft.set_input_precallback_userdatatype(); - } - else - { - test_fft.set_output_postcallback(); - } - - if( direction == direction::forward ) - { - test_fft.set_forward_transform(); - test_fft.forward_scale( scale ); - - reference.set_forward_transform(); - reference.forward_scale( scale ); - } - else if( direction == direction::backward ) - { - test_fft.set_backward_transform(); - test_fft.backward_scale( scale ); - - reference.set_backward_transform(); - reference.backward_scale( scale ); - } - else - throw std::runtime_error( "invalid direction in complex_to_complex()" ); - - reference.transform(); - test_fft.transform(); - - reference.set_output_postcallback(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void postcallback_complex_to_complex( + data_pattern pattern, direction::direction_t direction, + std::vector lengths, size_t batch, + std::vector input_strides, std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f, + bool hasUserDatatype = false) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, c2c); + + // initialize input + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + reference.set_all_data_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + // set postcallback values + if (hasUserDatatype) { + // test_fft.set_input_precallback_userdatatype(); + } else { + test_fft.set_output_postcallback(); + } + + if (direction == direction::forward) { + test_fft.set_forward_transform(); + test_fft.forward_scale(scale); + + reference.set_forward_transform(); + reference.forward_scale(scale); + } else if (direction == direction::backward) { + test_fft.set_backward_transform(); + test_fft.backward_scale(scale); + + reference.set_backward_transform(); + reference.backward_scale(scale); + } else + throw std::runtime_error("invalid direction in complex_to_complex()"); + + reference.transform(); + test_fft.transform(); + + reference.set_output_postcallback(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -296,265 +249,219 @@ void postcallback_complex_to_complex( data_pattern pattern, direction::direction // complex to complex transform with pre and post callback // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() -template< class T, class cl_T, class fftw_T > -void pre_and_post_callback_complex_to_complex( data_pattern pattern, direction::direction_t direction, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, T scale = 1.0f, bool withLDS = false) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, c2c ); - - //initialize input - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - reference.set_all_data_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - //set callback values - if (withLDS) - { - unsigned int localMemSize = 64 * sizeof(T); - test_fft.set_input_precallback(localMemSize); - reference.set_input_precallback_special(); - - test_fft.set_output_postcallback(localMemSize); - } - else - { - test_fft.set_input_precallback(); - reference.set_input_precallback(); - - //set postcallback values - test_fft.set_output_postcallback(); - } - - if( direction == direction::forward ) - { - test_fft.set_forward_transform(); - test_fft.forward_scale( scale ); - - reference.set_forward_transform(); - reference.forward_scale( scale ); - } - else if( direction == direction::backward ) - { - test_fft.set_backward_transform(); - test_fft.backward_scale( scale ); - - reference.set_backward_transform(); - reference.backward_scale( scale ); - } - else - throw std::runtime_error( "invalid direction in complex_to_complex()" ); - - reference.transform(); - test_fft.transform(); - - //update reference for postcallback - if (withLDS) - { - reference.set_output_postcallback_special(); - } - else - { - reference.set_output_postcallback(); - } - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void pre_and_post_callback_complex_to_complex( + data_pattern pattern, direction::direction_t direction, + std::vector lengths, size_t batch, + std::vector input_strides, std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f, bool withLDS = false) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, c2c); + + // initialize input + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + reference.set_all_data_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + // set callback values + if (withLDS) { + unsigned int localMemSize = 64 * sizeof(T); + test_fft.set_input_precallback(localMemSize); + reference.set_input_precallback_special(); + + test_fft.set_output_postcallback(localMemSize); + } else { + test_fft.set_input_precallback(); + reference.set_input_precallback(); + + // set postcallback values + test_fft.set_output_postcallback(); + } + + if (direction == direction::forward) { + test_fft.set_forward_transform(); + test_fft.forward_scale(scale); + + reference.set_forward_transform(); + reference.forward_scale(scale); + } else if (direction == direction::backward) { + test_fft.set_backward_transform(); + test_fft.backward_scale(scale); + + reference.set_backward_transform(); + reference.backward_scale(scale); + } else + throw std::runtime_error("invalid direction in complex_to_complex()"); + + reference.transform(); + test_fft.transform(); + + // update reference for postcallback + if (withLDS) { + reference.set_output_postcallback_special(); + } else { + reference.set_output_postcallback(); + } + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ /*****************************************************/ // complex to complex transform with precallback function that uses LDS -template< class T, class cl_T, class fftw_T > -void precallback_complex_to_complex_lds( data_pattern pattern, direction::direction_t direction, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, c2c ); - - //initialize input - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - reference.set_all_data_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - //set precallback values - //Test assumes 64 length data - unsigned int localMemSize = 64 * sizeof(T); - test_fft.set_input_precallback(localMemSize); - reference.set_input_precallback_special(); - - if( direction == direction::forward ) - { - test_fft.set_forward_transform(); - test_fft.forward_scale( scale ); - - reference.set_forward_transform(); - reference.forward_scale( scale ); - } - else if( direction == direction::backward ) - { - test_fft.set_backward_transform(); - test_fft.backward_scale( scale ); - - reference.set_backward_transform(); - reference.backward_scale( scale ); - } - else - throw std::runtime_error( "invalid direction in complex_to_complex()" ); - - reference.transform(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void precallback_complex_to_complex_lds( + data_pattern pattern, direction::direction_t direction, + std::vector lengths, size_t batch, + std::vector input_strides, std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, c2c); + + // initialize input + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + reference.set_all_data_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + // set precallback values + // Test assumes 64 length data + unsigned int localMemSize = 64 * sizeof(T); + test_fft.set_input_precallback(localMemSize); + reference.set_input_precallback_special(); + + if (direction == direction::forward) { + test_fft.set_forward_transform(); + test_fft.forward_scale(scale); + + reference.set_forward_transform(); + reference.forward_scale(scale); + } else if (direction == direction::backward) { + test_fft.set_backward_transform(); + test_fft.backward_scale(scale); + + reference.set_backward_transform(); + reference.backward_scale(scale); + } else + throw std::runtime_error("invalid direction in complex_to_complex()"); + + reference.transform(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ /*****************************************************/ // complex to complex transform with postcallback function that uses LDS -template< class T, class cl_T, class fftw_T > -void postcallback_complex_to_complex_lds( data_pattern pattern, direction::direction_t direction, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, T scale = 1.0f ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, c2c ); - - //initialize input - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - reference.set_all_data_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - //set postcallback values - //Test assumes 64 length data - unsigned int localMemSize = 64 * sizeof(T); - test_fft.set_output_postcallback(localMemSize); - - if( direction == direction::forward ) - { - test_fft.set_forward_transform(); - test_fft.forward_scale( scale ); - - reference.set_forward_transform(); - reference.forward_scale( scale ); - } - else if( direction == direction::backward ) - { - test_fft.set_backward_transform(); - test_fft.backward_scale( scale ); - - reference.set_backward_transform(); - reference.backward_scale( scale ); - } - else - throw std::runtime_error( "invalid direction in complex_to_complex()" ); - - reference.transform(); - test_fft.transform(); - - reference.set_output_postcallback_special(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void postcallback_complex_to_complex_lds( + data_pattern pattern, direction::direction_t direction, + std::vector lengths, size_t batch, + std::vector input_strides, std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, c2c); + + // initialize input + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + reference.set_all_data_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + // set postcallback values + // Test assumes 64 length data + unsigned int localMemSize = 64 * sizeof(T); + test_fft.set_output_postcallback(localMemSize); + + if (direction == direction::forward) { + test_fft.set_forward_transform(); + test_fft.forward_scale(scale); + + reference.set_forward_transform(); + reference.forward_scale(scale); + } else if (direction == direction::backward) { + test_fft.set_backward_transform(); + test_fft.backward_scale(scale); + + reference.set_backward_transform(); + reference.backward_scale(scale); + } else + throw std::runtime_error("invalid direction in complex_to_complex()"); + + reference.transform(); + test_fft.transform(); + + reference.set_output_postcallback_special(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -562,59 +469,47 @@ void postcallback_complex_to_complex_lds( data_pattern pattern, direction::direc // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() // input layout is always real -template< class T, class cl_T, class fftw_T > -void real_to_complex( data_pattern pattern, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(layout::real), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, r2c ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f ); - reference.set_all_data_to_value( 2.0f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in real_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - test_fft.forward_scale( scale ); - reference.forward_scale( scale ); - - test_fft.transform(); - reference.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void real_to_complex(data_pattern pattern, std::vector lengths, + size_t batch, std::vector input_strides, + std::vector output_strides, size_t input_distance, + size_t output_distance, layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, T scale = 1.0f) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(layout::real), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, r2c); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f); + reference.set_all_data_to_value(2.0f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in real_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + test_fft.forward_scale(scale); + reference.forward_scale(scale); + + test_fft.transform(); + reference.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -622,62 +517,53 @@ void real_to_complex( data_pattern pattern, // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() // input layout is always real -template< class T, class cl_T, class fftw_T > -void precallback_real_to_complex( data_pattern pattern, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(layout::real), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, r2c ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f ); - reference.set_all_data_to_value( 2.0f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in real_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - test_fft.set_input_precallback(); - reference.set_input_precallback(); - - test_fft.forward_scale( scale ); - reference.forward_scale( scale ); - - test_fft.transform(); - reference.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void precallback_real_to_complex(data_pattern pattern, + std::vector lengths, size_t batch, + std::vector input_strides, + std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, + T scale = 1.0f) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(layout::real), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, r2c); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f); + reference.set_all_data_to_value(2.0f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in real_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + test_fft.set_input_precallback(); + reference.set_input_precallback(); + + test_fft.forward_scale(scale); + reference.forward_scale(scale); + + test_fft.transform(); + reference.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -685,64 +571,55 @@ void precallback_real_to_complex( data_pattern pattern, // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() // input layout is always real -template< class T, class cl_T, class fftw_T > -void postcallback_real_to_complex( data_pattern pattern, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t out_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(layout::real), cl_layout(out_layout), - cl_placeness(placeness) ); - - fftw reference( lengths.size(), &lengths[0], batch, r2c ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - reference.set_data_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f ); - reference.set_all_data_to_value( 2.0f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - reference.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - reference.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in real_to_complex()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - test_fft.forward_scale( scale ); - reference.forward_scale( scale ); - - //set postcallback values - test_fft.set_output_postcallback(); - - test_fft.transform(); - reference.transform(); - - reference.set_output_postcallback(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void postcallback_real_to_complex(data_pattern pattern, + std::vector lengths, size_t batch, + std::vector input_strides, + std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t out_layout, + placeness::placeness_t placeness, + T scale = 1.0f) { + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(layout::real), cl_layout(out_layout), + cl_placeness(placeness)); + + fftw reference(lengths.size(), &lengths[0], batch, r2c); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + reference.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f); + reference.set_all_data_to_value(2.0f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + reference.set_data_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + reference.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in real_to_complex()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + test_fft.forward_scale(scale); + reference.forward_scale(scale); + + // set postcallback values + test_fft.set_output_postcallback(); + + test_fft.transform(); + reference.transform(); + + reference.set_output_postcallback(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -750,61 +627,49 @@ void postcallback_real_to_complex( data_pattern pattern, // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() // output layout is always real -template< class T, class cl_T, class fftw_T > -void complex_to_real( data_pattern pattern, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - fftw data_maker( lengths.size(), &lengths[0], batch, r2c ); - - if( pattern == sawtooth ) - { - data_maker.set_data_to_sawtooth(1.0f); - } - else if( pattern == value ) - { - data_maker.set_all_data_to_value(2.0f); - } - else if( pattern == impulse ) - { - data_maker.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - data_maker.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_real()" ); - } - - data_maker.transform(); - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(layout::real), - cl_placeness(placeness) ); - test_fft.set_input_to_buffer( data_maker.result() ); - - fftw reference( lengths.size(), &lengths[0], batch, c2r ); - reference.set_input_to_buffer(data_maker.result()); - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - test_fft.backward_scale( scale ); - reference.backward_scale( scale ); - - test_fft.transform(); - reference.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void complex_to_real(data_pattern pattern, std::vector lengths, + size_t batch, std::vector input_strides, + std::vector output_strides, size_t input_distance, + size_t output_distance, layout::buffer_layout_t in_layout, + placeness::placeness_t placeness, T scale = 1.0f) { + fftw data_maker(lengths.size(), &lengths[0], batch, r2c); + + if (pattern == sawtooth) { + data_maker.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + data_maker.set_all_data_to_value(2.0f); + } else if (pattern == impulse) { + data_maker.set_data_to_impulse(); + } else if (pattern == erratic) { + data_maker.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_real()"); + } + + data_maker.transform(); + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(layout::real), + cl_placeness(placeness)); + test_fft.set_input_to_buffer(data_maker.result()); + + fftw reference(lengths.size(), &lengths[0], batch, c2r); + reference.set_input_to_buffer(data_maker.result()); + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + test_fft.backward_scale(scale); + reference.backward_scale(scale); + + test_fft.transform(); + reference.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -812,126 +677,108 @@ void complex_to_real( data_pattern pattern, // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() // output layout is always real -template< class T, class cl_T, class fftw_T > -void precallback_complex_to_real( data_pattern pattern, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - fftw data_maker( lengths.size(), &lengths[0], batch, r2c ); - - if( pattern == sawtooth ) - { - data_maker.set_data_to_sawtooth(1.0f); - } - else if( pattern == value ) - { - data_maker.set_all_data_to_value(2.0f); - } - else if( pattern == impulse ) - { - data_maker.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - data_maker.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_real()" ); - } - - data_maker.transform(); - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(layout::real), - cl_placeness(placeness) ); - test_fft.set_input_to_buffer( data_maker.result() ); - - fftw reference( lengths.size(), &lengths[0], batch, c2r ); - reference.set_input_to_buffer(data_maker.result()); - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - test_fft.set_input_precallback(); - reference.set_input_precallback(); - - test_fft.backward_scale( scale ); - reference.backward_scale( scale ); - - test_fft.transform(); - reference.transform(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void precallback_complex_to_real(data_pattern pattern, + std::vector lengths, size_t batch, + std::vector input_strides, + std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, + placeness::placeness_t placeness, + T scale = 1.0f) { + fftw data_maker(lengths.size(), &lengths[0], batch, r2c); + + if (pattern == sawtooth) { + data_maker.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + data_maker.set_all_data_to_value(2.0f); + } else if (pattern == impulse) { + data_maker.set_data_to_impulse(); + } else if (pattern == erratic) { + data_maker.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_real()"); + } + + data_maker.transform(); + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(layout::real), + cl_placeness(placeness)); + test_fft.set_input_to_buffer(data_maker.result()); + + fftw reference(lengths.size(), &lengths[0], batch, c2r); + reference.set_input_to_buffer(data_maker.result()); + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + test_fft.set_input_precallback(); + reference.set_input_precallback(); + + test_fft.backward_scale(scale); + reference.backward_scale(scale); + + test_fft.transform(); + reference.transform(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } -template< class T, class cl_T, class fftw_T > -void postcallback_complex_to_real( data_pattern pattern, - std::vector lengths, size_t batch, - std::vector input_strides, std::vector output_strides, - size_t input_distance, size_t output_distance, - layout::buffer_layout_t in_layout, - placeness::placeness_t placeness, - T scale = 1.0f ) -{ - fftw data_maker( lengths.size(), &lengths[0], batch, r2c ); - - if( pattern == sawtooth ) - { - data_maker.set_data_to_sawtooth(1.0f); - } - else if( pattern == value ) - { - data_maker.set_all_data_to_value(2.0f); - } - else if( pattern == impulse ) - { - data_maker.set_data_to_impulse(); - } - else if( pattern == erratic ) - { - data_maker.set_data_to_random(); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_real()" ); - } - - data_maker.transform(); - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - input_strides.empty() ? NULL : &input_strides[0], - output_strides.empty() ? NULL : &output_strides[0], - batch, input_distance, output_distance, - cl_layout(in_layout), cl_layout(layout::real), - cl_placeness(placeness) ); - test_fft.set_input_to_buffer( data_maker.result() ); - - fftw reference( lengths.size(), &lengths[0], batch, c2r ); - reference.set_input_to_buffer(data_maker.result()); - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == reference.input_buffer() ); - - test_fft.backward_scale( scale ); - reference.backward_scale( scale ); - - //set postcallback values - test_fft.set_output_postcallback(); - - test_fft.transform(); - reference.transform(); - - reference.set_output_postcallback(); - - EXPECT_EQ( true, test_fft.result() == reference.result() ); +template +void postcallback_complex_to_real(data_pattern pattern, + std::vector lengths, size_t batch, + std::vector input_strides, + std::vector output_strides, + size_t input_distance, size_t output_distance, + layout::buffer_layout_t in_layout, + placeness::placeness_t placeness, + T scale = 1.0f) { + fftw data_maker(lengths.size(), &lengths[0], batch, r2c); + + if (pattern == sawtooth) { + data_maker.set_data_to_sawtooth(1.0f); + } else if (pattern == value) { + data_maker.set_all_data_to_value(2.0f); + } else if (pattern == impulse) { + data_maker.set_data_to_impulse(); + } else if (pattern == erratic) { + data_maker.set_data_to_random(); + } else { + throw std::runtime_error("invalid pattern type in complex_to_real()"); + } + + data_maker.transform(); + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + input_strides.empty() ? NULL : &input_strides[0], + output_strides.empty() ? NULL : &output_strides[0], + batch, input_distance, output_distance, + cl_layout(in_layout), cl_layout(layout::real), + cl_placeness(placeness)); + test_fft.set_input_to_buffer(data_maker.result()); + + fftw reference(lengths.size(), &lengths[0], batch, c2r); + reference.set_input_to_buffer(data_maker.result()); + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == reference.input_buffer()); + + test_fft.backward_scale(scale); + reference.backward_scale(scale); + + // set postcallback values + test_fft.set_output_postcallback(); + + test_fft.transform(); + reference.transform(); + + reference.set_output_postcallback(); + + EXPECT_EQ(true, test_fft.result() == reference.result()); } /*****************************************************/ @@ -942,61 +789,52 @@ void postcallback_complex_to_real( data_pattern pattern, // no need to support non-unit strides and distances here // they are covered in plenty of other places // and just needlessly complicate things in this case -template< class T, class cl_T, class fftw_T > -void complex_to_complex_round_trip( data_pattern pattern, - std::vector lengths, size_t batch, - layout::buffer_layout_t layout ) -{ - placeness::placeness_t placeness = placeness::in_place; - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - NULL, NULL, batch, 0, 0, - cl_layout(layout), cl_layout(layout), - cl_placeness( placeness ) ); - - buffer expected( lengths.size(), &lengths[0], NULL, batch, 0, layout, CLFFT_OUTOFPLACE ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - expected.set_all_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - expected.set_all_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - expected.set_all_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - expected.set_all_to_random_data( 10, super_duper_global_seed ); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex_round_trip()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == expected ); - - test_fft.set_forward_transform(); - test_fft.transform(); - - // confirm that we actually did something - bool stash_suppress_output = suppress_output; - suppress_output = true; - EXPECT_EQ( false, test_fft.result() == expected ); - suppress_output = stash_suppress_output; - - test_fft.set_backward_transform(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == expected ); +template +void complex_to_complex_round_trip(data_pattern pattern, + std::vector lengths, size_t batch, + layout::buffer_layout_t layout) { + placeness::placeness_t placeness = placeness::in_place; + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + NULL, NULL, batch, 0, 0, cl_layout(layout), + cl_layout(layout), cl_placeness(placeness)); + + buffer expected(lengths.size(), &lengths[0], NULL, batch, 0, layout, + CLFFT_OUTOFPLACE); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + expected.set_all_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + expected.set_all_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + expected.set_all_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + expected.set_all_to_random_data(10, super_duper_global_seed); + } else { + throw std::runtime_error( + "invalid pattern type in complex_to_complex_round_trip()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == expected); + + test_fft.set_forward_transform(); + test_fft.transform(); + + // confirm that we actually did something + bool stash_suppress_output = suppress_output; + suppress_output = true; + EXPECT_EQ(false, test_fft.result() == expected); + suppress_output = stash_suppress_output; + + test_fft.set_backward_transform(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == expected); } /*****************************************************/ @@ -1006,195 +844,174 @@ void complex_to_complex_round_trip( data_pattern pattern, // no need to support non-unit strides and distances here // they are covered in plenty of other places // and just needlessly complicate things in this case -template< class T, class cl_T, class fftw_T > -void precallback_complex_to_complex_round_trip( data_pattern pattern, - std::vector lengths, size_t batch, - layout::buffer_layout_t layout ) -{ - placeness::placeness_t placeness = placeness::in_place; - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - NULL, NULL, batch, 0, 0, - cl_layout(layout), cl_layout(layout), - cl_placeness( placeness ) ); - - buffer expected( lengths.size(), &lengths[0], NULL, batch, 0, layout, CLFFT_OUTOFPLACE ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - expected.set_all_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f, 2.5f ); - expected.set_all_to_value( 2.0f, 2.5f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - expected.set_all_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - expected.set_all_to_random_data( 10, super_duper_global_seed ); - } - else - { - throw std::runtime_error( "invalid pattern type in complex_to_complex_round_trip()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == expected ); - - test_fft.set_input_precallback(); - - //precallback user data - buffer userdata( lengths.size(), &lengths[0], NULL, batch, 0, layout::real, CLFFT_OUTOFPLACE); - userdata.set_all_to_random_data(lengths[0], 10); - - expected *= userdata; - - test_fft.set_forward_transform(); - test_fft.transform(); - - // confirm that we actually did something - bool stash_suppress_output = suppress_output; - suppress_output = true; - EXPECT_EQ( false, test_fft.result() == expected ); - suppress_output = stash_suppress_output; - - test_fft.refresh_plan(); - - test_fft.set_backward_transform(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == expected ); +template +void precallback_complex_to_complex_round_trip(data_pattern pattern, + std::vector lengths, + size_t batch, + layout::buffer_layout_t layout) { + placeness::placeness_t placeness = placeness::in_place; + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + NULL, NULL, batch, 0, 0, cl_layout(layout), + cl_layout(layout), cl_placeness(placeness)); + + buffer expected(lengths.size(), &lengths[0], NULL, batch, 0, layout, + CLFFT_OUTOFPLACE); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + expected.set_all_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f, 2.5f); + expected.set_all_to_value(2.0f, 2.5f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + expected.set_all_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + expected.set_all_to_random_data(10, super_duper_global_seed); + } else { + throw std::runtime_error( + "invalid pattern type in complex_to_complex_round_trip()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == expected); + + test_fft.set_input_precallback(); + + // precallback user data + buffer userdata(lengths.size(), &lengths[0], NULL, batch, 0, layout::real, + CLFFT_OUTOFPLACE); + userdata.set_all_to_random_data(lengths[0], 10); + + expected *= userdata; + + test_fft.set_forward_transform(); + test_fft.transform(); + + // confirm that we actually did something + bool stash_suppress_output = suppress_output; + suppress_output = true; + EXPECT_EQ(false, test_fft.result() == expected); + suppress_output = stash_suppress_output; + + test_fft.refresh_plan(); + + test_fft.set_backward_transform(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == expected); } /*****************************************************/ /*****************************************************/ // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() -template< class T, class cl_T, class fftw_T > -void real_to_complex_round_trip( data_pattern pattern, - std::vector lengths, size_t batch ) -{ - placeness::placeness_t placeness = placeness::in_place; - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - NULL, NULL, batch, 0, 0, - cl_layout(layout::real), cl_layout(layout::hermitian_interleaved), - cl_placeness( placeness ) ); - - buffer expected( lengths.size(), &lengths[0], NULL, batch, 0, layout::real, CLFFT_OUTOFPLACE ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - expected.set_all_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f ); - expected.set_all_to_value( 2.0f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - expected.set_all_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - expected.set_all_to_random_data( 10, super_duper_global_seed ); - } - else - { - throw std::runtime_error( "invalid pattern type in real_to_complex_round_trip()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == expected ); - - test_fft.transform(); - - // confirm that we actually did something - bool stash_suppress_output = suppress_output; - suppress_output = true; - EXPECT_EQ( false, test_fft.result() == expected ); - suppress_output = stash_suppress_output; - - test_fft.swap_layouts(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == expected ); +template +void real_to_complex_round_trip(data_pattern pattern, + std::vector lengths, size_t batch) { + placeness::placeness_t placeness = placeness::in_place; + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + NULL, NULL, batch, 0, 0, cl_layout(layout::real), + cl_layout(layout::hermitian_interleaved), + cl_placeness(placeness)); + + buffer expected(lengths.size(), &lengths[0], NULL, batch, 0, layout::real, + CLFFT_OUTOFPLACE); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + expected.set_all_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f); + expected.set_all_to_value(2.0f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + expected.set_all_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + expected.set_all_to_random_data(10, super_duper_global_seed); + } else { + throw std::runtime_error( + "invalid pattern type in real_to_complex_round_trip()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == expected); + + test_fft.transform(); + + // confirm that we actually did something + bool stash_suppress_output = suppress_output; + suppress_output = true; + EXPECT_EQ(false, test_fft.result() == expected); + suppress_output = stash_suppress_output; + + test_fft.swap_layouts(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == expected); } /*****************************************************/ /*****************************************************/ // dimension is inferred from lengths.size() // tightly packed is inferred from strides.empty() -template< class T, class cl_T, class fftw_T > -void precallback_real_to_complex_round_trip( data_pattern pattern, - std::vector lengths, size_t batch ) -{ - placeness::placeness_t placeness = placeness::in_place; - - clfft test_fft( static_cast(lengths.size()), &lengths[0], - NULL, NULL, batch, 0, 0, - cl_layout(layout::real), cl_layout(layout::hermitian_interleaved), - cl_placeness( placeness ) ); - - buffer expected( lengths.size(), &lengths[0], NULL, batch, 0, layout::real, CLFFT_OUTOFPLACE ); - - if( pattern == sawtooth ) - { - test_fft.set_input_to_sawtooth( 1.0f ); - expected.set_all_to_sawtooth( 1.0f ); - } - else if( pattern == value ) - { - test_fft.set_input_to_value( 2.0f ); - expected.set_all_to_value( 2.0f ); - } - else if( pattern == impulse ) - { - test_fft.set_input_to_impulse(); - expected.set_all_to_impulse(); - } - else if( pattern == erratic ) - { - test_fft.set_input_to_random(); - expected.set_all_to_random_data( 10, super_duper_global_seed ); - } - else - { - throw std::runtime_error( "invalid pattern type in real_to_complex_round_trip()" ); - } - - // if we're starting with unequal data, we're destined for failure - EXPECT_EQ( true, test_fft.input_buffer() == expected ); - - test_fft.set_input_precallback(); - - //precallback user data - buffer userdata( lengths.size(), &lengths[0], NULL, batch, 0, layout::real, CLFFT_OUTOFPLACE); - userdata.set_all_to_random_data(lengths[0], 10); - - expected *= userdata; - - test_fft.transform(); - - // confirm that we actually did something - bool stash_suppress_output = suppress_output; - suppress_output = true; - EXPECT_EQ( false, test_fft.result() == expected ); - suppress_output = stash_suppress_output; - - test_fft.swap_layouts(); - test_fft.transform(); - - EXPECT_EQ( true, test_fft.result() == expected ); +template +void precallback_real_to_complex_round_trip(data_pattern pattern, + std::vector lengths, + size_t batch) { + placeness::placeness_t placeness = placeness::in_place; + + clfft test_fft(static_cast(lengths.size()), &lengths[0], + NULL, NULL, batch, 0, 0, cl_layout(layout::real), + cl_layout(layout::hermitian_interleaved), + cl_placeness(placeness)); + + buffer expected(lengths.size(), &lengths[0], NULL, batch, 0, layout::real, + CLFFT_OUTOFPLACE); + + if (pattern == sawtooth) { + test_fft.set_input_to_sawtooth(1.0f); + expected.set_all_to_sawtooth(1.0f); + } else if (pattern == value) { + test_fft.set_input_to_value(2.0f); + expected.set_all_to_value(2.0f); + } else if (pattern == impulse) { + test_fft.set_input_to_impulse(); + expected.set_all_to_impulse(); + } else if (pattern == erratic) { + test_fft.set_input_to_random(); + expected.set_all_to_random_data(10, super_duper_global_seed); + } else { + throw std::runtime_error( + "invalid pattern type in real_to_complex_round_trip()"); + } + + // if we're starting with unequal data, we're destined for failure + EXPECT_EQ(true, test_fft.input_buffer() == expected); + + test_fft.set_input_precallback(); + + // precallback user data + buffer userdata(lengths.size(), &lengths[0], NULL, batch, 0, layout::real, + CLFFT_OUTOFPLACE); + userdata.set_all_to_random_data(lengths[0], 10); + + expected *= userdata; + + test_fft.transform(); + + // confirm that we actually did something + bool stash_suppress_output = suppress_output; + suppress_output = true; + EXPECT_EQ(false, test_fft.result() == expected); + suppress_output = stash_suppress_output; + + test_fft.swap_layouts(); + test_fft.transform(); + + EXPECT_EQ(true, test_fft.result() == expected); } diff --git a/src/tests/accuracy_test_directed.cpp b/src/tests/accuracy_test_directed.cpp index 05354a3d..6a8b2b50 100644 --- a/src/tests/accuracy_test_directed.cpp +++ b/src/tests/accuracy_test_directed.cpp @@ -14,757 +14,722 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include #include -#include #include +#include #include -#include +#include +#include "accuracy_test_common.h" #include "clFFT.h" -#include "test_constants.h" -#include "fftw_transform.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" namespace DirectedTest { - layout::buffer_layout_t cl_layout_to_buffer_layout(clfftLayout cl_layout) - { - if (cl_layout == CLFFT_REAL) - return layout::real; - else if (cl_layout == CLFFT_HERMITIAN_PLANAR) - return layout::hermitian_planar; - else if (cl_layout == CLFFT_COMPLEX_PLANAR) - return layout::complex_planar; - else if (cl_layout == CLFFT_HERMITIAN_INTERLEAVED) - return layout::hermitian_interleaved; - else if (cl_layout == CLFFT_COMPLEX_INTERLEAVED) - return layout::complex_interleaved; - else - throw std::runtime_error("invalid cl_layout"); - } - - struct ParametersPacked - { - // directed inputs - size_t batch_size; - clfftPrecision precision; - clfftDirection direction; - clfftDim dimensions; - std::vector lengths; - - // calculated - std::vector input_strides; - std::vector output_strides; - size_t input_distance; - size_t output_distance; - clfftLayout input_layout; - clfftLayout output_layout; - - ParametersPacked(clfftPrecision precision_in, - clfftDirection direction_in, - clfftDim dimensions_in, - const std::vector &lengths_in, - size_t batch_size_in) - : precision(precision_in) - , direction(direction_in) - , dimensions(dimensions_in) - , batch_size(batch_size_in) - { - for (size_t i = 0; i < lengths_in.size(); i++) - lengths.push_back(lengths_in[i]); - } - }; - - struct ParametersPackedRealInplaceInterleaved : public ParametersPacked - { - bool is_r2c() - { - if (input_layout == CLFFT_REAL) return true; - else return false; - } - - bool is_c2r() - { - if (output_layout == CLFFT_REAL) return true; - else return false; - } - - ParametersPackedRealInplaceInterleaved( clfftPrecision precision_in, - clfftDirection direction_in, - clfftDim dimensions_in, - const std::vector &lengths_in, - size_t batch_size_in) - : ParametersPacked(precision_in, direction_in, dimensions_in, lengths_in, batch_size_in) - { - try - { - input_strides.push_back(1); - output_strides.push_back(1); - - if ((direction_in == CLFFT_FORWARD) || (direction_in == CLFFT_MINUS)) - { - input_layout = CLFFT_REAL; - output_layout = CLFFT_HERMITIAN_INTERLEAVED; - - input_distance = 2 * (1 + lengths[0]/2); - output_distance = 1 + lengths[0] / 2; - } - else - { - input_layout = CLFFT_HERMITIAN_INTERLEAVED; - output_layout = CLFFT_REAL; - - input_distance = 1 + lengths[0] / 2; - output_distance = 2 * (1 + lengths[0] / 2); - } - - for (size_t i = 1; i < lengths.size(); i++) - { - input_strides.push_back(input_distance); - output_strides.push_back(output_distance); - - input_distance *= lengths[i]; - output_distance *= lengths[i]; - } - - if( is_r2c() ) - { - // check for ok - if( dimensions >= 2 ) - if( input_strides[1] != 2 * output_strides[1] ) - throw std::runtime_error( "invalid stride y generated for r2c" ); - - if( dimensions >= 3 ) - if( input_strides[2] != 2 * output_strides[2] ) - throw std::runtime_error( "invalid stride z generated for r2c" ); - - if( input_distance != 2 * output_distance ) - throw std::runtime_error( "invalid distance generated for r2c" ); - } - - if( is_c2r() ) - { - // check for ok - if( dimensions >= 2 ) - if( output_strides[1] != 2 * input_strides[1] ) - throw std::runtime_error( "invalid stride y generated for c2r" ); - - if( dimensions >= 3 ) - if( output_strides[2] != 2 * input_strides[2] ) - throw std::runtime_error( "invalid stride z generated for c2r" ); - - if( output_distance != 2 * input_distance ) - throw std::runtime_error( "invalid distance generated for c2r" ); - } - - } - catch( const std::exception& err ) - { - handle_exception(err); - } - } - }; //struct ParametersPackedRealInplaceInterleaved - - - struct ParametersPackedComplexInplaceInterleaved : public ParametersPacked - { - ParametersPackedComplexInplaceInterleaved(clfftPrecision precision_in, - clfftDirection direction_in, - clfftDim dimensions_in, - const std::vector &lengths_in, - size_t batch_size_in) - : ParametersPacked(precision_in, direction_in, dimensions_in, lengths_in, batch_size_in) - { - try - { - input_strides.push_back(1); - output_strides.push_back(1); - - input_layout = CLFFT_COMPLEX_INTERLEAVED; - output_layout = CLFFT_COMPLEX_INTERLEAVED; - - input_distance = lengths[0]; - output_distance = lengths[0]; - - for (size_t i = 1; i < lengths.size(); i++) - { - input_strides.push_back(input_distance); - output_strides.push_back(output_distance); - - input_distance *= lengths[i]; - output_distance *= lengths[i]; - } - } - catch (const std::exception& err) - { - handle_exception(err); - } - } - }; //struct ParametersPackedComplexInplaceInterleaved - - template - class TestListGenerator - { - protected: - std::vector data_sets; - const size_t *supported_length; - size_t size_supported_length; - - virtual void supported_length_data() - { - // This array must be kept sorted in the ascending order - static const size_t supported_length_array[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 22, 24, - 25, 26, 27, 28, 30, 32, 33, 35, 36, 39, 40, 42, 44, 45, 48, 49, 50, 52, 54, - 55, 56, 60, 63, 64, 65, 66, 70, 72, 75, 77, 78, 80, 81, 84, 88, 90, 91, 96, - 98, 99, 100, 104, 105, 108, 110, 112, 117, 120, 121, 125, 126, 128, 130, 132, - 135, 140, 143, 144, 147, 150, 154, 156, 160, 162, 165, 168, 169, 175, 176, - 180, 182, 189, 192, 195, 196, 198, 200, 208, 210, 216, 220, 224, 225, 231, - 234, 240, 242, 243, 245, 250, 252, 256, 260, 264, 270, 273, 275, 280, 286, - 288, 294, 297, 300, 308, 312, 315, 320, 324, 325, 330, 336, 338, 343, 350, - 351, 352, 360, 363, 364, 375, 378, 384, 385, 390, 392, 396, 400, 405, 416, - 420, 429, 432, 440, 441, 448, 450, 455, 462, 468, 480, 484, 486, 490, 495, - 500, 504, 507, 512, 520, 525, 528, 539, 540, 546, 550, 560, 567, 572, 576, - 585, 588, 594, 600, 605, 616, 624, 625, 630, 637, 640, 648, 650, 660, 672, - 675, 676, 686, 693, 700, 702, 704, 715, 720, 726, 728, 729, 735, 750, 756, - 768, 770, 780, 784, 792, 800, 810, 819, 825, 832, 840, 845, 847, 858, 864, - 875, 880, 882, 891, 896, 900, 910, 924, 936, 945, 960, 968, 972, 975, 980, - 990, 1000, 1001, 1008, 1014, 1024, 1029, 1040, 1050, 1053, 1056, 1078, 1080, - 1089, 1092, 1100, 1120, 1125, 1134, 1144, 1152, 1155, 1170, 1176, 1183, 1188, - 1200, 1210, 1215, 1225, 1232, 1248, 1250, 1260, 1274, 1280, 1287, 1296, 1300, - 1320, 1323, 1331, 1344, 1350, 1352, 1365, 1372, 1375, 1386, 1400, 1404, 1408, - 1430, 1440, 1452, 1456, 1458, 1470, 1485, 1500, 1512, 1521, 1536, 1540, 1560, - 1568, 1573, 1575, 1584, 1600, 1617, 1620, 1625, 1638, 1650, 1664, 1680, 1690, - 1694, 1701, 1715, 1716, 1728, 1750, 1755, 1760, 1764, 1782, 1792, 1800, 1815, - 1820, 1848, 1859, 1872, 1875, 1890, 1911, 1920, 1925, 1936, 1944, 1950, 1960, - 1980, 2000, 2002, 2016, 2025, 2028, 2048, 2058, 2079, 2080, 2100, 2106, 2112, - 2145, 2156, 2160, 2178, 2184, 2187, 2197, 2200, 2205, 2240, 2250, 2268, 2275, - 2288, 2304, 2310, 2340, 2352, 2366, 2376, 2400, 2401, 2420, 2430, 2450, 2457, - 2464, 2475, 2496, 2500, 2520, 2535, 2541, 2548, 2560, 2574, 2592, 2600, 2625, - 2640, 2646, 2662, 2673, 2688, 2695, 2700, 2704, 2730, 2744, 2750, 2772, 2800, - 2808, 2816, 2835, 2860, 2880, 2904, 2912, 2916, 2925, 2940, 2970, 3000, 3003, - 3024, 3025, 3042, 3072, 3080, 3087, 3120, 3125, 3136, 3146, 3150, 3159, 3168, - 3185, 3200, 3234, 3240, 3250, 3267, 3276, 3300, 3328, 3360, 3375, 3380, 3388, - 3402, 3430, 3432, 3456, 3465, 3500, 3510, 3520, 3528, 3549, 3564, 3575, 3584, - 3600, 3630, 3640, 3645, 3675, 3696, 3718, 3744, 3750, 3773, 3780, 3822, 3840, - 3850, 3861, 3872, 3888, 3900, 3920, 3960, 3969, 3993, 4000, 4004, 4032, 4050, - 4056, 4095, 4096 }; - - supported_length = supported_length_array; - size_supported_length = sizeof(supported_length_array) / sizeof(supported_length_array[0]); - } - - virtual void generate_1d(clfftDirection dir, clfftPrecision precision, size_t batch) - { - for (size_t i = 0; i < size_supported_length; i++) - { - std::vector length; - length.push_back(supported_length[i]); - data_sets.push_back(ParameterType(precision, dir, CLFFT_1D, length, batch)); - } - } - - virtual void generate_2d(clfftDirection dir, clfftPrecision precision, size_t batch) - { - for (size_t i = 0; i < size_supported_length; i++) - { - std::vector length; - length.push_back(supported_length[i]); - length.push_back(supported_length[i]); - data_sets.push_back(ParameterType(precision, dir, CLFFT_2D, length, batch)); - } - } - - virtual void generate_3d(clfftDirection dir, clfftPrecision precision, size_t batch) - { - for (size_t i = 0; i < size_supported_length; i++) - { - std::vector length; - length.push_back(supported_length[i]); - length.push_back(supported_length[i]); - length.push_back(supported_length[i]); - data_sets.push_back(ParameterType(precision, dir, CLFFT_3D, length, batch)); - - const size_t max_3d_length = 256; - if (supported_length[i] == max_3d_length) break; - } - } - - public: - TestListGenerator() : supported_length(NULL), size_supported_length(0) - {} - - virtual std::vector & parameter_sets - (clfftDim dimension, clfftDirection direction, clfftPrecision precision, size_t batch) - { - supported_length_data(); - - switch (dimension) - { - case CLFFT_1D: generate_1d(direction, precision, batch); break; - case CLFFT_2D: generate_2d(direction, precision, batch); break; - case CLFFT_3D: generate_3d(direction, precision, batch); break; - } - - return data_sets; - } - - }; //class TestListGenerator - - template - class TestListGenerator_Pow2 : public TestListGenerator - { - protected: - virtual void supported_length_data() - { - // This array must be kept sorted in the ascending order - static const size_t supported_length_array[] = { - 8192, 16384, 32768, 65536, 131072, 262144, 524288, - 1048576, 2097152, 4194304}; - - TestListGenerator::supported_length = supported_length_array; - TestListGenerator::size_supported_length = sizeof(supported_length_array) / sizeof(supported_length_array[0]); - } - }; - - - template - class TestListGenerator_Large_Random - { - protected: - std::vector supported_length; - std::vector data_sets; - - void GenerateSizes(size_t maximum_size) - { - std::list sizes; - - size_t i = 0, j = 0, k = 0, l = 0, m = 0, n = 0; - size_t sum, sumi, sumj, sumk, suml, summ, sumn; - - sumi = 1; i = 0; - while (1) - { - sumj = 1; j = 0; - while (1) - { - sumk = 1; k = 0; - while (1) - { - suml = 1; l = 0; - while (1) - { - summ = 1; m = 0; - while (1) - { - sumn = 1; n = 0; - while (1) - { - sum = (sumi*sumj*sumk*suml*summ*sumn); - if (sum > maximum_size) break; - - sizes.push_back(sum); - n++; - sumn *= 2; - } - - if (n == 0) break; - m++; - summ *= 3; - } - - if ((m == 0) && (n == 0)) break; - l++; - suml *= 5; - } - - if ((l == 0) && (m == 0) && (n == 0)) break; - k++; - sumk *= 7; - } - - if ((k == 0) && (l == 0) && (m == 0) && (n == 0)) break; - j++; - sumj *= 11; - } - - if ((j == 0) && (k == 0) && (l == 0) && (m == 0) && (n == 0)) break; - i++; - sumi *= 13; - } - - sizes.sort(); - - for (std::list::const_iterator a = sizes.begin(); a != sizes.end(); a++) - supported_length.push_back(*a); - } - - public: - virtual std::vector & parameter_sets - (clfftDirection direction, clfftPrecision precision, size_t num_tests) - { - size_t maximum_size = (precision == CLFFT_SINGLE) ? 16777216 : 4194304; - - GenerateSizes(maximum_size); - - assert(supported_length.size() < RAND_MAX); - - for (size_t i = 0; i < num_tests; i++) - { - size_t idx = 0; - - // choose size that has a 11 or 13 in it - do - { - // choose index randomly - idx = rand() % supported_length.size(); - } while ((supported_length[idx] % 11 != 0) && (supported_length[idx] % 13 != 0)); - - - std::vector length; - length.push_back(supported_length[idx]); - size_t batch = maximum_size / supported_length[idx]; - - data_sets.push_back(ParameterType(precision, direction, CLFFT_1D, length, batch)); - } - - return data_sets; - } - }; - - - template - class TestListGenerator_huge_chosen : public TestListGenerator - { - protected: - virtual void supported_length_data() - { - // This array must be kept sorted in the ascending order - static const size_t supported_length_array[] = { - 25050025, 27027000, 17320303, 19487171, 4826809, 53094899, 23030293, 214358881, 62748517 }; - - TestListGenerator::supported_length = supported_length_array; - TestListGenerator::size_supported_length = sizeof(supported_length_array) / sizeof(supported_length_array[0]); - } - }; - - -} //namespace DirectedTest - -class accuracy_test_directed_base : public ::testing::TestWithParam { +layout::buffer_layout_t cl_layout_to_buffer_layout(clfftLayout cl_layout) { + if (cl_layout == CLFFT_REAL) + return layout::real; + else if (cl_layout == CLFFT_HERMITIAN_PLANAR) + return layout::hermitian_planar; + else if (cl_layout == CLFFT_COMPLEX_PLANAR) + return layout::complex_planar; + else if (cl_layout == CLFFT_HERMITIAN_INTERLEAVED) + return layout::hermitian_interleaved; + else if (cl_layout == CLFFT_COMPLEX_INTERLEAVED) + return layout::complex_interleaved; + else + throw std::runtime_error("invalid cl_layout"); +} + +struct ParametersPacked { + // directed inputs + size_t batch_size; + clfftPrecision precision; + clfftDirection direction; + clfftDim dimensions; + std::vector lengths; + + // calculated + std::vector input_strides; + std::vector output_strides; + size_t input_distance; + size_t output_distance; + clfftLayout input_layout; + clfftLayout output_layout; + + ParametersPacked(clfftPrecision precision_in, clfftDirection direction_in, + clfftDim dimensions_in, + const std::vector &lengths_in, size_t batch_size_in) + : precision(precision_in), direction(direction_in), + dimensions(dimensions_in), batch_size(batch_size_in) { + for (size_t i = 0; i < lengths_in.size(); i++) + lengths.push_back(lengths_in[i]); + } +}; + +struct ParametersPackedRealInplaceInterleaved : public ParametersPacked { + bool is_r2c() { + if (input_layout == CLFFT_REAL) + return true; + else + return false; + } + + bool is_c2r() { + if (output_layout == CLFFT_REAL) + return true; + else + return false; + } + + ParametersPackedRealInplaceInterleaved(clfftPrecision precision_in, + clfftDirection direction_in, + clfftDim dimensions_in, + const std::vector &lengths_in, + size_t batch_size_in) + : ParametersPacked(precision_in, direction_in, dimensions_in, lengths_in, + batch_size_in) { + try { + input_strides.push_back(1); + output_strides.push_back(1); + + if ((direction_in == CLFFT_FORWARD) || (direction_in == CLFFT_MINUS)) { + input_layout = CLFFT_REAL; + output_layout = CLFFT_HERMITIAN_INTERLEAVED; + + input_distance = 2 * (1 + lengths[0] / 2); + output_distance = 1 + lengths[0] / 2; + } else { + input_layout = CLFFT_HERMITIAN_INTERLEAVED; + output_layout = CLFFT_REAL; + + input_distance = 1 + lengths[0] / 2; + output_distance = 2 * (1 + lengths[0] / 2); + } + + for (size_t i = 1; i < lengths.size(); i++) { + input_strides.push_back(input_distance); + output_strides.push_back(output_distance); + + input_distance *= lengths[i]; + output_distance *= lengths[i]; + } + + if (is_r2c()) { + // check for ok + if (dimensions >= 2) + if (input_strides[1] != 2 * output_strides[1]) + throw std::runtime_error("invalid stride y generated for r2c"); + + if (dimensions >= 3) + if (input_strides[2] != 2 * output_strides[2]) + throw std::runtime_error("invalid stride z generated for r2c"); + + if (input_distance != 2 * output_distance) + throw std::runtime_error("invalid distance generated for r2c"); + } + + if (is_c2r()) { + // check for ok + if (dimensions >= 2) + if (output_strides[1] != 2 * input_strides[1]) + throw std::runtime_error("invalid stride y generated for c2r"); + + if (dimensions >= 3) + if (output_strides[2] != 2 * input_strides[2]) + throw std::runtime_error("invalid stride z generated for c2r"); + + if (output_distance != 2 * input_distance) + throw std::runtime_error("invalid distance generated for c2r"); + } + + } catch (const std::exception &err) { + handle_exception(err); + } + } +}; // struct ParametersPackedRealInplaceInterleaved + +struct ParametersPackedComplexInplaceInterleaved : public ParametersPacked { + ParametersPackedComplexInplaceInterleaved( + clfftPrecision precision_in, clfftDirection direction_in, + clfftDim dimensions_in, const std::vector &lengths_in, + size_t batch_size_in) + : ParametersPacked(precision_in, direction_in, dimensions_in, lengths_in, + batch_size_in) { + try { + input_strides.push_back(1); + output_strides.push_back(1); + + input_layout = CLFFT_COMPLEX_INTERLEAVED; + output_layout = CLFFT_COMPLEX_INTERLEAVED; + + input_distance = lengths[0]; + output_distance = lengths[0]; + + for (size_t i = 1; i < lengths.size(); i++) { + input_strides.push_back(input_distance); + output_strides.push_back(output_distance); + + input_distance *= lengths[i]; + output_distance *= lengths[i]; + } + } catch (const std::exception &err) { + handle_exception(err); + } + } +}; // struct ParametersPackedComplexInplaceInterleaved + +template class TestListGenerator { protected: - accuracy_test_directed_base() {} - virtual ~accuracy_test_directed_base() {} - virtual void SetUp() {} - virtual void TearDown() {} + std::vector data_sets; + const size_t *supported_length; + size_t size_supported_length; + + virtual void supported_length_data() { + // This array must be kept sorted in the ascending order + static const size_t supported_length_array[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, + 28, 30, 32, 33, 35, 36, 39, 40, 42, 44, 45, 48, + 49, 50, 52, 54, 55, 56, 60, 63, 64, 65, 66, 70, + 72, 75, 77, 78, 80, 81, 84, 88, 90, 91, 96, 98, + 99, 100, 104, 105, 108, 110, 112, 117, 120, 121, 125, 126, + 128, 130, 132, 135, 140, 143, 144, 147, 150, 154, 156, 160, + 162, 165, 168, 169, 175, 176, 180, 182, 189, 192, 195, 196, + 198, 200, 208, 210, 216, 220, 224, 225, 231, 234, 240, 242, + 243, 245, 250, 252, 256, 260, 264, 270, 273, 275, 280, 286, + 288, 294, 297, 300, 308, 312, 315, 320, 324, 325, 330, 336, + 338, 343, 350, 351, 352, 360, 363, 364, 375, 378, 384, 385, + 390, 392, 396, 400, 405, 416, 420, 429, 432, 440, 441, 448, + 450, 455, 462, 468, 480, 484, 486, 490, 495, 500, 504, 507, + 512, 520, 525, 528, 539, 540, 546, 550, 560, 567, 572, 576, + 585, 588, 594, 600, 605, 616, 624, 625, 630, 637, 640, 648, + 650, 660, 672, 675, 676, 686, 693, 700, 702, 704, 715, 720, + 726, 728, 729, 735, 750, 756, 768, 770, 780, 784, 792, 800, + 810, 819, 825, 832, 840, 845, 847, 858, 864, 875, 880, 882, + 891, 896, 900, 910, 924, 936, 945, 960, 968, 972, 975, 980, + 990, 1000, 1001, 1008, 1014, 1024, 1029, 1040, 1050, 1053, 1056, 1078, + 1080, 1089, 1092, 1100, 1120, 1125, 1134, 1144, 1152, 1155, 1170, 1176, + 1183, 1188, 1200, 1210, 1215, 1225, 1232, 1248, 1250, 1260, 1274, 1280, + 1287, 1296, 1300, 1320, 1323, 1331, 1344, 1350, 1352, 1365, 1372, 1375, + 1386, 1400, 1404, 1408, 1430, 1440, 1452, 1456, 1458, 1470, 1485, 1500, + 1512, 1521, 1536, 1540, 1560, 1568, 1573, 1575, 1584, 1600, 1617, 1620, + 1625, 1638, 1650, 1664, 1680, 1690, 1694, 1701, 1715, 1716, 1728, 1750, + 1755, 1760, 1764, 1782, 1792, 1800, 1815, 1820, 1848, 1859, 1872, 1875, + 1890, 1911, 1920, 1925, 1936, 1944, 1950, 1960, 1980, 2000, 2002, 2016, + 2025, 2028, 2048, 2058, 2079, 2080, 2100, 2106, 2112, 2145, 2156, 2160, + 2178, 2184, 2187, 2197, 2200, 2205, 2240, 2250, 2268, 2275, 2288, 2304, + 2310, 2340, 2352, 2366, 2376, 2400, 2401, 2420, 2430, 2450, 2457, 2464, + 2475, 2496, 2500, 2520, 2535, 2541, 2548, 2560, 2574, 2592, 2600, 2625, + 2640, 2646, 2662, 2673, 2688, 2695, 2700, 2704, 2730, 2744, 2750, 2772, + 2800, 2808, 2816, 2835, 2860, 2880, 2904, 2912, 2916, 2925, 2940, 2970, + 3000, 3003, 3024, 3025, 3042, 3072, 3080, 3087, 3120, 3125, 3136, 3146, + 3150, 3159, 3168, 3185, 3200, 3234, 3240, 3250, 3267, 3276, 3300, 3328, + 3360, 3375, 3380, 3388, 3402, 3430, 3432, 3456, 3465, 3500, 3510, 3520, + 3528, 3549, 3564, 3575, 3584, 3600, 3630, 3640, 3645, 3675, 3696, 3718, + 3744, 3750, 3773, 3780, 3822, 3840, 3850, 3861, 3872, 3888, 3900, 3920, + 3960, 3969, 3993, 4000, 4004, 4032, 4050, 4056, 4095, 4096}; + + supported_length = supported_length_array; + size_supported_length = + sizeof(supported_length_array) / sizeof(supported_length_array[0]); + } + + virtual void generate_1d(clfftDirection dir, clfftPrecision precision, + size_t batch) { + for (size_t i = 0; i < size_supported_length; i++) { + std::vector length; + length.push_back(supported_length[i]); + data_sets.push_back( + ParameterType(precision, dir, CLFFT_1D, length, batch)); + } + } + + virtual void generate_2d(clfftDirection dir, clfftPrecision precision, + size_t batch) { + for (size_t i = 0; i < size_supported_length; i++) { + std::vector length; + length.push_back(supported_length[i]); + length.push_back(supported_length[i]); + data_sets.push_back( + ParameterType(precision, dir, CLFFT_2D, length, batch)); + } + } + + virtual void generate_3d(clfftDirection dir, clfftPrecision precision, + size_t batch) { + for (size_t i = 0; i < size_supported_length; i++) { + std::vector length; + length.push_back(supported_length[i]); + length.push_back(supported_length[i]); + length.push_back(supported_length[i]); + data_sets.push_back( + ParameterType(precision, dir, CLFFT_3D, length, batch)); + + const size_t max_3d_length = 256; + if (supported_length[i] == max_3d_length) + break; + } + } public: - static void RunTest(const DirectedTest::ParametersPacked *params_ptr) - { - const DirectedTest::ParametersPacked ¶ms = *params_ptr; - try - { - RecordProperty("batch_size", (int)params.batch_size); - RecordProperty("precision", params.precision); - RecordProperty("direction", params.direction); - RecordProperty("dimensions", params.dimensions); - RecordProperty("length_x", (int)params.lengths[0]); - if (params.dimensions >= CLFFT_2D) RecordProperty("length_y", (int)params.lengths[1]); - if (params.dimensions >= CLFFT_3D) RecordProperty("length_z", (int)params.lengths[2]); - - if (params.input_strides.empty()) - { - RecordProperty("input_strides", 0); - } - else - { - RecordProperty("input_stride_x", (int)params.input_strides[0]); - if (params.dimensions >= CLFFT_2D) RecordProperty("input_stride_y", (int)params.input_strides[1]); - if (params.dimensions >= CLFFT_3D) RecordProperty("input_stride_z", (int)params.input_strides[2]); - } - - if (params.output_strides.empty()) - { - RecordProperty("output_strides", 0); - } - else - { - RecordProperty("output_stride_x", (int)params.output_strides[0]); - if (params.dimensions >= CLFFT_2D) RecordProperty("output_stride_y", (int)params.output_strides[1]); - if (params.dimensions >= CLFFT_3D) RecordProperty("output_stride_z", (int)params.output_strides[2]); - } - - RecordProperty("input_distance", (int)params.input_distance); - RecordProperty("output_distance", (int)params.output_distance); - RecordProperty("input_layout", params.input_layout); - RecordProperty("output_layout", params.output_layout); - - - if (params.precision == CLFFT_SINGLE) - { - if (params.input_layout == CLFFT_REAL) - { - real_to_complex(erratic, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - DirectedTest::cl_layout_to_buffer_layout(params.output_layout), - placeness::in_place); - } - else if (params.output_layout == CLFFT_REAL) - { - complex_to_real(erratic, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - DirectedTest::cl_layout_to_buffer_layout(params.input_layout), - placeness::in_place); - } - else if ((params.input_layout == CLFFT_COMPLEX_INTERLEAVED || params.input_layout == CLFFT_COMPLEX_PLANAR) && - (params.output_layout == CLFFT_COMPLEX_INTERLEAVED || params.output_layout == CLFFT_COMPLEX_PLANAR)) - { - complex_to_complex(erratic, - params.direction == CLFFT_FORWARD ? direction::forward : direction::backward, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - DirectedTest::cl_layout_to_buffer_layout(params.input_layout), - DirectedTest::cl_layout_to_buffer_layout(params.output_layout), - placeness::in_place); - } - else - { - throw std::runtime_error("bad layout combination"); - } - } - else if (params.precision == CLFFT_DOUBLE) - { - if (params.input_layout == CLFFT_REAL) - { - real_to_complex(erratic, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - DirectedTest::cl_layout_to_buffer_layout(params.output_layout), - placeness::in_place); - } - else if (params.output_layout == CLFFT_REAL) - { - complex_to_real(erratic, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - DirectedTest::cl_layout_to_buffer_layout(params.input_layout), - placeness::in_place); - } - else if ((params.input_layout == CLFFT_COMPLEX_INTERLEAVED || params.input_layout == CLFFT_COMPLEX_PLANAR) && - (params.output_layout == CLFFT_COMPLEX_INTERLEAVED || params.output_layout == CLFFT_COMPLEX_PLANAR)) - { - complex_to_complex(erratic, - params.direction == CLFFT_FORWARD ? direction::forward : direction::backward, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - DirectedTest::cl_layout_to_buffer_layout(params.input_layout), - DirectedTest::cl_layout_to_buffer_layout(params.output_layout), - placeness::in_place); - } - else - { - throw std::runtime_error("bad layout combination"); - } - } - else - { - throw std::runtime_error("Random test: this code path should never be executed"); - } - } - catch (const std::exception& err) - { - handle_exception(err); - } - } + TestListGenerator() : supported_length(NULL), size_supported_length(0) {} + + virtual std::vector ¶meter_sets(clfftDim dimension, + clfftDirection direction, + clfftPrecision precision, + size_t batch) { + supported_length_data(); + + switch (dimension) { + case CLFFT_1D: + generate_1d(direction, precision, batch); + break; + case CLFFT_2D: + generate_2d(direction, precision, batch); + break; + case CLFFT_3D: + generate_3d(direction, precision, batch); + break; + } + + return data_sets; + } + +}; // class TestListGenerator + +template +class TestListGenerator_Pow2 : public TestListGenerator { +protected: + virtual void supported_length_data() { + // This array must be kept sorted in the ascending order + static const size_t supported_length_array[] = { + 8192, 16384, 32768, 65536, 131072, + 262144, 524288, 1048576, 2097152, 4194304}; + + TestListGenerator::supported_length = supported_length_array; + TestListGenerator::size_supported_length = + sizeof(supported_length_array) / sizeof(supported_length_array[0]); + } }; -class accuracy_test_directed_real : public ::testing::TestWithParam { - protected: - accuracy_test_directed_real() {} - virtual ~accuracy_test_directed_real() {} - virtual void SetUp() {} - virtual void TearDown() {} - - virtual void accuracy_test_directed_packed_real_inplace_interleaved() - { - DirectedTest::ParametersPackedRealInplaceInterleaved params = GetParam(); - accuracy_test_directed_base::RunTest(¶ms); - } +template class TestListGenerator_Large_Random { +protected: + std::vector supported_length; + std::vector data_sets; + + void GenerateSizes(size_t maximum_size) { + std::list sizes; + + size_t i = 0, j = 0, k = 0, l = 0, m = 0, n = 0; + size_t sum, sumi, sumj, sumk, suml, summ, sumn; + + sumi = 1; + i = 0; + while (1) { + sumj = 1; + j = 0; + while (1) { + sumk = 1; + k = 0; + while (1) { + suml = 1; + l = 0; + while (1) { + summ = 1; + m = 0; + while (1) { + sumn = 1; + n = 0; + while (1) { + sum = (sumi * sumj * sumk * suml * summ * sumn); + if (sum > maximum_size) + break; + + sizes.push_back(sum); + n++; + sumn *= 2; + } + + if (n == 0) + break; + m++; + summ *= 3; + } + + if ((m == 0) && (n == 0)) + break; + l++; + suml *= 5; + } + + if ((l == 0) && (m == 0) && (n == 0)) + break; + k++; + sumk *= 7; + } + + if ((k == 0) && (l == 0) && (m == 0) && (n == 0)) + break; + j++; + sumj *= 11; + } + + if ((j == 0) && (k == 0) && (l == 0) && (m == 0) && (n == 0)) + break; + i++; + sumi *= 13; + } + + sizes.sort(); + + for (std::list::const_iterator a = sizes.begin(); a != sizes.end(); + a++) + supported_length.push_back(*a); + } + +public: + virtual std::vector ¶meter_sets(clfftDirection direction, + clfftPrecision precision, + size_t num_tests) { + size_t maximum_size = (precision == CLFFT_SINGLE) ? 16777216 : 4194304; + + GenerateSizes(maximum_size); + + assert(supported_length.size() < RAND_MAX); + + for (size_t i = 0; i < num_tests; i++) { + size_t idx = 0; + + // choose size that has a 11 or 13 in it + do { + // choose index randomly + idx = rand() % supported_length.size(); + } while ((supported_length[idx] % 11 != 0) && + (supported_length[idx] % 13 != 0)); + + std::vector length; + length.push_back(supported_length[idx]); + size_t batch = maximum_size / supported_length[idx]; + + data_sets.push_back( + ParameterType(precision, direction, CLFFT_1D, length, batch)); + } + + return data_sets; + } }; +template +class TestListGenerator_huge_chosen : public TestListGenerator { +protected: + virtual void supported_length_data() { + // This array must be kept sorted in the ascending order + static const size_t supported_length_array[] = { + 25050025, 27027000, 17320303, 19487171, 4826809, + 53094899, 23030293, 214358881, 62748517}; + + TestListGenerator::supported_length = supported_length_array; + TestListGenerator::size_supported_length = + sizeof(supported_length_array) / sizeof(supported_length_array[0]); + } +}; -TEST_P(accuracy_test_directed_real, inplace_interleaved) { accuracy_test_directed_packed_real_inplace_interleaved(); } +} // namespace DirectedTest +class accuracy_test_directed_base + : public ::testing::TestWithParam { +protected: + accuracy_test_directed_base() {} + virtual ~accuracy_test_directed_base() {} + virtual void SetUp() {} + virtual void TearDown() {} -INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_1d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_SINGLE, 19)) - ); +public: + static void RunTest(const DirectedTest::ParametersPacked *params_ptr) { + const DirectedTest::ParametersPacked ¶ms = *params_ptr; + try { + RecordProperty("batch_size", (int)params.batch_size); + RecordProperty("precision", params.precision); + RecordProperty("direction", params.direction); + RecordProperty("dimensions", params.dimensions); + RecordProperty("length_x", (int)params.lengths[0]); + if (params.dimensions >= CLFFT_2D) + RecordProperty("length_y", (int)params.lengths[1]); + if (params.dimensions >= CLFFT_3D) + RecordProperty("length_z", (int)params.lengths[2]); + + if (params.input_strides.empty()) { + RecordProperty("input_strides", 0); + } else { + RecordProperty("input_stride_x", (int)params.input_strides[0]); + if (params.dimensions >= CLFFT_2D) + RecordProperty("input_stride_y", (int)params.input_strides[1]); + if (params.dimensions >= CLFFT_3D) + RecordProperty("input_stride_z", (int)params.input_strides[2]); + } + + if (params.output_strides.empty()) { + RecordProperty("output_strides", 0); + } else { + RecordProperty("output_stride_x", (int)params.output_strides[0]); + if (params.dimensions >= CLFFT_2D) + RecordProperty("output_stride_y", (int)params.output_strides[1]); + if (params.dimensions >= CLFFT_3D) + RecordProperty("output_stride_z", (int)params.output_strides[2]); + } + + RecordProperty("input_distance", (int)params.input_distance); + RecordProperty("output_distance", (int)params.output_distance); + RecordProperty("input_layout", params.input_layout); + RecordProperty("output_layout", params.output_layout); + + if (params.precision == CLFFT_SINGLE) { + if (params.input_layout == CLFFT_REAL) { + real_to_complex( + erratic, params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + DirectedTest::cl_layout_to_buffer_layout(params.output_layout), + placeness::in_place); + } else if (params.output_layout == CLFFT_REAL) { + complex_to_real( + erratic, params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + DirectedTest::cl_layout_to_buffer_layout(params.input_layout), + placeness::in_place); + } else if ((params.input_layout == CLFFT_COMPLEX_INTERLEAVED || + params.input_layout == CLFFT_COMPLEX_PLANAR) && + (params.output_layout == CLFFT_COMPLEX_INTERLEAVED || + params.output_layout == CLFFT_COMPLEX_PLANAR)) { + complex_to_complex( + erratic, + params.direction == CLFFT_FORWARD ? direction::forward + : direction::backward, + params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + DirectedTest::cl_layout_to_buffer_layout(params.input_layout), + DirectedTest::cl_layout_to_buffer_layout(params.output_layout), + placeness::in_place); + } else { + throw std::runtime_error("bad layout combination"); + } + } else if (params.precision == CLFFT_DOUBLE) { + if (params.input_layout == CLFFT_REAL) { + real_to_complex( + erratic, params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + DirectedTest::cl_layout_to_buffer_layout(params.output_layout), + placeness::in_place); + } else if (params.output_layout == CLFFT_REAL) { + complex_to_real( + erratic, params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + DirectedTest::cl_layout_to_buffer_layout(params.input_layout), + placeness::in_place); + } else if ((params.input_layout == CLFFT_COMPLEX_INTERLEAVED || + params.input_layout == CLFFT_COMPLEX_PLANAR) && + (params.output_layout == CLFFT_COMPLEX_INTERLEAVED || + params.output_layout == CLFFT_COMPLEX_PLANAR)) { + complex_to_complex( + erratic, + params.direction == CLFFT_FORWARD ? direction::forward + : direction::backward, + params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + DirectedTest::cl_layout_to_buffer_layout(params.input_layout), + DirectedTest::cl_layout_to_buffer_layout(params.output_layout), + placeness::in_place); + } else { + throw std::runtime_error("bad layout combination"); + } + } else { + throw std::runtime_error( + "Random test: this code path should never be executed"); + } + } catch (const std::exception &err) { + handle_exception(err); + } + } +}; -INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_1d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 19)) - ); +class accuracy_test_directed_real + : public ::testing::TestWithParam< + DirectedTest::ParametersPackedRealInplaceInterleaved> { +protected: + accuracy_test_directed_real() {} + virtual ~accuracy_test_directed_real() {} + virtual void SetUp() {} + virtual void TearDown() {} + + virtual void accuracy_test_directed_packed_real_inplace_interleaved() { + DirectedTest::ParametersPackedRealInplaceInterleaved params = GetParam(); + accuracy_test_directed_base::RunTest(¶ms); + } +}; -INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_double_1d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_DOUBLE, 19)) - ); +TEST_P(accuracy_test_directed_real, inplace_interleaved) { + accuracy_test_directed_packed_real_inplace_interleaved(); +} INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_double_1d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_DOUBLE, 19)) - ); + clfft_DirectedTest_single_1d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_SINGLE, 19))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_2d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_2D, CLFFT_FORWARD, CLFFT_SINGLE, 3)) - ); + clfft_DirectedTest_single_1d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 19))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_2d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_2D, CLFFT_BACKWARD, CLFFT_SINGLE, 3)) - ); + clfft_DirectedTest_double_1d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_DOUBLE, 19))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_3d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_3D, CLFFT_FORWARD, CLFFT_SINGLE, 1)) - ); + clfft_DirectedTest_double_1d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_DOUBLE, 19))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_3d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_3D, CLFFT_BACKWARD, CLFFT_SINGLE, 1)) - ); - - - + clfft_DirectedTest_single_2d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_2D, CLFFT_FORWARD, CLFFT_SINGLE, 3))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_Random_single_1d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Large_Random().parameter_sets(CLFFT_FORWARD, CLFFT_SINGLE, 200)) - ); + clfft_DirectedTest_single_2d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_2D, CLFFT_BACKWARD, CLFFT_SINGLE, 3))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_Random_single_1d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Large_Random().parameter_sets(CLFFT_BACKWARD, CLFFT_SINGLE, 200)) - ); + clfft_DirectedTest_single_3d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_3D, CLFFT_FORWARD, CLFFT_SINGLE, 1))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_Random_double_1d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Large_Random().parameter_sets(CLFFT_FORWARD, CLFFT_DOUBLE, 200)) - ); + clfft_DirectedTest_single_3d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_3D, CLFFT_BACKWARD, CLFFT_SINGLE, 1))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_Random_double_1d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Large_Random().parameter_sets(CLFFT_BACKWARD, CLFFT_DOUBLE, 200)) - ); + clfft_DirectedTest_Random_single_1d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Large_Random< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_FORWARD, CLFFT_SINGLE, 200))); +INSTANTIATE_TEST_CASE_P( + clfft_DirectedTest_Random_single_1d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Large_Random< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_BACKWARD, CLFFT_SINGLE, 200))); +INSTANTIATE_TEST_CASE_P( + clfft_DirectedTest_Random_double_1d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Large_Random< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_FORWARD, CLFFT_DOUBLE, 200))); +INSTANTIATE_TEST_CASE_P( + clfft_DirectedTest_Random_double_1d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Large_Random< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_BACKWARD, CLFFT_DOUBLE, 200))); #if 1 INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_pow2_single_1d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2().parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_SINGLE, 3)) - ); + clfft_DirectedTest_pow2_single_1d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Pow2< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_SINGLE, 3))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_pow2_single_1d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 3)) - ); + clfft_DirectedTest_pow2_single_1d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Pow2< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 3))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_pow2_double_1d_fwd, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2().parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_DOUBLE, 3)) - ); + clfft_DirectedTest_pow2_double_1d_fwd, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Pow2< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_DOUBLE, 3))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_pow2_double_1d_inv, - accuracy_test_directed_real, - ::testing::ValuesIn(DirectedTest::TestListGenerator_Pow2().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_DOUBLE, 3)) - ); + clfft_DirectedTest_pow2_double_1d_inv, accuracy_test_directed_real, + ::testing::ValuesIn( + DirectedTest::TestListGenerator_Pow2< + DirectedTest::ParametersPackedRealInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_DOUBLE, 3))); #endif - - -class accuracy_test_directed_complex : public ::testing::TestWithParam { +class accuracy_test_directed_complex + : public ::testing::TestWithParam< + DirectedTest::ParametersPackedComplexInplaceInterleaved> { protected: - accuracy_test_directed_complex() {} - virtual ~accuracy_test_directed_complex() {} - virtual void SetUp() {} - virtual void TearDown() {} - - virtual void accuracy_test_directed_packed_complex_inplace_interleaved() - { - DirectedTest::ParametersPackedComplexInplaceInterleaved params = GetParam(); - accuracy_test_directed_base::RunTest(¶ms); - } + accuracy_test_directed_complex() {} + virtual ~accuracy_test_directed_complex() {} + virtual void SetUp() {} + virtual void TearDown() {} + + virtual void accuracy_test_directed_packed_complex_inplace_interleaved() { + DirectedTest::ParametersPackedComplexInplaceInterleaved params = GetParam(); + accuracy_test_directed_base::RunTest(¶ms); + } }; - -TEST_P(accuracy_test_directed_complex, inplace_interleaved) { accuracy_test_directed_packed_complex_inplace_interleaved(); } - +TEST_P(accuracy_test_directed_complex, inplace_interleaved) { + accuracy_test_directed_packed_complex_inplace_interleaved(); +} INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_1d_fwd, - accuracy_test_directed_complex, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_SINGLE, 101)) - ); + clfft_DirectedTest_single_1d_fwd, accuracy_test_directed_complex, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedComplexInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_FORWARD, CLFFT_SINGLE, 101))); INSTANTIATE_TEST_CASE_P( - clfft_DirectedTest_single_1d_inv, - accuracy_test_directed_complex, - ::testing::ValuesIn(DirectedTest::TestListGenerator().parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 101)) - ); - + clfft_DirectedTest_single_1d_inv, accuracy_test_directed_complex, + ::testing::ValuesIn( + DirectedTest::TestListGenerator< + DirectedTest::ParametersPackedComplexInplaceInterleaved>() + .parameter_sets(CLFFT_1D, CLFFT_BACKWARD, CLFFT_SINGLE, 101))); #if 0 diff --git a/src/tests/accuracy_test_mixed_callback.cpp b/src/tests/accuracy_test_mixed_callback.cpp index 511b09a8..761ff4b9 100644 --- a/src/tests/accuracy_test_mixed_callback.cpp +++ b/src/tests/accuracy_test_mixed_callback.cpp @@ -15,13 +15,13 @@ * ************************************************************************/ #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -29,477 +29,518 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_callback_single : public ::testing::Test { protected: - accuracy_test_callback_single(){} - virtual ~accuracy_test_callback_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_callback_single() {} + virtual ~accuracy_test_callback_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; class accuracy_test_precallback_double : public ::testing::Test { protected: - accuracy_test_precallback_double(){} - virtual ~accuracy_test_precallback_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_precallback_double() {} + virtual ~accuracy_test_precallback_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; class mixed_radix_precallback : public ::testing::TestWithParam { - protected: - mixed_radix_precallback(){} - virtual ~mixed_radix_precallback(){} - virtual void SetUp(){} - virtual void TearDown(){} +protected: + mixed_radix_precallback() {} + virtual ~mixed_radix_precallback() {} + virtual void SetUp() {} + virtual void TearDown() {} }; class mixed_radix_postcallback : public ::testing::TestWithParam { - protected: - mixed_radix_postcallback(){} - virtual ~mixed_radix_postcallback(){} - virtual void SetUp(){} - virtual void TearDown(){} +protected: + mixed_radix_postcallback() {} + virtual ~mixed_radix_postcallback() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -class Supported_Fft_Sizes_Callback -{ +class Supported_Fft_Sizes_Callback { public: - std::vector sizes; - const size_t max_mixed_radices_to_test; - - Supported_Fft_Sizes_Callback() - : max_mixed_radices_to_test( 4096 ) - { - size_t i=0, j=0, k=0, l=0; - size_t sum, sumi, sumj, sumk, suml; - - sumi = 1; i = 0; - while(1) - { - sumj = 1; j = 0; - while(1) - { - sumk = 1; k = 0; - while(1) - { - suml = 1; l = 0; - while(1) - { - sum = (sumi*sumj*sumk*suml); - if( sum > max_mixed_radices_to_test ) break; - - sizes.push_back(sum); - l++; - suml *= 2; - } - - if(l == 0) break; - k++; - sumk *= 3; - } - - if( (k == 0) && (l == 0) ) break; - j++; - sumj *= 5; - } - - if( (j == 0) && (k == 0) && (l == 0) ) break; - i++; - sumi *= 7; - } - } + std::vector sizes; + const size_t max_mixed_radices_to_test; + + Supported_Fft_Sizes_Callback() : max_mixed_radices_to_test(4096) { + size_t i = 0, j = 0, k = 0, l = 0; + size_t sum, sumi, sumj, sumk, suml; + + sumi = 1; + i = 0; + while (1) { + sumj = 1; + j = 0; + while (1) { + sumk = 1; + k = 0; + while (1) { + suml = 1; + l = 0; + while (1) { + sum = (sumi * sumj * sumk * suml); + if (sum > max_mixed_radices_to_test) + break; + + sizes.push_back(sum); + l++; + suml *= 2; + } + + if (l == 0) + break; + k++; + sumk *= 3; + } + + if ((k == 0) && (l == 0)) + break; + j++; + sumj *= 5; + } + + if ((j == 0) && (k == 0) && (l == 0)) + break; + i++; + sumi *= 7; + } + } } supported_sizes_callback; -INSTANTIATE_TEST_CASE_P( - mixed_radices_precallback, - mixed_radix_precallback, - ::testing::ValuesIn( supported_sizes_callback.sizes ) -); +INSTANTIATE_TEST_CASE_P(mixed_radices_precallback, mixed_radix_precallback, + ::testing::ValuesIn(supported_sizes_callback.sizes)); -INSTANTIATE_TEST_CASE_P( - mixed_radices_postcallback, - mixed_radix_postcallback, - ::testing::ValuesIn( supported_sizes_callback.sizes ) -); +INSTANTIATE_TEST_CASE_P(mixed_radices_postcallback, mixed_radix_postcallback, + ::testing::ValuesIn(supported_sizes_callback.sizes)); -namespace callback_mixed -{ +namespace callback_mixed { /********************************************************************************************** -**************************************Complex To Complex*************************************** +**************************************Complex To +*Complex*************************************** **********************************************************************************************/ #pragma region Complex_To_Complex -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_complex_to_complex_precallback( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_complex_to_complex_precallback(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; + direction::direction_t direction = direction::forward; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix_precallback, single_precision_complex_to_complex_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_complex_to_complex_precallback(problem_size); +TEST_P(mixed_radix_precallback, + single_precision_complex_to_complex_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_complex_to_complex_precallback( + problem_size); } -TEST_P( mixed_radix_precallback, double_precision_complex_to_complex_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_complex_to_complex_precallback(problem_size); +TEST_P(mixed_radix_precallback, + double_precision_complex_to_complex_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_complex_to_complex_precallback( + problem_size); } -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_complex_to_complex_postcallback( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_complex_to_complex_postcallback(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; + direction::direction_t direction = direction::forward; - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix_postcallback, single_precision_complex_to_complex_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_complex_to_complex_postcallback(problem_size); +TEST_P(mixed_radix_postcallback, + single_precision_complex_to_complex_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_complex_to_complex_postcallback( + problem_size); } -TEST_P( mixed_radix_postcallback, double_precision_complex_to_complex_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_complex_to_complex_postcallback(problem_size); +TEST_P(mixed_radix_postcallback, + double_precision_complex_to_complex_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_complex_to_complex_postcallback( + problem_size); } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void precall_normal_1D_forward_in_place_complex_to_complex_userdatatype() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 1.0f, true ); +template +void precall_normal_1D_forward_in_place_complex_to_complex_userdatatype() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 1.0f, + true); } -TEST_F(accuracy_test_callback_single, precall_normal_1D_forward_in_place_complex_to_complex_userdatatype) -{ - try { precall_normal_1D_forward_in_place_complex_to_complex_userdatatype< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_callback_single, + precall_normal_1D_forward_in_place_complex_to_complex_userdatatype) { + try { + precall_normal_1D_forward_in_place_complex_to_complex_userdatatype< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -//Precallback with LDS -template< class T, class cl_T, class fftw_T > -void precall_lds_1D_forward_64_in_place_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 64 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex_lds( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +// Precallback with LDS +template +void precall_lds_1D_forward_64_in_place_complex_to_complex() { + std::vector lengths; + lengths.push_back(64); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex_lds( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_callback_single, precall_lds_1D_forward_64_in_place_complex_to_complex) -{ - try { precall_lds_1D_forward_64_in_place_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_callback_single, + precall_lds_1D_forward_64_in_place_complex_to_complex) { + try { + precall_lds_1D_forward_64_in_place_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -//Postcallback with LDS -template< class T, class cl_T, class fftw_T > -void postcall_lds_1D_forward_64_in_place_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 64 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - postcallback_complex_to_complex_lds( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +// Postcallback with LDS +template +void postcall_lds_1D_forward_64_in_place_complex_to_complex() { + std::vector lengths; + lengths.push_back(64); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + postcallback_complex_to_complex_lds( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_callback_single, postcall_lds_1D_forward_64_in_place_complex_to_complex) -{ - try { postcall_lds_1D_forward_64_in_place_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_callback_single, + postcall_lds_1D_forward_64_in_place_complex_to_complex) { + try { + postcall_lds_1D_forward_64_in_place_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -template< class T, class cl_T, class fftw_T > -void pre_and_post_callback_lds_1D_forward_64_in_place_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 64 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - pre_and_post_callback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 1.0f, true ); +template +void pre_and_post_callback_lds_1D_forward_64_in_place_complex_to_complex() { + std::vector lengths; + lengths.push_back(64); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + pre_and_post_callback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 1.0f, + true); } -TEST_F(accuracy_test_callback_single, pre_and_post_callback_lds_1D_forward_64_in_place_complex_to_complex) -{ - try { pre_and_post_callback_lds_1D_forward_64_in_place_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_callback_single, + pre_and_post_callback_lds_1D_forward_64_in_place_complex_to_complex) { + try { + pre_and_post_callback_lds_1D_forward_64_in_place_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion /********************************************************************************************** -**************************************Complex To Real*************************************** +**************************************Complex To +*Real*************************************** **********************************************************************************************/ #pragma region Complex_To_Real -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_hermitian_to_real_precallback( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_hermitian_to_real_precallback(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; + layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix_precallback, single_precision_hermitian_to_real_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_hermitian_to_real_precallback(problem_size); +TEST_P(mixed_radix_precallback, + single_precision_hermitian_to_real_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_hermitian_to_real_precallback( + problem_size); } -TEST_P( mixed_radix_precallback, double_precision_hermitian_to_real_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_hermitian_to_real_precallback(problem_size); +TEST_P(mixed_radix_precallback, + double_precision_hermitian_to_real_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_hermitian_to_real_precallback( + problem_size); } -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_hermitian_to_real_postcallback( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_hermitian_to_real_postcallback(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; + layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix_postcallback, single_precision_hermitian_to_real_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_hermitian_to_real_postcallback(problem_size); +TEST_P(mixed_radix_postcallback, + single_precision_hermitian_to_real_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_hermitian_to_real_postcallback( + problem_size); } -TEST_P( mixed_radix_postcallback, double_precision_hermitian_to_real_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_hermitian_to_real_postcallback(problem_size); +TEST_P(mixed_radix_postcallback, + double_precision_hermitian_to_real_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_hermitian_to_real_postcallback( + problem_size); } #pragma endregion /********************************************************************************************** -**************************************Real To Complex*************************************** +**************************************Real To +*Complex*************************************** **********************************************************************************************/ #pragma region Real_To_Complex -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_real_to_hermitian_precallback( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_real_to_hermitian_precallback(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; + layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix_precallback, single_precision_real_to_hermitian_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_real_to_hermitian_precallback(problem_size); +TEST_P(mixed_radix_precallback, + single_precision_real_to_hermitian_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_real_to_hermitian_precallback( + problem_size); } -TEST_P( mixed_radix_precallback, double_precision_real_to_hermitian_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_real_to_hermitian_precallback(problem_size); +TEST_P(mixed_radix_precallback, + double_precision_real_to_hermitian_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_real_to_hermitian_precallback( + problem_size); } -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_real_to_hermitian_postcallback( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_real_to_hermitian_postcallback(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; + layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix_postcallback, single_precision_real_to_hermitian_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_real_to_hermitian_postcallback(problem_size); +TEST_P(mixed_radix_postcallback, + single_precision_real_to_hermitian_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_real_to_hermitian_postcallback( + problem_size); } -TEST_P( mixed_radix_postcallback, double_precision_real_to_hermitian_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_real_to_hermitian_postcallback(problem_size); +TEST_P(mixed_radix_postcallback, + double_precision_real_to_hermitian_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_real_to_hermitian_postcallback( + problem_size); } #pragma endregion -} +} // namespace callback_mixed diff --git a/src/tests/accuracy_test_mixed_radices.cpp b/src/tests/accuracy_test_mixed_radices.cpp index 98bacbfb..5676b481 100644 --- a/src/tests/accuracy_test_mixed_radices.cpp +++ b/src/tests/accuracy_test_mixed_radices.cpp @@ -14,469 +14,514 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" -#include "cl_transform.h" #include "accuracy_test_common.h" +#include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include #include class mixed_radix : public ::testing::TestWithParam { - protected: - mixed_radix(){} - virtual ~mixed_radix(){} - virtual void SetUp(){} - virtual void TearDown(){} +protected: + mixed_radix() {} + virtual ~mixed_radix() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_complex_to_complex( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_complex_to_complex(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 500; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 500; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; + direction::direction_t direction = direction::forward; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix, single_precision_complex_to_complex_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_complex_to_complex(problem_size); +TEST_P(mixed_radix, single_precision_complex_to_complex_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_complex_to_complex(problem_size); } -TEST_P( mixed_radix, double_precision_complex_to_complex_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_complex_to_complex(problem_size); +TEST_P(mixed_radix, double_precision_complex_to_complex_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_complex_to_complex(problem_size); } -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_real_to_hermitian( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_real_to_hermitian(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; + layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix, single_precision_real_to_hermitian_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_real_to_hermitian(problem_size); +TEST_P(mixed_radix, single_precision_real_to_hermitian_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_real_to_hermitian(problem_size); } -TEST_P( mixed_radix, double_precision_real_to_hermitian_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_real_to_hermitian(problem_size); +TEST_P(mixed_radix, double_precision_real_to_hermitian_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_real_to_hermitian(problem_size); } -template< typename T, typename cl_T, typename fftw_T > -void mixed_radix_hermitian_to_real( size_t problem_size ) -{ - try - { - if(verbose) std::cout << "Now testing problem size " << problem_size << std::endl; +template +void mixed_radix_hermitian_to_real(size_t problem_size) { + try { + if (verbose) + std::cout << "Now testing problem size " << problem_size << std::endl; - std::vector lengths; - lengths.push_back( problem_size ); - size_t batch = 1; + std::vector lengths; + lengths.push_back(problem_size); + size_t batch = 1; - std::vector input_strides; - std::vector output_strides; + std::vector input_strides; + std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; + size_t input_distance = 0; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; + layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); - } - catch( const std::exception& err ) { - handle_exception(err); - } + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_P( mixed_radix, single_precision_hermitian_to_real_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_hermitian_to_real(problem_size); +TEST_P(mixed_radix, single_precision_hermitian_to_real_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_hermitian_to_real(problem_size); } -TEST_P( mixed_radix, double_precision_hermitian_to_real_auto_generated ) { - size_t problem_size = GetParam(); - RecordProperty("problem_size", (int)problem_size); - mixed_radix_hermitian_to_real(problem_size); +TEST_P(mixed_radix, double_precision_hermitian_to_real_auto_generated) { + size_t problem_size = GetParam(); + RecordProperty("problem_size", (int)problem_size); + mixed_radix_hermitian_to_real(problem_size); } -class Supported_Fft_Sizes -{ +class Supported_Fft_Sizes { public: - std::vector sizes; - const size_t max_mixed_radices_to_test; - - Supported_Fft_Sizes() - : max_mixed_radices_to_test( 4096 ) - { - size_t i=0, j=0, k=0, l=0, m=0, n=0; - size_t sum, sumi, sumj, sumk, suml, summ, sumn; - - sumi = 1; i = 0; - while(1) - { - sumj = 1; j = 0; - while(1) - { - sumk = 1; k = 0; - while(1) - { - suml = 1; l = 0; - while(1) - { - summ = 1; m = 0; - while (1) - { - sumn = 1; n = 0; - while (1) - { - sum = (sumi*sumj*sumk*suml*summ*sumn); - if (sum > max_mixed_radices_to_test) break; - - sizes.push_back(sum); - n++; - sumn *= 2; - } - - if(n == 0) break; - m++; - summ *= 3; - } - - if( (m == 0) && (n == 0) ) break; - l++; - suml *= 5; - } - - if( (l == 0) && (m == 0) && (n == 0) ) break; - k++; - sumk *= 7; - } - - if( (k == 0) && (l == 0) && (m == 0) && (n == 0) ) break; - j++; - sumj *= 11; - } - - if( (j == 0) && (k == 0) && (l == 0) && (m == 0) && (n == 0) ) break; - i++; - sumi *= 13; - } - } + std::vector sizes; + const size_t max_mixed_radices_to_test; + + Supported_Fft_Sizes() : max_mixed_radices_to_test(4096) { + size_t i = 0, j = 0, k = 0, l = 0, m = 0, n = 0; + size_t sum, sumi, sumj, sumk, suml, summ, sumn; + + sumi = 1; + i = 0; + while (1) { + sumj = 1; + j = 0; + while (1) { + sumk = 1; + k = 0; + while (1) { + suml = 1; + l = 0; + while (1) { + summ = 1; + m = 0; + while (1) { + sumn = 1; + n = 0; + while (1) { + sum = (sumi * sumj * sumk * suml * summ * sumn); + if (sum > max_mixed_radices_to_test) + break; + + sizes.push_back(sum); + n++; + sumn *= 2; + } + + if (n == 0) + break; + m++; + summ *= 3; + } + + if ((m == 0) && (n == 0)) + break; + l++; + suml *= 5; + } + + if ((l == 0) && (m == 0) && (n == 0)) + break; + k++; + sumk *= 7; + } + + if ((k == 0) && (l == 0) && (m == 0) && (n == 0)) + break; + j++; + sumj *= 11; + } + + if ((j == 0) && (k == 0) && (l == 0) && (m == 0) && (n == 0)) + break; + i++; + sumi *= 13; + } + } } supported_sizes; -INSTANTIATE_TEST_CASE_P( - mixed_radices, - mixed_radix, - ::testing::ValuesIn( supported_sizes.sizes ) -); +INSTANTIATE_TEST_CASE_P(mixed_radices, mixed_radix, + ::testing::ValuesIn(supported_sizes.sizes)); - // ============================================== // - // the following is a place to stick static tests // - // with mixed radices. the tests will most likely // - // be created in response to failed random tests. // - // ============================================== // +// ============================================== // +// the following is a place to stick static tests // +// with mixed radices. the tests will most likely // +// be created in response to failed random tests. // +// ============================================== // /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_mixed_single : public ::testing::Test { protected: - accuracy_test_mixed_single(){} - virtual ~accuracy_test_mixed_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_mixed_single() {} + virtual ~accuracy_test_mixed_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_mixed_double : public ::testing::Test { protected: - accuracy_test_mixed_double(){} - virtual ~accuracy_test_mixed_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_mixed_double() {} + virtual ~accuracy_test_mixed_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void hermitian_to_real_transforms_with_non_unit_output_strides_should_pass() -{ - std::vector lengths; - lengths.push_back( 10 ); - size_t batch = 1; - - std::vector input_strides; - size_t input_distance = 0; - - std::vector output_strides; - output_strides.push_back( 2 ); - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void hermitian_to_real_transforms_with_non_unit_output_strides_should_pass() { + std::vector lengths; + lengths.push_back(10); + size_t batch = 1; + + std::vector input_strides; + size_t input_distance = 0; + + std::vector output_strides; + output_strides.push_back(2); + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_mixed_single, hermitian_to_real_transforms_with_non_unit_output_strides_should_pass) -{ - try { hermitian_to_real_transforms_with_non_unit_output_strides_should_pass< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_single, + hermitian_to_real_transforms_with_non_unit_output_strides_should_pass) { + try { + hermitian_to_real_transforms_with_non_unit_output_strides_should_pass< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_mixed_double, hermitian_to_real_transforms_with_non_unit_output_strides_should_pass) -{ - try { hermitian_to_real_transforms_with_non_unit_output_strides_should_pass< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_double, + hermitian_to_real_transforms_with_non_unit_output_strides_should_pass) { + try { + hermitian_to_real_transforms_with_non_unit_output_strides_should_pass< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void hermitian_to_real_transforms_with_non_unit_input_strides_should_pass() -{ - std::vector lengths; - lengths.push_back( 6 ); - lengths.push_back( 67500 ); - size_t batch = 1; - - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( 12 ); - size_t input_distance = 810074; - - std::vector output_strides; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void hermitian_to_real_transforms_with_non_unit_input_strides_should_pass() { + std::vector lengths; + lengths.push_back(6); + lengths.push_back(67500); + size_t batch = 1; + + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(12); + size_t input_distance = 810074; + + std::vector output_strides; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_mixed_single, hermitian_to_real_transforms_with_non_unit_input_strides_should_pass) -{ - try { hermitian_to_real_transforms_with_non_unit_input_strides_should_pass< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_single, + hermitian_to_real_transforms_with_non_unit_input_strides_should_pass) { + try { + hermitian_to_real_transforms_with_non_unit_input_strides_should_pass< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_mixed_double, hermitian_to_real_transforms_with_non_unit_input_strides_should_pass) -{ - try { hermitian_to_real_transforms_with_non_unit_input_strides_should_pass< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_double, + hermitian_to_real_transforms_with_non_unit_input_strides_should_pass) { + try { + hermitian_to_real_transforms_with_non_unit_input_strides_should_pass< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_targeted_real_to_hermitian_transform() -{ - std::vector lengths; - lengths.push_back( 15 ); - lengths.push_back( 2 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 1 ); - input_strides.push_back( 16 ); - size_t input_distance = 32; - - std::vector output_strides; - output_strides.push_back( 1 ); - output_strides.push_back( 8 ); - size_t output_distance = 16; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void small_targeted_real_to_hermitian_transform() { + std::vector lengths; + lengths.push_back(15); + lengths.push_back(2); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(1); + input_strides.push_back(16); + size_t input_distance = 32; + + std::vector output_strides; + output_strides.push_back(1); + output_strides.push_back(8); + size_t output_distance = 16; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_mixed_single, small_targeted_real_to_hermitian_transform) -{ - try { small_targeted_real_to_hermitian_transform< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_single, small_targeted_real_to_hermitian_transform) { + try { + small_targeted_real_to_hermitian_transform(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_mixed_double, small_targeted_real_to_hermitian_transform) -{ - try { small_targeted_real_to_hermitian_transform< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_double, small_targeted_real_to_hermitian_transform) { + try { + small_targeted_real_to_hermitian_transform(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void larger_targeted_real_to_hermitian_transform() -{ - std::vector lengths; - lengths.push_back( 15 ); - lengths.push_back( 4500 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 1 ); - input_strides.push_back( 16 ); - size_t input_distance = 72000; - - std::vector output_strides; - output_strides.push_back( 1 ); - output_strides.push_back( 8 ); - size_t output_distance = 36000; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void larger_targeted_real_to_hermitian_transform() { + std::vector lengths; + lengths.push_back(15); + lengths.push_back(4500); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(1); + input_strides.push_back(16); + size_t input_distance = 72000; + + std::vector output_strides; + output_strides.push_back(1); + output_strides.push_back(8); + size_t output_distance = 36000; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_mixed_single, larger_targeted_real_to_hermitian_transform) -{ - try { larger_targeted_real_to_hermitian_transform< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_single, + larger_targeted_real_to_hermitian_transform) { + try { + larger_targeted_real_to_hermitian_transform(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_mixed_double, larger_targeted_real_to_hermitian_transform) -{ - try { larger_targeted_real_to_hermitian_transform< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_double, + larger_targeted_real_to_hermitian_transform) { + try { + larger_targeted_real_to_hermitian_transform(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void another_targeted_real_to_hermitian_transform() -{ - std::vector lengths; - lengths.push_back( 30 ); - lengths.push_back( 10125 ); - size_t batch = 1; - - std::vector input_strides; - input_strides.push_back( 1 ); - input_strides.push_back( 32 ); - size_t input_distance = 324000; - - std::vector output_strides; - output_strides.push_back( 1 ); - output_strides.push_back( 16 ); - size_t output_distance = 162000; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void another_targeted_real_to_hermitian_transform() { + std::vector lengths; + lengths.push_back(30); + lengths.push_back(10125); + size_t batch = 1; + + std::vector input_strides; + input_strides.push_back(1); + input_strides.push_back(32); + size_t input_distance = 324000; + + std::vector output_strides; + output_strides.push_back(1); + output_strides.push_back(16); + size_t output_distance = 162000; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_mixed_single, another_targeted_real_to_hermitian_transform) -{ - try { another_targeted_real_to_hermitian_transform< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_single, + another_targeted_real_to_hermitian_transform) { + try { + another_targeted_real_to_hermitian_transform(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_mixed_double, another_targeted_real_to_hermitian_transform) -{ - try { another_targeted_real_to_hermitian_transform< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_double, + another_targeted_real_to_hermitian_transform) { + try { + another_targeted_real_to_hermitian_transform(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void possible_driver_bug_1D_length_375_fails() -{ - std::vector lengths; - lengths.push_back( 375 ); - size_t batch = 1; +template +void possible_driver_bug_1D_length_375_fails() { + std::vector lengths; + lengths.push_back(375); + size_t batch = 1; - std::vector input_strides; - size_t input_distance = 0; + std::vector input_strides; + size_t input_distance = 0; - std::vector output_strides; - size_t output_distance = 0; + std::vector output_strides; + size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_mixed_single, possible_driver_bug_1D_length_375_fails) -{ - try { possible_driver_bug_1D_length_375_fails< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_single, possible_driver_bug_1D_length_375_fails) { + try { + possible_driver_bug_1D_length_375_fails(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_mixed_double, possible_driver_bug_1D_length_375_fails) -{ - try { possible_driver_bug_1D_length_375_fails< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_mixed_double, possible_driver_bug_1D_length_375_fails) { + try { + possible_driver_bug_1D_length_375_fails(); + } catch (const std::exception &err) { + handle_exception(err); + } } \ No newline at end of file diff --git a/src/tests/accuracy_test_postcallback.cpp b/src/tests/accuracy_test_postcallback.cpp index ef03a191..15f4fdee 100644 --- a/src/tests/accuracy_test_postcallback.cpp +++ b/src/tests/accuracy_test_postcallback.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,1139 +29,1497 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_postcallback_single : public ::testing::Test { protected: - accuracy_test_postcallback_single(){} - virtual ~accuracy_test_postcallback_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_postcallback_single() {} + virtual ~accuracy_test_postcallback_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_postcallback_double : public ::testing::Test { protected: - accuracy_test_postcallback_double(){} - virtual ~accuracy_test_postcallback_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_postcallback_double() {} + virtual ~accuracy_test_postcallback_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace postcallback -{ +namespace postcallback { #pragma region Complex_To_Complex // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + pow2_normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 100 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow2_normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_1D_verysmall_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + pow2_normal_1D_non_unit_stride_and_distance_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(100); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + mixed_normal_1D_val_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow3_small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow3_small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow3_small_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow3_small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 131072 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 131072 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 16777216 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 1048576 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + pow5_normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(131072); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_withEndTranpose_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow2_large_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow2_large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(131072); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar) { + try { + pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar) { + try { + pow2_large_1D_withEndTranpose_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(16777216); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_large_1D_16M_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(1048576); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar) { + try { + pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar) { + try { + pow2_large_1D_1M_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow3_normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow3_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow5_large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow5_large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_2D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { pow2_normal_2D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { pow2_normal_2D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( 8 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { pow2_large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pre_and_post_callback_normal_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - pre_and_post_callback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pre_and_post_callback_normal_complex_to_complex) -{ - try { pre_and_post_callback_normal_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pre_and_post_callback_normal_complex_to_complex) -{ - try { pre_and_post_callback_normal_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pre_and_post_callback_singlepass_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - pre_and_post_callback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pre_and_post_callback_singlepass_complex_to_complex) -{ - try { pre_and_post_callback_singlepass_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pre_and_post_callback_singlepass_complex_to_complex) -{ - try { pre_and_post_callback_singlepass_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow5_small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow5_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow5_large_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow5_large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + pow7_normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow7_large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_2D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + pow2_normal_2D_array_complex_to_complex_with_odd_batch_size< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + pow2_normal_2D_array_complex_to_complex_with_odd_batch_size< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(8); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + pow2_small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + pow2_large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + pow2_large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow3_normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + pow5_large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + pow7_small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + pow2_normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + pow3_normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pre_and_post_callback_normal_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + pre_and_post_callback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pre_and_post_callback_normal_complex_to_complex) { + try { + pre_and_post_callback_normal_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pre_and_post_callback_normal_complex_to_complex) { + try { + pre_and_post_callback_normal_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pre_and_post_callback_singlepass_complex_to_complex() { + std::vector lengths; + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + pre_and_post_callback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pre_and_post_callback_singlepass_complex_to_complex) { + try { + pre_and_post_callback_singlepass_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pre_and_post_callback_singlepass_complex_to_complex) { + try { + pre_and_post_callback_singlepass_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion @@ -1171,1567 +1528,2048 @@ TEST_F(accuracy_test_postcallback_double, pre_and_post_callback_singlepass_compl // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow2_normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow2_normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_array_real_to_hermitian) -{ - try { pow2_normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_array_real_to_hermitian) -{ - try { pow2_normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow3_normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow3_normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow5_normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow5_normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_small_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow7_small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_small_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow7_small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_4M_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 4194304 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_4M_in_place_real_to_hermitian_interleaved) -{ - try { pow2_large_1D_4M_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_4M_in_place_real_to_hermitian_interleaved) -{ - try { pow2_large_1D_4M_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_4M_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( 4194304 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_4M_out_of_place_real_to_hermitian_planar) -{ - try { pow2_large_1D_4M_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_4M_out_of_place_real_to_hermitian_planar) -{ - try { pow2_large_1D_4M_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_large_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow3_large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_large_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow3_large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_large_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow3_large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_large_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow3_large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow3_large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow3_large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow5_large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_1D_out_of_place_real_to_hermitian_planar) -{ - try { pow5_large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_large_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow7_large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_large_1D_in_place_real_to_hermitian_interleaved) -{ - try { pow7_large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { pow2_normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { pow2_normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_2D_array_real_to_hermitian) -{ - try { pow2_small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_2D_array_real_to_hermitian) -{ - try { pow2_small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow2_large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow2_large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { pow3_normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { pow3_normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow5_large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { pow5_large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back(5); - input_strides.push_back(lengths[0] * input_strides[0] + 1); - - std::vector output_strides; - output_strides.push_back(2); - output_strides.push_back(lengths[0] * output_strides[0] + 2); - - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 30; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { pow2_normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - input_strides.push_back( lengths[1] * input_strides[1] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - output_strides.push_back( lengths[1] * output_strides[1] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_large_3D_out_of_place_real_to_hermitian_planar) -{ - try { pow3_large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_large_3D_out_of_place_real_to_hermitian_planar) -{ - try { pow3_large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow2_normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_in_place_real_to_hermitian_interleaved) { + try { + pow2_normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_in_place_real_to_hermitian_interleaved) { + try { + pow2_normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_out_of_place_real_to_hermitian_planar) { + try { + pow2_normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_out_of_place_real_to_hermitian_planar) { + try { + pow2_normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_1D_in_place_real_to_hermitian_interleaved) { + try { + pow2_small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_1D_in_place_real_to_hermitian_interleaved) { + try { + pow2_small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_array_real_to_hermitian) { + try { + pow2_normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_array_real_to_hermitian) { + try { + pow2_normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(16); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); + + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_postcallback_single, + pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_postcallback_double, + pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + pow2_very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + pow3_normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + pow3_normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + pow5_normal_1D_array_real_to_hermitian_with_odd_batch_size< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_normal_1D_out_of_place_real_to_hermitian_planar) { + try { + pow5_normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_normal_1D_out_of_place_real_to_hermitian_planar) { + try { + pow5_normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_small_1D_in_place_real_to_hermitian_interleaved) { + try { + pow7_small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_small_1D_in_place_real_to_hermitian_interleaved) { + try { + pow7_small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_in_place_real_to_hermitian_interleaved) { + try { + pow2_large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_in_place_real_to_hermitian_interleaved) { + try { + pow2_large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_4M_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(4194304); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_4M_in_place_real_to_hermitian_interleaved) { + try { + pow2_large_1D_4M_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_4M_in_place_real_to_hermitian_interleaved) { + try { + pow2_large_1D_4M_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_4M_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(4194304); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_4M_out_of_place_real_to_hermitian_planar) { + try { + pow2_large_1D_4M_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_4M_out_of_place_real_to_hermitian_planar) { + try { + pow2_large_1D_4M_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_large_1D_out_of_place_real_to_hermitian_planar) { + try { + pow3_large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_large_1D_out_of_place_real_to_hermitian_planar) { + try { + pow3_large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_large_1D_in_place_real_to_hermitian_interleaved) { + try { + pow3_large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_large_1D_in_place_real_to_hermitian_interleaved) { + try { + pow3_large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + pow3_large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + pow3_large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_1D_out_of_place_real_to_hermitian_planar) { + try { + pow5_large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_1D_out_of_place_real_to_hermitian_planar) { + try { + pow5_large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_large_1D_in_place_real_to_hermitian_interleaved) { + try { + pow7_large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_large_1D_in_place_real_to_hermitian_interleaved) { + try { + pow7_large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_2D_in_place_real_to_hermitian_interleaved) { + try { + pow2_normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_2D_in_place_real_to_hermitian_interleaved) { + try { + pow2_normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_2D_out_of_place_real_to_hermitian_planar) { + try { + pow2_normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_2D_out_of_place_real_to_hermitian_planar) { + try { + pow2_normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_2D_array_real_to_hermitian) { + try { + pow2_small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_2D_array_real_to_hermitian) { + try { + pow2_small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + pow2_large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + pow2_large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); + + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + pow2_small_2D_non_unit_stride_and_distance_real_to_hermitian< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_normal_2D_in_place_real_to_hermitian_interleaved) { + try { + pow3_normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_normal_2D_in_place_real_to_hermitian_interleaved) { + try { + pow3_normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + pow5_large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + pow5_large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); + + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + pow7_small_2D_non_unit_stride_and_distance_real_to_hermitian< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_3D_in_place_real_to_hermitian_interleaved) { + try { + pow2_normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_3D_in_place_real_to_hermitian_interleaved) { + try { + pow2_normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); + input_strides.push_back(lengths[1] * input_strides[1] + 1); + + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + output_strides.push_back(lengths[1] * output_strides[1] + 2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian) { + try { + pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian) { + try { + pow2_small_3D_non_unit_stride_and_distance_real_to_hermitian< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_large_3D_out_of_place_real_to_hermitian_planar) { + try { + pow3_large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_large_3D_out_of_place_real_to_hermitian_planar) { + try { + pow3_large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion #pragma region Complex_To_Real -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow2_normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow2_normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_1D_user_defined_scale_hermitian_to_real) -{ - try { pow2_normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_1D_user_defined_scale_hermitian_to_real) -{ - try { pow2_normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_1D_non_unit_stride_hermitian_to_real) -{ - try { pow2_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_1D_non_unit_stride_hermitian_to_real) -{ - try { pow2_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow3_normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow3_normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_small_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow5_small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_small_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow5_small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow7_normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow7_normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow2_large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow2_large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_large_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow2_large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_large_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow2_large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_large_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow3_large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_large_1D_in_place_hermitian_interleaved_to_real) -{ - try { pow3_large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow5_large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_1D_out_of_place_hermitian_planar_to_real) -{ - try { pow5_large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow7_large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow7_large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { pow3_normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { pow3_normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow5_large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow5_large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow7_small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_postcallback_single, pow7_small_2D_in_place_hermitian_interleaved_to_real) -{ - try { pow7_small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow7_small_2D_in_place_hermitian_interleaved_to_real) -{ - try { pow7_small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { pow2_normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - input_strides.push_back( lengths[1] * input_strides[1] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - output_strides.push_back( lengths[1] * output_strides[1] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow3_normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow3_normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { pow3_normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow3_normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { pow3_normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void pow5_large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - postcallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_postcallback_single, pow5_large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow5_large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_postcallback_double, pow5_large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { pow5_large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void pow2_normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_in_place_hermitian_interleaved_to_real) { + try { + pow2_normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_in_place_hermitian_interleaved_to_real) { + try { + pow2_normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow2_normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow2_normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_out_of_place_hermitian_planar_to_real) { + try { + pow2_normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_out_of_place_hermitian_planar_to_real) { + try { + pow2_normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_1D_user_defined_scale_hermitian_to_real) { + try { + pow2_normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_1D_user_defined_scale_hermitian_to_real) { + try { + pow2_normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_1D_non_unit_stride_hermitian_to_real) { + try { + pow2_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_1D_non_unit_stride_hermitian_to_real) { + try { + pow2_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow3_normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow3_normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_small_1D_out_of_place_hermitian_planar_to_real) { + try { + pow5_small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_small_1D_out_of_place_hermitian_planar_to_real) { + try { + pow5_small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_normal_1D_in_place_hermitian_interleaved_to_real) { + try { + pow7_normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_normal_1D_in_place_hermitian_interleaved_to_real) { + try { + pow7_normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_in_place_hermitian_interleaved_to_real) { + try { + pow2_large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_in_place_hermitian_interleaved_to_real) { + try { + pow2_large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow2_large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow2_large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_large_1D_out_of_place_hermitian_planar_to_real) { + try { + pow2_large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_large_1D_out_of_place_hermitian_planar_to_real) { + try { + pow2_large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_large_1D_in_place_hermitian_interleaved_to_real) { + try { + pow3_large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_large_1D_in_place_hermitian_interleaved_to_real) { + try { + pow3_large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_1D_out_of_place_hermitian_planar_to_real) { + try { + pow5_large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_1D_out_of_place_hermitian_planar_to_real) { + try { + pow5_large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow7_large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + pow7_large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_2D_in_place_hermitian_interleaved_to_real) { + try { + pow2_normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_2D_in_place_hermitian_interleaved_to_real) { + try { + pow2_normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + pow2_small_2D_non_unit_stride_and_distance_hermitian_to_real< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_normal_2D_out_of_place_hermitian_planar_to_real) { + try { + pow3_normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_normal_2D_out_of_place_hermitian_planar_to_real) { + try { + pow3_normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + pow5_large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + pow5_large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow7_small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow7_small_2D_in_place_hermitian_interleaved_to_real) { + try { + pow7_small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow7_small_2D_in_place_hermitian_interleaved_to_real) { + try { + pow7_small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_normal_3D_in_place_hermitian_interleaved_to_real) { + try { + pow2_normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_normal_3D_in_place_hermitian_interleaved_to_real) { + try { + pow2_normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); + input_strides.push_back(lengths[1] * input_strides[1] + 1); + + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + output_strides.push_back(lengths[1] * output_strides[1] + 2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real) { + try { + pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real) { + try { + pow2_small_3D_non_unit_stride_and_distance_hermitian_to_real< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow3_normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow3_normal_3D_out_of_place_hermitian_planar_to_real) { + try { + pow3_normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow3_normal_3D_out_of_place_hermitian_planar_to_real) { + try { + pow3_normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void pow5_large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + postcallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_postcallback_single, + pow5_large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + pow5_large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_postcallback_double, + pow5_large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + pow5_large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // @@ -2741,291 +3579,564 @@ TEST_F(accuracy_test_postcallback_double, pow5_large_3D_out_of_place_hermitian_i // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T> -void huge_1D_forward_in_place_complex_to_complex(size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, direction::direction_t direction_type) -{ - std::vector lengths; - lengths.push_back(lenSize); - size_t batch = batchSize; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layoutType; - layout::buffer_layout_t out_layout = layoutType; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction_type; - - data_pattern pattern = sawtooth; - postcallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} -//TESTS disabled by default since they take a long time to execute -//TO enable this tests -//1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 -//2. pass --gtest_also_run_disabled_tests to TEST.exe - -//177147 = 243 * 243 * 3, forward (no need for backward), planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -//interleaved -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1594323 = 729 * 729 * 3 foward (no need for backward), planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//14348907 = 2187 * 2187 * 3 backward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//78125 = 125 * 125 * 5, forward planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1953125 = 625 * 625 * 5 forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//48828125 = 3125 * 3125 * 5 forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_postcallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } +template +void huge_1D_forward_in_place_complex_to_complex( + size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, + direction::direction_t direction_type) { + std::vector lengths; + lengths.push_back(lenSize); + size_t batch = batchSize; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layoutType; + layout::buffer_layout_t out_layout = layoutType; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction_type; + + data_pattern pattern = sawtooth; + postcallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} +// TESTS disabled by default since they take a long time to execute +// TO enable this tests +// 1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 +// 2. pass --gtest_also_run_disabled_tests to TEST.exe + +// 177147 = 243 * 243 * 3, forward (no need for backward), planar and +// interleaved, single and double, batch size 1 and 3 +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// interleaved +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1594323 = 729 * 729 * 3 foward (no need for backward), planar and +// interleaved, single and double, batch size 1 and 3 +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 14348907 = 2187 * 2187 * 3 backward, planar and interleaved, single and +// double, batch size 1 and 3 +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 78125 = 125 * 125 * 5, forward planar and interleaved, single and double, +// batch size 1 and 3 +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1953125 = 625 * 625 * 5 forward, planar and interleaved, single and double, +// batch size 1 and 3 +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 48828125 = 3125 * 3125 * 5 forward, planar and interleaved, single and +// double, batch size 1 and 3 +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_postcallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion -} //namespace +} // namespace postcallback diff --git a/src/tests/accuracy_test_pow2.cpp b/src/tests/accuracy_test_pow2.cpp index c3b0a848..06647bce 100644 --- a/src/tests/accuracy_test_pow2.cpp +++ b/src/tests/accuracy_test_pow2.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7498 +29,9463 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow2_single : public ::testing::Test { protected: - accuracy_test_pow2_single(){} - virtual ~accuracy_test_pow2_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow2_single() {} + virtual ~accuracy_test_pow2_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow2_double : public ::testing::Test { protected: - accuracy_test_pow2_double(){} - virtual ~accuracy_test_pow2_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow2_double() {} + virtual ~accuracy_test_pow2_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace power2 -{ +namespace power2 { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 65536 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(65536); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; -TEST_F(accuracy_test_pow2_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow2_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; +// TESTS disabled by default since they take a long time to execute +// TO enable this tests +// 1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 +// 2. pass --gtest_also_run_disabled_tests to TEST.exe - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} +#define CLFFT_TEST_HUGE +#ifdef CLFFT_TEST_HUGE -TEST_F(accuracy_test_pow2_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +#define HUGE_TEST_MAKE(test_name, len, bat) \ + template void test_name() { \ + std::vector lengths; \ + lengths.push_back(len); \ + size_t batch = bat; \ + \ + std::vector input_strides; \ + std::vector output_strides; \ + size_t input_distance = 0; \ + size_t output_distance = 0; \ + layout::buffer_layout_t in_layout = layout::complex_planar; \ + layout::buffer_layout_t out_layout = layout::complex_planar; \ + placeness::placeness_t placeness = placeness::in_place; \ + direction::direction_t direction = direction::forward; \ + \ + data_pattern pattern = sawtooth; \ + complex_to_complex( \ + pattern, direction, lengths, batch, input_strides, output_strides, \ + input_distance, output_distance, in_layout, out_layout, placeness); \ + } + +#define SP_HUGE_TEST(test_name, len, bat) \ + \ + HUGE_TEST_MAKE(test_name, len, bat) \ + \ + TEST_F(accuracy_test_pow2_single, test_name) { \ + try { \ + test_name(); \ + } catch (const std::exception &err) { \ + handle_exception(err); \ + } \ + } + +#define DP_HUGE_TEST(test_name, len, bat) \ + \ + HUGE_TEST_MAKE(test_name, len, bat) \ + \ + TEST_F(accuracy_test_pow2_double, test_name) { \ + try { \ + test_name(); \ + } catch (const std::exception &err) { \ + handle_exception(err); \ + } \ + } + +SP_HUGE_TEST(DISABLED_huge_sp_test_1, 1048576, 11) +SP_HUGE_TEST(DISABLED_huge_sp_test_2, 1048576 * 2, 7) +SP_HUGE_TEST(DISABLED_huge_sp_test_3, 1048576 * 4, 3) +SP_HUGE_TEST(DISABLED_huge_sp_test_4, 1048576 * 8, 5) +SP_HUGE_TEST(DISABLED_huge_sp_test_5, 1048576 * 16, 3) +SP_HUGE_TEST(DISABLED_huge_sp_test_6, 1048576 * 32, 2) +SP_HUGE_TEST(DISABLED_huge_sp_test_7, 1048576 * 64, 1) + +DP_HUGE_TEST(DISABLED_huge_dp_test_1, 524288, 11) +DP_HUGE_TEST(DISABLED_huge_dp_test_2, 524288 * 2, 7) +DP_HUGE_TEST(DISABLED_huge_dp_test_3, 524288 * 4, 3) +DP_HUGE_TEST(DISABLED_huge_dp_test_4, 524288 * 8, 5) +DP_HUGE_TEST(DISABLED_huge_dp_test_5, 524288 * 16, 3) +DP_HUGE_TEST(DISABLED_huge_dp_test_6, 524288 * 32, 2) +DP_HUGE_TEST(DISABLED_huge_dp_test_7, 524288 * 64, 1) + +SP_HUGE_TEST(DISABLED_large_sp_test_1, 8192, 11) +SP_HUGE_TEST(DISABLED_large_sp_test_2, 8192 * 2, 7) +SP_HUGE_TEST(DISABLED_large_sp_test_3, 8192 * 4, 3) +SP_HUGE_TEST(DISABLED_large_sp_test_4, 8192 * 8, 5) +SP_HUGE_TEST(DISABLED_large_sp_test_5, 8192 * 16, 3) +SP_HUGE_TEST(DISABLED_large_sp_test_6, 8192 * 32, 21) +SP_HUGE_TEST(DISABLED_large_sp_test_7, 8192 * 64, 17) + +DP_HUGE_TEST(DISABLED_large_dp_test_1, 4096, 11) +DP_HUGE_TEST(DISABLED_large_dp_test_2, 4096 * 2, 7) +DP_HUGE_TEST(DISABLED_large_dp_test_3, 4096 * 4, 3) +DP_HUGE_TEST(DISABLED_large_dp_test_4, 4096 * 8, 5) +DP_HUGE_TEST(DISABLED_large_dp_test_5, 4096 * 16, 3) +DP_HUGE_TEST(DISABLED_large_dp_test_6, 4096 * 32, 21) +DP_HUGE_TEST(DISABLED_large_dp_test_7, 4096 * 64, 17) -TEST_F(accuracy_test_pow2_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +#endif // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_4M_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(4194304); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_4M_in_place_real_to_hermitian_interleaved) { + try { + large_1D_4M_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_4M_in_place_real_to_hermitian_interleaved) { + try { + large_1D_4M_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_single, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_single, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(2); + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(large2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(2); + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(large2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow2_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +TEST_F(accuracy_test_pow2_single, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_complex_to_complex() { + std::vector lengths; + lengths.push_back(1024); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(8); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(8); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow2_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; -TEST_F(accuracy_test_pow2_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; -TEST_F(accuracy_test_pow2_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow2_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow2_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow2_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow2_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow2_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_pow2_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +TEST_F( + accuracy_test_pow2_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow2_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow2_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + std::vector output_strides; + + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow2_single, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; -TEST_F(accuracy_test_pow2_single, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow2_double, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; -TEST_F(accuracy_test_pow2_single, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow2_double, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow2_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_single, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_single, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(large2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(large2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_single, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_single, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_single, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_single, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_double, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_single, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_single, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; -TEST_F(accuracy_test_pow2_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides(input_strides); + size_t output_distance = input_distance; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow2_single, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow2_single, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -//TESTS disabled by default since they take a long time to execute -//TO enable this tests -//1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 -//2. pass --gtest_also_run_disabled_tests to TEST.exe - -#define CLFFT_TEST_HUGE -#ifdef CLFFT_TEST_HUGE - -#define HUGE_TEST_MAKE(test_name, len, bat) \ -template< class T, class cl_T, class fftw_T > \ -void test_name() \ -{ \ - std::vector lengths; \ - lengths.push_back( len ); \ - size_t batch = bat; \ -\ - std::vector input_strides; \ - std::vector output_strides; \ - size_t input_distance = 0; \ - size_t output_distance = 0; \ - layout::buffer_layout_t in_layout = layout::complex_planar; \ - layout::buffer_layout_t out_layout = layout::complex_planar; \ - placeness::placeness_t placeness = placeness::in_place; \ - direction::direction_t direction = direction::forward; \ -\ - data_pattern pattern = sawtooth; \ - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); \ -} - -#define SP_HUGE_TEST(test_name, len, bat) \ -\ - HUGE_TEST_MAKE(test_name, len, bat) \ -\ - TEST_F(accuracy_test_pow2_single, test_name) \ - { \ - try { test_name< float, cl_float, fftwf_complex >(); } \ - catch( const std::exception& err ) { handle_exception(err); } \ - } - -#define DP_HUGE_TEST(test_name, len, bat) \ -\ - HUGE_TEST_MAKE(test_name, len, bat) \ -\ - TEST_F(accuracy_test_pow2_double, test_name) \ - { \ - try { test_name< double, cl_double, fftw_complex >(); } \ - catch( const std::exception& err ) { handle_exception(err); } \ - } - -SP_HUGE_TEST( DISABLED_huge_sp_test_1, 1048576, 11 ) -SP_HUGE_TEST( DISABLED_huge_sp_test_2, 1048576*2, 7 ) -SP_HUGE_TEST( DISABLED_huge_sp_test_3, 1048576*4, 3 ) -SP_HUGE_TEST( DISABLED_huge_sp_test_4, 1048576*8, 5 ) -SP_HUGE_TEST( DISABLED_huge_sp_test_5, 1048576*16, 3 ) -SP_HUGE_TEST( DISABLED_huge_sp_test_6, 1048576*32, 2 ) -SP_HUGE_TEST( DISABLED_huge_sp_test_7, 1048576*64, 1 ) - -DP_HUGE_TEST( DISABLED_huge_dp_test_1, 524288, 11 ) -DP_HUGE_TEST( DISABLED_huge_dp_test_2, 524288*2, 7 ) -DP_HUGE_TEST( DISABLED_huge_dp_test_3, 524288*4, 3 ) -DP_HUGE_TEST( DISABLED_huge_dp_test_4, 524288*8, 5 ) -DP_HUGE_TEST( DISABLED_huge_dp_test_5, 524288*16, 3 ) -DP_HUGE_TEST( DISABLED_huge_dp_test_6, 524288*32, 2 ) -DP_HUGE_TEST( DISABLED_huge_dp_test_7, 524288*64, 1 ) - -SP_HUGE_TEST( DISABLED_large_sp_test_1, 8192, 11 ) -SP_HUGE_TEST( DISABLED_large_sp_test_2, 8192*2, 7 ) -SP_HUGE_TEST( DISABLED_large_sp_test_3, 8192*4, 3 ) -SP_HUGE_TEST( DISABLED_large_sp_test_4, 8192*8, 5 ) -SP_HUGE_TEST( DISABLED_large_sp_test_5, 8192*16, 3 ) -SP_HUGE_TEST( DISABLED_large_sp_test_6, 8192*32, 21 ) -SP_HUGE_TEST( DISABLED_large_sp_test_7, 8192*64, 17 ) - -DP_HUGE_TEST( DISABLED_large_dp_test_1, 4096, 11 ) -DP_HUGE_TEST( DISABLED_large_dp_test_2, 4096*2, 7 ) -DP_HUGE_TEST( DISABLED_large_dp_test_3, 4096*4, 3 ) -DP_HUGE_TEST( DISABLED_large_dp_test_4, 4096*8, 5 ) -DP_HUGE_TEST( DISABLED_large_dp_test_5, 4096*16, 3 ) -DP_HUGE_TEST( DISABLED_large_dp_test_6, 4096*32, 21 ) -DP_HUGE_TEST( DISABLED_large_dp_test_7, 4096*64, 17 ) - -#endif - // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void normal_2D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow2_single, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void testcase_2D_round_trip_complex_to_complex(size_t l0, size_t l1) { + std::vector lengths; + lengths.push_back(l0); + lengths.push_back(l1); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; -TEST_F(accuracy_test_pow2_double, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +// added this regression test to catch failures seen in transposes +TEST_F(accuracy_test_pow2_single, testcase1_2D_round_trip_complex_to_complex) { + try { + testcase_2D_round_trip_complex_to_complex( + 1024, 16); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void small_3D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow2_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow2_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; +template +void large_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow2_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void normal_2D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow2_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_4M_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 4194304 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_4M_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_4M_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_4M_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_4M_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( 2 ); - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( large2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( 2 ); - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( large2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void astoundingly_large_1D_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1024 ); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_non_unit_stride_real_to_hermitian) -{ - try {small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_non_unit_stride_real_to_hermitian) -{ - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 8 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 8 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 2; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = 0; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - std::vector output_strides; - - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_single, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_single, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - output_strides.push_back( lengths[0] * output_strides[0] + 20 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - output_strides.push_back( lengths[0] * output_strides[0] + 19 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void rectangular_2D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( large2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( large2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_single, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_single, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_single, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_single, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - input_strides.push_back( lengths[1] * input_strides[1] + 17 ); - - std::vector output_strides( input_strides ); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - input_strides.push_back( lengths[1] * input_strides[1] + 3 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -template< class T, class cl_T, class fftw_T > -void testcase_2D_round_trip_complex_to_complex(size_t l0, size_t l1) -{ - std::vector lengths; - lengths.push_back( l0 ); - lengths.push_back( l1 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -// added this regression test to catch failures seen in transposes -TEST_F(accuracy_test_pow2_single, testcase1_2D_round_trip_complex_to_complex) -{ - try { testcase_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(1024, 16); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_single, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow2_single, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow2_single, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow2_single, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow2_single, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_double, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; +template +void small_3D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow2_single, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_single, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_double, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_double, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -} //namespace +} // namespace power2 diff --git a/src/tests/accuracy_test_pow2_precallback.cpp b/src/tests/accuracy_test_pow2_precallback.cpp index 9bb78bfe..5a2fcd7a 100644 --- a/src/tests/accuracy_test_pow2_precallback.cpp +++ b/src/tests/accuracy_test_pow2_precallback.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7559 +29,9600 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow2_precallback_single : public ::testing::Test { protected: - accuracy_test_pow2_precallback_single(){} - virtual ~accuracy_test_pow2_precallback_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow2_precallback_single() {} + virtual ~accuracy_test_pow2_precallback_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow2_precallback_double : public ::testing::Test { protected: - accuracy_test_pow2_precallback_double(){} - virtual ~accuracy_test_pow2_precallback_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow2_precallback_double() {} + virtual ~accuracy_test_pow2_precallback_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace precallback_pow2 -{ +namespace precallback_pow2 { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 65536 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(65536); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + len65536_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_1D_1048576_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(1048576); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_1048576_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_1048576_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_1048576_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_1048576_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} +//#define CLFFT_TEST_HUGE +#ifdef CLFFT_TEST_HUGE -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +#define HUGE_TEST_MAKE(test_name, len, bat) \ + template void test_name() { \ + std::vector lengths; \ + lengths.push_back(len); \ + size_t batch = bat; \ + \ + std::vector input_strides; \ + std::vector output_strides; \ + size_t input_distance = 0; \ + size_t output_distance = 0; \ + layout::buffer_layout_t in_layout = layout::complex_planar; \ + layout::buffer_layout_t out_layout = layout::complex_planar; \ + placeness::placeness_t placeness = placeness::in_place; \ + direction::direction_t direction = direction::forward; \ + \ + data_pattern pattern = sawtooth; \ + precallback_complex_to_complex( \ + pattern, direction, lengths, batch, input_strides, output_strides, \ + input_distance, output_distance, in_layout, out_layout, placeness); \ + } + +#define SP_HUGE_TEST(test_name, len, bat) \ + \ + HUGE_TEST_MAKE(test_name, len, bat) \ + \ + TEST_F(accuracy_test_pow2_precallback_single, test_name) { \ + try { \ + test_name(); \ + } catch (const std::exception &err) { \ + handle_exception(err); \ + } \ + } + +#define DP_HUGE_TEST(test_name, len, bat) \ + \ + HUGE_TEST_MAKE(test_name, len, bat) \ + \ + TEST_F(accuracy_test_pow2_precallback_double, test_name) { \ + try { \ + test_name(); \ + } catch (const std::exception &err) { \ + handle_exception(err); \ + } \ + } + +SP_HUGE_TEST(huge_sp_test_1, 1048576, 11) +SP_HUGE_TEST(huge_sp_test_2, 1048576 * 2, 7) +SP_HUGE_TEST(huge_sp_test_3, 1048576 * 4, 3) +SP_HUGE_TEST(huge_sp_test_4, 1048576 * 8, 5) +SP_HUGE_TEST(huge_sp_test_5, 1048576 * 16, 3) +SP_HUGE_TEST(huge_sp_test_6, 1048576 * 32, 2) +SP_HUGE_TEST(huge_sp_test_7, 1048576 * 64, 1) + +DP_HUGE_TEST(huge_dp_test_1, 524288, 11) +DP_HUGE_TEST(huge_dp_test_2, 524288 * 2, 7) +DP_HUGE_TEST(huge_dp_test_3, 524288 * 4, 3) +DP_HUGE_TEST(huge_dp_test_4, 524288 * 8, 5) +DP_HUGE_TEST(huge_dp_test_5, 524288 * 16, 3) +DP_HUGE_TEST(huge_dp_test_6, 524288 * 32, 2) +DP_HUGE_TEST(huge_dp_test_7, 524288 * 64, 1) + +SP_HUGE_TEST(large_sp_test_1, 8192, 11) +SP_HUGE_TEST(large_sp_test_2, 8192 * 2, 7) +SP_HUGE_TEST(large_sp_test_3, 8192 * 4, 3) +SP_HUGE_TEST(large_sp_test_4, 8192 * 8, 5) +SP_HUGE_TEST(large_sp_test_5, 8192 * 16, 3) +SP_HUGE_TEST(large_sp_test_6, 8192 * 32, 21) +SP_HUGE_TEST(large_sp_test_7, 8192 * 64, 17) + +DP_HUGE_TEST(large_dp_test_1, 4096, 11) +DP_HUGE_TEST(large_dp_test_2, 4096 * 2, 7) +DP_HUGE_TEST(large_dp_test_3, 4096 * 4, 3) +DP_HUGE_TEST(large_dp_test_4, 4096 * 8, 5) +DP_HUGE_TEST(large_dp_test_5, 4096 * 16, 3) +DP_HUGE_TEST(large_dp_test_6, 4096 * 32, 21) +DP_HUGE_TEST(large_dp_test_7, 4096 * 64, 17) -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +#endif // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(1048576); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_4M_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(4194304); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_4M_in_place_real_to_hermitian_interleaved) { + try { + large_1D_4M_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_4M_in_place_real_to_hermitian_interleaved) { + try { + large_1D_4M_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(2)); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow2_precallback_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(2); + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(large2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(2); + lengths.push_back(large2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large2); + lengths.push_back(2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(2); + lengths.push_back(large2); + lengths.push_back(2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void normal_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} -TEST_F(accuracy_test_pow2_precallback_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_complex_to_complex() { + std::vector lengths; + lengths.push_back(1024); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(8); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(8); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; -TEST_F(accuracy_test_pow2_precallback_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; -TEST_F(accuracy_test_pow2_precallback_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow2_precallback_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow2_precallback_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow2_precallback_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(4); + size_t batch = 2; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + std::vector input_strides; + input_strides.push_back(16); -TEST_F(accuracy_test_pow2_precallback_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow2_precallback_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_pow2_precallback_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } +TEST_F( + accuracy_test_pow2_precallback_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** // ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + std::vector output_strides; + + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; -TEST_F(accuracy_test_pow2_precallback_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; -TEST_F(accuracy_test_pow2_precallback_single, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; -TEST_F(accuracy_test_pow2_precallback_double, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(4); + lengths.push_back(4); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(normal2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(small2); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(large2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(large2); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow2_precallback_single, + single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +// ***************************************************** +// ***************************************************** +template +void normal_1D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +template +void normal_2D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} +template +void testcase_2D_round_trip_complex_to_complex(size_t l0, size_t l1) { + std::vector lengths; + lengths.push_back(l0); + lengths.push_back(l1); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; -TEST_F(accuracy_test_pow2_precallback_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +// added this regression test to catch failures seen in transposes +TEST_F(accuracy_test_pow2_precallback_single, + testcase1_2D_round_trip_complex_to_complex) { + try { + testcase_2D_round_trip_complex_to_complex( + 1024, 16); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; +template +void small_3D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow2_precallback_single, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_1D_1048576_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 1048576 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow2_precallback_single, large_1D_1048576_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_1048576_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, large_1D_1048576_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_1048576_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ***************************************************** // ***************************************************** +template +void large_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(large2); + size_t batch = 1; -//#define CLFFT_TEST_HUGE -#ifdef CLFFT_TEST_HUGE - -#define HUGE_TEST_MAKE(test_name, len, bat) \ -template< class T, class cl_T, class fftw_T > \ -void test_name() \ -{ \ - std::vector lengths; \ - lengths.push_back( len ); \ - size_t batch = bat; \ -\ - std::vector input_strides; \ - std::vector output_strides; \ - size_t input_distance = 0; \ - size_t output_distance = 0; \ - layout::buffer_layout_t in_layout = layout::complex_planar; \ - layout::buffer_layout_t out_layout = layout::complex_planar; \ - placeness::placeness_t placeness = placeness::in_place; \ - direction::direction_t direction = direction::forward; \ -\ - data_pattern pattern = sawtooth; \ - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); \ -} - -#define SP_HUGE_TEST(test_name, len, bat) \ -\ - HUGE_TEST_MAKE(test_name, len, bat) \ -\ - TEST_F(accuracy_test_pow2_precallback_single, test_name) \ - { \ - try { test_name< float, cl_float, fftwf_complex >(); } \ - catch( const std::exception& err ) { handle_exception(err); } \ - } - -#define DP_HUGE_TEST(test_name, len, bat) \ -\ - HUGE_TEST_MAKE(test_name, len, bat) \ -\ - TEST_F(accuracy_test_pow2_precallback_double, test_name) \ - { \ - try { test_name< double, cl_double, fftw_complex >(); } \ - catch( const std::exception& err ) { handle_exception(err); } \ - } - -SP_HUGE_TEST( huge_sp_test_1, 1048576, 11 ) -SP_HUGE_TEST( huge_sp_test_2, 1048576*2, 7 ) -SP_HUGE_TEST( huge_sp_test_3, 1048576*4, 3 ) -SP_HUGE_TEST( huge_sp_test_4, 1048576*8, 5 ) -SP_HUGE_TEST( huge_sp_test_5, 1048576*16, 3 ) -SP_HUGE_TEST( huge_sp_test_6, 1048576*32, 2 ) -SP_HUGE_TEST( huge_sp_test_7, 1048576*64, 1 ) - -DP_HUGE_TEST( huge_dp_test_1, 524288, 11 ) -DP_HUGE_TEST( huge_dp_test_2, 524288*2, 7 ) -DP_HUGE_TEST( huge_dp_test_3, 524288*4, 3 ) -DP_HUGE_TEST( huge_dp_test_4, 524288*8, 5 ) -DP_HUGE_TEST( huge_dp_test_5, 524288*16, 3 ) -DP_HUGE_TEST( huge_dp_test_6, 524288*32, 2 ) -DP_HUGE_TEST( huge_dp_test_7, 524288*64, 1 ) - -SP_HUGE_TEST( large_sp_test_1, 8192, 11 ) -SP_HUGE_TEST( large_sp_test_2, 8192*2, 7 ) -SP_HUGE_TEST( large_sp_test_3, 8192*4, 3 ) -SP_HUGE_TEST( large_sp_test_4, 8192*8, 5 ) -SP_HUGE_TEST( large_sp_test_5, 8192*16, 3 ) -SP_HUGE_TEST( large_sp_test_6, 8192*32, 21 ) -SP_HUGE_TEST( large_sp_test_7, 8192*64, 17 ) - -DP_HUGE_TEST( large_dp_test_1, 4096, 11 ) -DP_HUGE_TEST( large_dp_test_2, 4096*2, 7 ) -DP_HUGE_TEST( large_dp_test_3, 4096*4, 3 ) -DP_HUGE_TEST( large_dp_test_4, 4096*8, 5 ) -DP_HUGE_TEST( large_dp_test_5, 4096*16, 3 ) -DP_HUGE_TEST( large_dp_test_6, 4096*32, 21 ) -DP_HUGE_TEST( large_dp_test_7, 4096*64, 17 ) - -#endif - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow2_precallback_single, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 1048576 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_2D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal2); + lengths.push_back(normal2); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow2_precallback_single, large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_1048576_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_4M_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 4194304 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_4M_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_4M_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_4M_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_4M_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(2) ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( 2 ); - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( large2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( 2 ); - lengths.push_back( large2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large2 ); - lengths.push_back( 2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( 2 ); - lengths.push_back( large2 ); - lengths.push_back( 2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void astoundingly_large_1D_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1024 ); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_non_unit_stride_real_to_hermitian) -{ - try {small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_1D_non_unit_stride_real_to_hermitian) -{ - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 8 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 8 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 2; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = 0; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - std::vector output_strides; - - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 4 ); - lengths.push_back( 4 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - output_strides.push_back( lengths[0] * output_strides[0] + 20 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - output_strides.push_back( lengths[0] * output_strides[0] + 19 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void rectangular_2D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( normal2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( small2 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( large2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( large2 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow2_precallback_single, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - input_strides.push_back( lengths[1] * input_strides[1] + 17 ); - - std::vector output_strides( input_strides ); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - input_strides.push_back( lengths[1] * input_strides[1] + 3 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void testcase_2D_round_trip_complex_to_complex(size_t l0, size_t l1) -{ - std::vector lengths; - lengths.push_back( l0 ); - lengths.push_back( l1 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -// added this regression test to catch failures seen in transposes -TEST_F(accuracy_test_pow2_precallback_single, testcase1_2D_round_trip_complex_to_complex) -{ - try { testcase_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(1024, 16); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow2_precallback_single, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( large2 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow2_precallback_single, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal2 ); - lengths.push_back( normal2 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow2_precallback_single, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow2_precallback_double, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( small2 ); - lengths.push_back( small2 ); - lengths.push_back( small2 ); - size_t batch = 1; +template +void small_3D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(small2); + lengths.push_back(small2); + lengths.push_back(small2); + size_t batch = 1; - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow2_precallback_single, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_single, + small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow2_precallback_double, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow2_precallback_double, + small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -} //namespace +} // namespace precallback_pow2 diff --git a/src/tests/accuracy_test_pow3.cpp b/src/tests/accuracy_test_pow3.cpp index ef79d2d3..b981cfcb 100644 --- a/src/tests/accuracy_test_pow3.cpp +++ b/src/tests/accuracy_test_pow3.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7626 +29,9840 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow3_single : public ::testing::Test { protected: - accuracy_test_pow3_single(){} - virtual ~accuracy_test_pow3_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow3_single() {} + virtual ~accuracy_test_pow3_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow3_double : public ::testing::Test { protected: - accuracy_test_pow3_double(){} - virtual ~accuracy_test_pow3_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow3_double() {} + virtual ~accuracy_test_pow3_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace power3 -{ +namespace power3 { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_single, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} -TEST_F(accuracy_test_pow3_single, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void huge_1D_forward_in_place_complex_to_complex( + size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, + direction::direction_t direction_type) { + std::vector lengths; + lengths.push_back(lenSize); + size_t batch = batchSize; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layoutType; + layout::buffer_layout_t out_layout = layoutType; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction_type; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} +// TESTS disabled by default since they take a long time to execute +// TO enable this tests +// 1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 +// 2. pass --gtest_also_run_disabled_tests to TEST.exe +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_5292_10) { + try { + huge_1D_forward_in_place_complex_to_complex( + 5292, 10, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 177147 = 243 * 243 * 3, backward and forward, planar and interleaved, single +// and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// interleaved +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1594323 = 729 * 729 * 3 backward and forward, planar and interleaved, single +// and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 14348907 = 2187 * 2187 * 3 backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 + +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// interleaved +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(3); + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(3); + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow3_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +TEST_F(accuracy_test_pow3_single, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_complex_to_complex() { + std::vector lengths; + lengths.push_back(2187); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(27); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(27); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow3_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; -TEST_F(accuracy_test_pow3_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow3_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow3_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow3_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow3_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; -TEST_F(accuracy_test_pow3_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow3_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_pow3_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +TEST_F( + accuracy_test_pow3_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow3_single, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow3_double, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + std::vector output_strides; + + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow3_single, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow3_double, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; -TEST_F(accuracy_test_pow3_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow3_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow3_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_single, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_single, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(large3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(large3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_single, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_single, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_single, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_single, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_double, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_single, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; -TEST_F(accuracy_test_pow3_double, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides(input_strides); + size_t output_distance = input_distance; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow3_single, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow3_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void normal_2D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow3_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void small_3D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow3_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; +template +void normal_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow3_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void large_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow3_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; +template +void normal_2D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow3_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** - -template< class T, class cl_T, class fftw_T> -void huge_1D_forward_in_place_complex_to_complex(size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, direction::direction_t direction_type) -{ - std::vector lengths; - lengths.push_back(lenSize); - size_t batch = batchSize; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layoutType; - layout::buffer_layout_t out_layout = layoutType; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction_type; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} -//TESTS disabled by default since they take a long time to execute -//TO enable this tests -//1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 -//2. pass --gtest_also_run_disabled_tests to TEST.exe -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_5292_10) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(5292, 10, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//177147 = 243 * 243 * 3, backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -//interleaved -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1594323 = 729 * 729 * 3 backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//14348907 = 2187 * 2187 * 3 backward and forward, planar and interleaved, single and double, batch size 1 and 3 - -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -//interleaved -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( 3 ); - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( large3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( 3 ); - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( large3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void astoundingly_large_1D_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 2187 ); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_non_unit_stride_real_to_hermitian) -{ - try {small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_1D_non_unit_stride_real_to_hermitian) -{ - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 27 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 27 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 2; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = 0; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - std::vector output_strides; - - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_single, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_single, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - output_strides.push_back( lengths[0] * output_strides[0] + 20 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - output_strides.push_back( lengths[0] * output_strides[0] + 19 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void rectangular_2D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( large3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( large3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_single, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_single, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_single, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_single, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - input_strides.push_back( lengths[1] * input_strides[1] + 17 ); - - std::vector output_strides( input_strides ); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - input_strides.push_back( lengths[1] * input_strides[1] + 3 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow3_single, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow3_single, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow3_single, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow3_single, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_double, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; +template +void small_3D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow3_single, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_single, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_double, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_double, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -} //namespace +} // namespace power3 diff --git a/src/tests/accuracy_test_pow3_precallback.cpp b/src/tests/accuracy_test_pow3_precallback.cpp index b1836175..f08ed408 100644 --- a/src/tests/accuracy_test_pow3_precallback.cpp +++ b/src/tests/accuracy_test_pow3_precallback.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7491 +29,9647 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow3_precallback_single : public ::testing::Test { protected: - accuracy_test_pow3_precallback_single(){} - virtual ~accuracy_test_pow3_precallback_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow3_precallback_single() {} + virtual ~accuracy_test_pow3_precallback_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow3_precallback_double : public ::testing::Test { protected: - accuracy_test_pow3_precallback_double(){} - virtual ~accuracy_test_pow3_precallback_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow3_precallback_double() {} + virtual ~accuracy_test_pow3_precallback_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace precallback_power3 -{ +namespace precallback_power3 { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void huge_1D_forward_in_place_complex_to_complex( + size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, + direction::direction_t direction_type) { + std::vector lengths; + lengths.push_back(lenSize); + size_t batch = batchSize; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layoutType; + layout::buffer_layout_t out_layout = layoutType; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction_type; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} +// TESTS disabled by default since they take a long time to execute +// TO enable this tests +// 1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 +// 2. pass --gtest_also_run_disabled_tests to TEST.exe + +// 177147 = 243 * 243 * 3, forward (no need for backward), planar and +// interleaved, single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 177147, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1594323 = 729 * 729 * 3 foward (no need for backward), planar and +// interleaved, single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1594323, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 14348907 = 2187 * 2187 * 3 backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow3_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 14348907, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(3)); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow3_precallback_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(3); + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(3); + lengths.push_back(large3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large3); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_array_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_array_precallback_complex_to_complex) { + try { + normal_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_array_precallback_complex_to_complex) { + try { + normal_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_precallback_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_array_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_array_precallback_complex_to_complex) { + try { + large_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_array_precallback_complex_to_complex) { + try { + large_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(2187); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + DISABLED_astoundingly_large_1D_precallback_complex_to_complex) { + try { + astoundingly_large_1D_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + DISABLED_astoundingly_large_1D_precallback_complex_to_complex) { + try { + astoundingly_large_1D_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + very_small_1D_non_unit_stride_precallback_complex_to_complex) { + try { + very_small_1D_non_unit_stride_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + very_small_1D_non_unit_stride_precallback_complex_to_complex) { + try { + very_small_1D_non_unit_stride_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(27); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(27); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow3_precallback_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; -TEST_F(accuracy_test_pow3_precallback_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow3_precallback_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow3_precallback_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow3_precallback_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow3_precallback_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + std::vector input_strides; + input_strides.push_back(16); -TEST_F(accuracy_test_pow3_precallback_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow3_precallback_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_pow3_precallback_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } +TEST_F( + accuracy_test_pow3_precallback_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** // ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow3_precallback_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + std::vector output_strides; + + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow3_precallback_single, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; -TEST_F(accuracy_test_pow3_precallback_double, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; -TEST_F(accuracy_test_pow3_precallback_single, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; -TEST_F(accuracy_test_pow3_precallback_double, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + single_point_1D_forward_precallback_complex_to_complex) { + try { + single_point_1D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + single_point_1D_forward_precallback_complex_to_complex) { + try { + single_point_1D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + single_point_1D_backward_precallback_complex_to_complex) { + try { + single_point_1D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + single_point_1D_backward_precallback_complex_to_complex) { + try { + single_point_1D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_non_unit_stride_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_non_unit_stride_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(normal3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + rectangular_2D_array_precallback_complex_to_complex) { + try { + rectangular_2D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + rectangular_2D_array_precallback_complex_to_complex) { + try { + rectangular_2D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_precallback_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(small3); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(large3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_array_forward_precallback_complex_to_complex) { + try { + large_2D_array_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_array_forward_precallback_complex_to_complex) { + try { + large_2D_array_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(large3); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + large_2D_array_backward_precallback_complex_to_complex) { + try { + large_2D_array_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + large_2D_array_backward_precallback_complex_to_complex) { + try { + large_2D_array_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + single_point_2D_forward_precallback_complex_to_complex) { + try { + single_point_2D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + single_point_2D_forward_precallback_complex_to_complex) { + try { + single_point_2D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + single_point_2D_backward_precallback_complex_to_complex) { + try { + single_point_2D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + single_point_2D_backward_precallback_complex_to_complex) { + try { + single_point_2D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + single_point_3D_forward_precallback_complex_to_complex) { + try { + single_point_3D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + single_point_3D_forward_precallback_complex_to_complex) { + try { + single_point_3D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow3_precallback_single, + single_point_3D_backward_precallback_complex_to_complex) { + try { + single_point_3D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + single_point_3D_backward_precallback_complex_to_complex) { + try { + single_point_3D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_non_unit_stride_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_non_unit_stride_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; -TEST_F(accuracy_test_pow3_precallback_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_round_trip_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow3_precallback_single, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_round_trip_precallback_complex_to_complex) { + try { + normal_1D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_round_trip_precallback_complex_to_complex) { + try { + normal_1D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_2D_round_trip_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow3_precallback_single, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_round_trip_precallback_complex_to_complex) { + try { + normal_2D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_round_trip_precallback_complex_to_complex) { + try { + normal_2D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void small_3D_round_trip_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow3_precallback_single, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_round_trip_precallback_complex_to_complex) { + try { + small_3D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_round_trip_precallback_complex_to_complex) { + try { + small_3D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow3_precallback_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + normal_1D_round_trip_precallback_real_to_complex) { + try { + normal_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + normal_1D_round_trip_precallback_real_to_complex) { + try { + normal_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void large_1D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(large3); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow3_precallback_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + large_1D_round_trip_precallback_real_to_complex) { + try { + large_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + large_1D_round_trip_precallback_real_to_complex) { + try { + large_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void normal_2D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(normal3); + lengths.push_back(normal3); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow3_precallback_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + normal_2D_round_trip_precallback_real_to_complex) { + try { + normal_2D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + normal_2D_round_trip_precallback_real_to_complex) { + try { + normal_2D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** - -template< class T, class cl_T, class fftw_T> -void huge_1D_forward_in_place_complex_to_complex(size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, direction::direction_t direction_type) -{ - std::vector lengths; - lengths.push_back(lenSize); - size_t batch = batchSize; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layoutType; - layout::buffer_layout_t out_layout = layoutType; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction_type; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} -//TESTS disabled by default since they take a long time to execute -//TO enable this tests -//1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 -//2. pass --gtest_also_run_disabled_tests to TEST.exe - -//177147 = 243 * 243 * 3, forward (no need for backward), planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(177147, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_177147_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(177147, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1594323 = 729 * 729 * 3 foward (no need for backward), planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1594323, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1594323_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1594323, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//14348907 = 2187 * 2187 * 3 backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(14348907, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_14348907_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(14348907, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(3) ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( 3 ); - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( large3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( 3 ); - lengths.push_back( large3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large3 ); - lengths.push_back( 3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( 3 ); - lengths.push_back( large3 ); - lengths.push_back( 3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_array_precallback_complex_to_complex) -{ - try { normal_1D_array_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_array_precallback_complex_to_complex) -{ - try { normal_1D_array_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_precallback_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_array_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_array_precallback_complex_to_complex) -{ - try { large_1D_array_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_array_precallback_complex_to_complex) -{ - try { large_1D_array_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void astoundingly_large_1D_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 2187 ); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, DISABLED_astoundingly_large_1D_precallback_complex_to_complex) -{ - try { astoundingly_large_1D_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, DISABLED_astoundingly_large_1D_precallback_complex_to_complex) -{ - try { astoundingly_large_1D_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_small_1D_non_unit_stride_precallback_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_small_1D_non_unit_stride_precallback_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_non_unit_stride_real_to_hermitian) -{ - try {small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_non_unit_stride_real_to_hermitian) -{ - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 27 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 27 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 2; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = 0; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - std::vector output_strides; - - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 9 ); - lengths.push_back( 9 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, single_point_1D_forward_precallback_complex_to_complex) -{ - try { single_point_1D_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, single_point_1D_forward_precallback_complex_to_complex) -{ - try { single_point_1D_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, single_point_1D_backward_precallback_complex_to_complex) -{ - try { single_point_1D_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, single_point_1D_backward_precallback_complex_to_complex) -{ - try { single_point_1D_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - output_strides.push_back( lengths[0] * output_strides[0] + 20 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - output_strides.push_back( lengths[0] * output_strides[0] + 19 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void rectangular_2D_array_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( normal3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, rectangular_2D_array_precallback_complex_to_complex) -{ - try { rectangular_2D_array_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, rectangular_2D_array_precallback_complex_to_complex) -{ - try { rectangular_2D_array_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_array_precallback_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( small3 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( large3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_array_forward_precallback_complex_to_complex) -{ - try { large_2D_array_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_array_forward_precallback_complex_to_complex) -{ - try { large_2D_array_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( large3 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_2D_array_backward_precallback_complex_to_complex) -{ - try { large_2D_array_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_2D_array_backward_precallback_complex_to_complex) -{ - try { large_2D_array_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, single_point_2D_forward_precallback_complex_to_complex) -{ - try { single_point_2D_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, single_point_2D_forward_precallback_complex_to_complex) -{ - try { single_point_2D_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, single_point_2D_backward_precallback_complex_to_complex) -{ - try { single_point_2D_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, single_point_2D_backward_precallback_complex_to_complex) -{ - try { single_point_2D_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, single_point_3D_forward_precallback_complex_to_complex) -{ - try { single_point_3D_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, single_point_3D_forward_precallback_complex_to_complex) -{ - try { single_point_3D_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow3_precallback_single, single_point_3D_backward_precallback_complex_to_complex) -{ - try { single_point_3D_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, single_point_3D_backward_precallback_complex_to_complex) -{ - try { single_point_3D_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - input_strides.push_back( lengths[1] * input_strides[1] + 17 ); - - std::vector output_strides( input_strides ); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_and_distance_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - input_strides.push_back( lengths[1] * input_strides[1] + 3 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_round_trip_precallback_complex_to_complex) -{ - try { normal_1D_round_trip_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_round_trip_precallback_complex_to_complex) -{ - try { normal_1D_round_trip_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_round_trip_precallback_complex_to_complex) -{ - try { normal_2D_round_trip_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_round_trip_precallback_complex_to_complex) -{ - try { normal_2D_round_trip_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow3_precallback_single, small_3D_round_trip_precallback_complex_to_complex) -{ - try { small_3D_round_trip_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, small_3D_round_trip_precallback_complex_to_complex) -{ - try { small_3D_round_trip_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_1D_round_trip_precallback_real_to_complex) -{ - try { normal_1D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_1D_round_trip_precallback_real_to_complex) -{ - try { normal_1D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( large3 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow3_precallback_single, large_1D_round_trip_precallback_real_to_complex) -{ - try { large_1D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, large_1D_round_trip_precallback_real_to_complex) -{ - try { large_1D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal3 ); - lengths.push_back( normal3 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow3_precallback_single, normal_2D_round_trip_precallback_real_to_complex) -{ - try { normal_2D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow3_precallback_double, normal_2D_round_trip_precallback_real_to_complex) -{ - try { normal_2D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( small3 ); - lengths.push_back( small3 ); - lengths.push_back( small3 ); - size_t batch = 1; +template +void small_3D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(small3); + lengths.push_back(small3); + lengths.push_back(small3); + size_t batch = 1; - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow3_precallback_single, small_3D_round_trip_precallback_real_to_complex) -{ - try { small_3D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_single, + small_3D_round_trip_precallback_real_to_complex) { + try { + small_3D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow3_precallback_double, small_3D_round_trip_precallback_real_to_complex) -{ - try { small_3D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow3_precallback_double, + small_3D_round_trip_precallback_real_to_complex) { + try { + small_3D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -} //namespace +} // namespace precallback_power3 diff --git a/src/tests/accuracy_test_pow5.cpp b/src/tests/accuracy_test_pow5.cpp index 1446c95f..6a9ccec3 100644 --- a/src/tests/accuracy_test_pow5.cpp +++ b/src/tests/accuracy_test_pow5.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7978 +29,10541 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow5_single : public ::testing::Test { protected: - accuracy_test_pow5_single(){} - virtual ~accuracy_test_pow5_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow5_single() {} + virtual ~accuracy_test_pow5_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow5_double : public ::testing::Test { protected: - accuracy_test_pow5_double(){} - virtual ~accuracy_test_pow5_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow5_double() {} + virtual ~accuracy_test_pow5_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace power5 -{ +namespace power5 { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_single, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} -TEST_F(accuracy_test_pow5_single, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void huge_1D_forward_in_place_complex_to_complex( + size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, + direction::direction_t direction_type) { + std::vector lengths; + lengths.push_back(lenSize); + size_t batch = batchSize; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layoutType; + layout::buffer_layout_t out_layout = layoutType; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction_type; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} +// TESTS disabled by default since they take a long time to execute +// TO enable this tests +// 1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 +// 2. pass --gtest_also_run_disabled_tests to TEST.exe + +// 78125 = 125 * 125 * 5, backward and forward, planar and interleaved, single +// and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1953125 = 625 * 625 * 5 backward and forward, planar and interleaved, single +// and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 48828125 = 3125 * 3125 * 5 backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 10,0000 = 100 * 1,000, backward and forward, planar and interleaved, single +// and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1,000,000 = 1,000 * 1,000, backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1000000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 10,000,000 = 10,000 * 1,000, backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 10000000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 100,000,000 = 10,000 * 10,000, backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_planar, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_single, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 1, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_double, + DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 100000000, 3, layout::complex_interleaved, direction::backward); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(normal5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(normal5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(5); + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(large5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(5); + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(large5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow5_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +TEST_F(accuracy_test_pow5_single, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_complex_to_complex() { + std::vector lengths; + lengths.push_back(3125); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 2; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow5_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; -TEST_F(accuracy_test_pow5_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow5_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow5_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow5_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow5_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 2; -TEST_F(accuracy_test_pow5_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow5_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_pow5_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +TEST_F( + accuracy_test_pow5_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow5_single, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow5_double, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; + + std::vector input_strides; + std::vector output_strides; + + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow5_single, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow5_double, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; -TEST_F(accuracy_test_pow5_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow5_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow5_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_single, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_single, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(large5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(large5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_single, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_single, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_single, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_single, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_double, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_single, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; -TEST_F(accuracy_test_pow5_double, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides(input_strides); + size_t output_distance = input_distance; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } -TEST_F(accuracy_test_pow5_single, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow5_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void normal_2D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow5_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void small_3D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); } -TEST_F(accuracy_test_pow5_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; +template +void normal_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow5_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void large_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow5_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; +template +void normal_2D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow5_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** - -template< class T, class cl_T, class fftw_T> -void huge_1D_forward_in_place_complex_to_complex(size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, direction::direction_t direction_type) -{ - std::vector lengths; - lengths.push_back(lenSize); - size_t batch = batchSize; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layoutType; - layout::buffer_layout_t out_layout = layoutType; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction_type; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} -//TESTS disabled by default since they take a long time to execute -//TO enable this tests -//1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 -//2. pass --gtest_also_run_disabled_tests to TEST.exe - -//78125 = 125 * 125 * 5, backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1953125 = 625 * 625 * 5 backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//48828125 = 3125 * 3125 * 5 backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//10,0000 = 100 * 1,000, backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1,000,000 = 1,000 * 1,000, backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1000000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_1000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1000000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//10,000,000 = 10,000 * 1,000, backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(10000000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_10000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(10000000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//100,000,000 = 10,000 * 10,000, backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 1, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_planar_to_complex_planar_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 3, layout::complex_planar, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_single, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(100000000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 1, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_double, DISABLED_huge_1D_backward_in_place_complex_interleaved_to_complex_interleaved_100000000_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(100000000, 3, layout::complex_interleaved, direction::backward); } - catch (const std::exception& err) { handle_exception(err); } -} - - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( 5 ); - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( large5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( 5 ); - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( large5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_array_complex_to_complex) -{ - try { normal_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_array_complex_to_complex) -{ - try { large_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void astoundingly_large_1D_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 3125 ); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, DISABLED_astoundingly_large_1D_complex_to_complex) -{ - try { astoundingly_large_1D_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_small_1D_non_unit_stride_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_non_unit_stride_real_to_hermitian) -{ - try {small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_1D_non_unit_stride_real_to_hermitian) -{ - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 2; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = 0; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - std::vector output_strides; - - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_single, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, single_point_1D_forward_complex_to_complex) -{ - try { single_point_1D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_single, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, single_point_1D_backward_complex_to_complex) -{ - try { single_point_1D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - output_strides.push_back( lengths[0] * output_strides[0] + 20 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_complex_to_complex) -{ - try { small_2D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - output_strides.push_back( lengths[0] * output_strides[0] + 19 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_2D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_forward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_user_defined_scale_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_backward_user_defined_scale_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void rectangular_2D_array_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, rectangular_2D_array_complex_to_complex) -{ - try { rectangular_2D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_array_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_array_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( large5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_array_forward_complex_to_complex) -{ - try { large_2D_array_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( large5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_2D_array_backward_complex_to_complex) -{ - try { large_2D_array_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_single, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, single_point_2D_forward_complex_to_complex) -{ - try { single_point_2D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_single, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, single_point_2D_backward_complex_to_complex) -{ - try { single_point_2D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_forward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_single, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, single_point_3D_forward_complex_to_complex) -{ - try { single_point_3D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_backward_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_single, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, single_point_3D_backward_complex_to_complex) -{ - try { single_point_3D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - input_strides.push_back( lengths[1] * input_strides[1] + 17 ); - - std::vector output_strides( input_strides ); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_non_unit_stride_complex_to_complex) -{ - try { small_3D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - input_strides.push_back( lengths[1] * input_strides[1] + 3 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_non_unit_stride_and_distance_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_round_trip_complex_to_complex) -{ - try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow5_single, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, small_3D_round_trip_complex_to_complex) -{ - try { small_3D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow5_single, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_1D_round_trip_real_to_complex) -{ - try { normal_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow5_single, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, large_1D_round_trip_real_to_complex) -{ - try { large_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow5_single, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_double, normal_2D_round_trip_real_to_complex) -{ - try { normal_2D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_real_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; +template +void small_3D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; - data_pattern pattern = impulse; - real_to_complex_round_trip( pattern, lengths, batch ); + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); } -TEST_F(accuracy_test_pow5_single, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_single, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_double, small_3D_round_trip_real_to_complex) -{ - try { small_3D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_double, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -} //namespace +} // namespace power5 diff --git a/src/tests/accuracy_test_pow5_precallback.cpp b/src/tests/accuracy_test_pow5_precallback.cpp index 7045dde9..eafb440c 100644 --- a/src/tests/accuracy_test_pow5_precallback.cpp +++ b/src/tests/accuracy_test_pow5_precallback.cpp @@ -14,15 +14,14 @@ * limitations under the License. * ************************************************************************/ - #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7491 +29,9647 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow5_precallback_single : public ::testing::Test { protected: - accuracy_test_pow5_precallback_single(){} - virtual ~accuracy_test_pow5_precallback_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow5_precallback_single() {} + virtual ~accuracy_test_pow5_precallback_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow5_precallback_double : public ::testing::Test { protected: - accuracy_test_pow5_precallback_double(){} - virtual ~accuracy_test_pow5_precallback_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow5_precallback_double() {} + virtual ~accuracy_test_pow5_precallback_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace precallback_power5 -{ +namespace precallback_power5 { // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_out_of_place_real_to_hermitian_planar) -{ - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void huge_1D_forward_in_place_complex_to_complex( + size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, + direction::direction_t direction_type) { + std::vector lengths; + lengths.push_back(lenSize); + size_t batch = batchSize; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layoutType; + layout::buffer_layout_t out_layout = layoutType; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction_type; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +// TESTS disabled by default since they take a long time to execute +// TO enable this tests +// 1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 +// 2. pass --gtest_also_run_disabled_tests to TEST.exe + +// 78125 = 125 * 125 * 5, backward, planar and interleaved, single and double, +// batch size 1 and 3 +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 78125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 1953125 = 625 * 625 * 5 backward and forward, planar and interleaved, single +// and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 1953125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// 48828125 = 3125 * 3125 * 5 backward and forward, planar and interleaved, +// single and double, batch size 1 and 3 +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_planar, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// interleaved +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_single, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 1, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } +} +TEST_F( + accuracy_test_pow5_precallback_double, + DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) { + try { + huge_1D_forward_in_place_complex_to_complex( + 48828125, 3, layout::complex_interleaved, direction::forward); + } catch (const std::exception &err) { + handle_exception(err); + } } // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(5)); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(normal5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(normal5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F( + accuracy_test_pow5_precallback_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(5); + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(large5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(5); + lengths.push_back(large5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large5); + lengths.push_back(5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(5); + lengths.push_back(large5); + lengths.push_back(5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_array_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_array_precallback_complex_to_complex) { + try { + normal_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_array_precallback_complex_to_complex) { + try { + normal_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_precallback_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_1D_array_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_array_precallback_complex_to_complex) { + try { + large_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_array_precallback_complex_to_complex) { + try { + large_1D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(3125); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + DISABLED_astoundingly_large_1D_precallback_complex_to_complex) { + try { + astoundingly_large_1D_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + DISABLED_astoundingly_large_1D_precallback_complex_to_complex) { + try { + astoundingly_large_1D_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + very_small_1D_non_unit_stride_precallback_complex_to_complex) { + try { + very_small_1D_non_unit_stride_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + very_small_1D_non_unit_stride_precallback_complex_to_complex) { + try { + very_small_1D_non_unit_stride_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 2; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow5_precallback_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; + std::vector input_strides; + input_strides.push_back(16); - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; -TEST_F(accuracy_test_pow5_precallback_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow5_precallback_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow5_precallback_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow5_precallback_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F( + accuracy_test_pow5_precallback_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(25); + size_t batch = 2; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} + std::vector input_strides; + input_strides.push_back(16); -TEST_F(accuracy_test_pow5_precallback_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; + + std::vector output_strides; + output_strides.push_back(2); -TEST_F(accuracy_test_pow5_precallback_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F( + accuracy_test_pow5_precallback_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } +TEST_F( + accuracy_test_pow5_precallback_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** // ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -TEST_F(accuracy_test_pow5_precallback_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_in_place_real_to_hermitian_interleaved) -{ - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; + + std::vector input_strides; + std::vector output_strides; + + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); } -TEST_F(accuracy_test_pow5_precallback_single, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_in_place_hermitian_interleaved_to_real) -{ - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; -TEST_F(accuracy_test_pow5_precallback_double, small_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; -TEST_F(accuracy_test_pow5_precallback_single, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; -TEST_F(accuracy_test_pow5_precallback_double, small_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(25); + lengths.push_back(25); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + single_point_1D_forward_precallback_complex_to_complex) { + try { + single_point_1D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + single_point_1D_forward_precallback_complex_to_complex) { + try { + single_point_1D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + single_point_1D_backward_precallback_complex_to_complex) { + try { + single_point_1D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + single_point_1D_backward_precallback_complex_to_complex) { + try { + single_point_1D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_non_unit_stride_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_non_unit_stride_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_forward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_backward_user_defined_scale_precallback_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(normal5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + rectangular_2D_array_precallback_complex_to_complex) { + try { + rectangular_2D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + rectangular_2D_array_precallback_complex_to_complex) { + try { + rectangular_2D_array_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_precallback_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(small5); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(large5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_array_forward_precallback_complex_to_complex) { + try { + large_2D_array_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_array_forward_precallback_complex_to_complex) { + try { + large_2D_array_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(large5); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + large_2D_array_backward_precallback_complex_to_complex) { + try { + large_2D_array_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + large_2D_array_backward_precallback_complex_to_complex) { + try { + large_2D_array_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + single_point_2D_forward_precallback_complex_to_complex) { + try { + single_point_2D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + single_point_2D_forward_precallback_complex_to_complex) { + try { + single_point_2D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + single_point_2D_backward_precallback_complex_to_complex) { + try { + single_point_2D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + single_point_2D_backward_precallback_complex_to_complex) { + try { + single_point_2D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + single_point_3D_forward_precallback_complex_to_complex) { + try { + single_point_3D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + single_point_3D_forward_precallback_complex_to_complex) { + try { + single_point_3D_forward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} + +TEST_F(accuracy_test_pow5_precallback_single, + single_point_3D_backward_precallback_complex_to_complex) { + try { + single_point_3D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + single_point_3D_backward_precallback_complex_to_complex) { + try { + single_point_3D_backward_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_non_unit_stride_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_non_unit_stride_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; -TEST_F(accuracy_test_pow5_precallback_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +// ***************************************************** +// ***************************************************** +template +void normal_1D_round_trip_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow5_precallback_single, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_round_trip_precallback_complex_to_complex) { + try { + normal_1D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_1D_out_of_place_hermitian_planar_to_real) -{ - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_round_trip_precallback_complex_to_complex) { + try { + normal_1D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_2D_round_trip_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow5_precallback_single, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_round_trip_precallback_complex_to_complex) { + try { + normal_2D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, large_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_round_trip_precallback_complex_to_complex) { + try { + normal_2D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void small_3D_round_trip_precallback_complex_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); } -TEST_F(accuracy_test_pow5_precallback_single, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_round_trip_precallback_complex_to_complex) { + try { + small_3D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, large_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_round_trip_precallback_complex_to_complex) { + try { + small_3D_round_trip_precallback_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +template +void normal_1D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow5_precallback_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + normal_1D_round_trip_precallback_real_to_complex) { + try { + normal_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + normal_1D_round_trip_precallback_real_to_complex) { + try { + normal_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; +template +void large_1D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(large5); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow5_precallback_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + large_1D_round_trip_precallback_real_to_complex) { + try { + large_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + large_1D_round_trip_precallback_real_to_complex) { + try { + large_1D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; +template +void normal_2D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(normal5); + lengths.push_back(normal5); + size_t batch = 1; - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow5_precallback_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + normal_2D_round_trip_precallback_real_to_complex) { + try { + normal_2D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + normal_2D_round_trip_precallback_real_to_complex) { + try { + normal_2D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_out_of_place_real_to_hermitian_planar) -{ - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_out_of_place_hermitian_planar_to_real) -{ - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ huge 1D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** - -template< class T, class cl_T, class fftw_T> -void huge_1D_forward_in_place_complex_to_complex(size_t lenSize, size_t batchSize, layout::buffer_layout_t layoutType, direction::direction_t direction_type) -{ - std::vector lengths; - lengths.push_back(lenSize); - size_t batch = batchSize; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layoutType; - layout::buffer_layout_t out_layout = layoutType; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction_type; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -//TESTS disabled by default since they take a long time to execute -//TO enable this tests -//1. make sure ENV CLFFT_REQUEST_LIB_NOMEMALLOC=1 -//2. pass --gtest_also_run_disabled_tests to TEST.exe - -//78125 = 125 * 125 * 5, backward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(78125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_78125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(78125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//1953125 = 625 * 625 * 5 backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(1953125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_1953125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(1953125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//48828125 = 3125 * 3125 * 5 backward and forward, planar and interleaved, single and double, batch size 1 and 3 -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_planar_to_complex_planar_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_planar, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -//interleaved -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< float, cl_float, fftwf_complex >(48828125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_1) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 1, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_huge_1D_forward_in_place_complex_interleaved_to_complex_interleaved_48828125_3) -{ - try { huge_1D_forward_in_place_complex_to_complex< double, cl_double, fftw_complex >(48828125, 3, layout::complex_interleaved, direction::forward); } - catch (const std::exception& err) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_in_place_real_to_hermitian_interleaved) -{ - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_in_place_hermitian_interleaved_to_real) -{ - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_out_of_place_real_to_hermitian_planar) -{ - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_out_of_place_hermitian_planar_to_real) -{ - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_in_place_hermitian_interleaved_to_real) -{ - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_out_of_place_real_to_hermitian_planar) -{ - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_in_place_real_to_hermitian_interleaved) -{ - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_in_place_hermitian_interleaved_to_real) -{ - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_out_of_place_real_to_hermitian_planar) -{ - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( MaxLength2D(5) ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_out_of_place_hermitian_planar_to_real) -{ - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_out_of_place_real_to_hermitian_planar) -{ - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_3D_out_of_place_hermitian_planar_to_real) -{ - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, _small_3D_in_place_real_to_hermitian_interleaved) -{ - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, _small_3D_in_place_hermitian_interleaved_to_real) -{ - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, _small_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, _small_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, _small_3D_out_of_place_real_to_hermitian_planar) -{ - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, _small_3D_out_of_place_hermitian_planar_to_real) -{ - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_forward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_backward_in_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( 5 ); - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) -{ - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( large5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( 5 ); - lengths.push_back( large5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_in_place_real_to_hermitian_interleaved) -{ - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_in_place_hermitian_interleaved_to_real) -{ - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back( large5 ); - lengths.push_back( 5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back( 5 ); - lengths.push_back( large5 ); - lengths.push_back( 5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_array_precallback_complex_to_complex) -{ - try { normal_1D_array_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_array_precallback_complex_to_complex) -{ - try { normal_1D_array_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_precallback_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_1D_array_precallback_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_array_hermitian_to_real) -{ - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) -{ - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_array_real_to_hermitian) -{ - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_array_real_to_hermitian_with_odd_batch_size) -{ - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_array_hermitian_to_real) -{ - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_array_hermitian_to_real_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_array_hermitian_to_real_with_odd_batch_size) -{ - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_array_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_array_precallback_complex_to_complex) -{ - try { large_1D_array_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_array_precallback_complex_to_complex) -{ - try { large_1D_array_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void astoundingly_large_1D_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 3125 ); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, DISABLED_astoundingly_large_1D_precallback_complex_to_complex) -{ - try { astoundingly_large_1D_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, DISABLED_astoundingly_large_1D_precallback_complex_to_complex) -{ - try { astoundingly_large_1D_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_small_1D_non_unit_stride_precallback_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_small_1D_non_unit_stride_precallback_complex_to_complex) -{ - try { very_small_1D_non_unit_stride_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_non_unit_stride_real_to_hermitian) -{ - try {small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_non_unit_stride_real_to_hermitian) -{ - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_1D_non_unit_stride_hermitian_to_real) -{ - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try {very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_very_small_1D_non_unit_stride_real_to_hermitian) -{ - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_very_small_1D_non_unit_stride_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_very_small_1D_non_unit_stride_hermitian_to_real) -{ - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 2; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 16 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 128; - - std::vector output_strides; - output_strides.push_back( 2 ); - - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 2; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex) -{ - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_forward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_backward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_1D_backward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = 0; - size_t output_distance = 0; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_non_unit_stride_real_to_hermitian) -{ - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - std::vector output_strides; - - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_non_unit_distance_real_to_hermitian) -{ - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 5 ); - input_strides.push_back( lengths[0] * input_strides[0] + 1 ); - - std::vector output_strides; - output_strides.push_back( 2 ); - output_strides.push_back( lengths[0] * output_strides[0] + 2 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 30; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 42; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) -{ - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( 25 ); - lengths.push_back( 25 ); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back( 12 ); - input_strides.push_back( lengths[0] * input_strides[0] + 9 ); - - std::vector output_strides; - output_strides.push_back( 7 ); - output_strides.push_back( lengths[0] * output_strides[0] + 32 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 50; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 60; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real( pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_user_defined_scale_hermitian_to_real) -{ - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, single_point_1D_forward_precallback_complex_to_complex) -{ - try { single_point_1D_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, single_point_1D_forward_precallback_complex_to_complex) -{ - try { single_point_1D_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_1D_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, single_point_1D_backward_precallback_complex_to_complex) -{ - try { single_point_1D_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, single_point_1D_backward_precallback_complex_to_complex) -{ - try { single_point_1D_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 3 ); - output_strides.push_back( 3 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - output_strides.push_back( lengths[0] * output_strides[0] + 20 ); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_2D_non_unit_stride_and_distance_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back( 42 ); - output_strides.push_back( 42 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - output_strides.push_back( lengths[0] * output_strides[0] + 19 ); - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - size_t output_distance = lengths[lengths.size()-1] * output_strides[output_strides.size()-1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_2D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_2D_non_unit_stride_and_distance_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_forward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_forward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_user_defined_scale_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_backward_user_defined_scale_precallback_complex_to_complex) -{ - try { normal_2D_backward_user_defined_scale_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void rectangular_2D_array_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( normal5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, rectangular_2D_array_precallback_complex_to_complex) -{ - try { rectangular_2D_array_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, rectangular_2D_array_precallback_complex_to_complex) -{ - try { rectangular_2D_array_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_array_precallback_complex_to_complex_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( small5 ); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_array_precallback_complex_to_complex_with_odd_batch_size) -{ - try { normal_2D_array_precallback_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( large5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_array_forward_precallback_complex_to_complex) -{ - try { large_2D_array_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_array_forward_precallback_complex_to_complex) -{ - try { large_2D_array_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_2D_array_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( large5 ); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_2D_array_backward_precallback_complex_to_complex) -{ - try { large_2D_array_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_2D_array_backward_precallback_complex_to_complex) -{ - try { large_2D_array_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, single_point_2D_forward_precallback_complex_to_complex) -{ - try { single_point_2D_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, single_point_2D_forward_precallback_complex_to_complex) -{ - try { single_point_2D_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_2D_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, single_point_2D_backward_precallback_complex_to_complex) -{ - try { single_point_2D_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, single_point_2D_backward_precallback_complex_to_complex) -{ - try { single_point_2D_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_forward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, single_point_3D_forward_precallback_complex_to_complex) -{ - try { single_point_3D_forward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, single_point_3D_forward_precallback_complex_to_complex) -{ - try { single_point_3D_forward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void single_point_3D_backward_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( 1 ); - lengths.push_back( 1 ); - lengths.push_back( 1 ); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f ); -} - -TEST_F(accuracy_test_pow5_precallback_single, single_point_3D_backward_precallback_complex_to_complex) -{ - try { single_point_3D_backward_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, single_point_3D_backward_precallback_complex_to_complex) -{ - try { single_point_3D_backward_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 20 ); - input_strides.push_back( lengths[1] * input_strides[1] + 17 ); - - std::vector output_strides( input_strides ); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_non_unit_stride_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -// ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_non_unit_stride_and_distance_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back( 2 ); - input_strides.push_back( lengths[0] * input_strides[0] + 19 ); - input_strides.push_back( lengths[1] * input_strides[1] + 3 ); - - size_t input_distance = lengths[lengths.size()-1] * input_strides[input_strides.size()-1] + 14; - - std::vector output_strides( input_strides ); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex( pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_non_unit_stride_and_distance_precallback_complex_to_complex) -{ - try { small_3D_non_unit_stride_and_distance_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_round_trip_precallback_complex_to_complex) -{ - try { normal_1D_round_trip_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_round_trip_precallback_complex_to_complex) -{ - try { normal_1D_round_trip_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_round_trip_precallback_complex_to_complex) -{ - try { normal_2D_round_trip_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_round_trip_precallback_complex_to_complex) -{ - try { normal_2D_round_trip_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_precallback_complex_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip( pattern, lengths, batch, layout ); -} - -TEST_F(accuracy_test_pow5_precallback_single, small_3D_round_trip_precallback_complex_to_complex) -{ - try { small_3D_round_trip_precallback_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, small_3D_round_trip_precallback_complex_to_complex) -{ - try { small_3D_round_trip_precallback_complex_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_1D_round_trip_precallback_real_to_complex) -{ - try { normal_1D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_1D_round_trip_precallback_real_to_complex) -{ - try { normal_1D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( large5 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow5_precallback_single, large_1D_round_trip_precallback_real_to_complex) -{ - try { large_1D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, large_1D_round_trip_precallback_real_to_complex) -{ - try { large_1D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( normal5 ); - lengths.push_back( normal5 ); - size_t batch = 1; - - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); -} - -TEST_F(accuracy_test_pow5_precallback_single, normal_2D_round_trip_precallback_real_to_complex) -{ - try { normal_2D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow5_precallback_double, normal_2D_round_trip_precallback_real_to_complex) -{ - try { normal_2D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } -} - - // ***************************************************** - // ***************************************************** -template< class T, class cl_T, class fftw_T > -void small_3D_round_trip_precallback_real_to_complex() -{ - std::vector lengths; - lengths.push_back( small5 ); - lengths.push_back( small5 ); - lengths.push_back( small5 ); - size_t batch = 1; +template +void small_3D_round_trip_precallback_real_to_complex() { + std::vector lengths; + lengths.push_back(small5); + lengths.push_back(small5); + lengths.push_back(small5); + size_t batch = 1; - data_pattern pattern = impulse; - precallback_real_to_complex_round_trip( pattern, lengths, batch ); + data_pattern pattern = impulse; + precallback_real_to_complex_round_trip(pattern, lengths, + batch); } -TEST_F(accuracy_test_pow5_precallback_single, small_3D_round_trip_precallback_real_to_complex) -{ - try { small_3D_round_trip_precallback_real_to_complex< float, cl_float, fftwf_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_single, + small_3D_round_trip_precallback_real_to_complex) { + try { + small_3D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow5_precallback_double, small_3D_round_trip_precallback_real_to_complex) -{ - try { small_3D_round_trip_precallback_real_to_complex< double, cl_double, fftw_complex >(); } - catch( const std::exception& err ) { handle_exception(err); } +TEST_F(accuracy_test_pow5_precallback_double, + small_3D_round_trip_precallback_real_to_complex) { + try { + small_3D_round_trip_precallback_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } -} //namespace +} // namespace precallback_power5 diff --git a/src/tests/accuracy_test_pow7.cpp b/src/tests/accuracy_test_pow7.cpp index a7a6b332..9063ab91 100644 --- a/src/tests/accuracy_test_pow7.cpp +++ b/src/tests/accuracy_test_pow7.cpp @@ -1,28 +1,27 @@ /* ************************************************************************ -* Copyright 2013 Advanced Micro Devices, Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ************************************************************************/ - + * Copyright 2013 Advanced Micro Devices, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ************************************************************************/ #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -30,7456 +29,9398 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow7_single : public ::testing::Test { protected: - accuracy_test_pow7_single() {} - virtual ~accuracy_test_pow7_single() {} - virtual void SetUp() {} - virtual void TearDown() { - } + accuracy_test_pow7_single() {} + virtual ~accuracy_test_pow7_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow7_double : public ::testing::Test { protected: - accuracy_test_pow7_double() {} - virtual ~accuracy_test_pow7_double() {} - virtual void SetUp() {} - virtual void TearDown() { - } + accuracy_test_pow7_double() {} + virtual ~accuracy_test_pow7_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace power7 -{ - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +namespace power7 { +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 1D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) - { - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) - { - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_backward_in_place_complex_planar_to_complex_planar) - { - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_backward_in_place_complex_planar_to_complex_planar) - { - try { normal_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_in_place_real_to_hermitian_interleaved) - { - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_in_place_real_to_hermitian_interleaved) - { - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_in_place_hermitian_interleaved_to_real) - { - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_in_place_hermitian_interleaved_to_real) - { - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_out_of_place_real_to_hermitian_interleaved) - { - try { normal_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_out_of_place_real_to_hermitian_interleaved) - { - try { normal_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_out_of_place_hermitian_interleaved_to_real) - { - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_out_of_place_hermitian_interleaved_to_real) - { - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_out_of_place_real_to_hermitian_planar) - { - try { normal_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_out_of_place_real_to_hermitian_planar) - { - try { normal_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_out_of_place_real_to_hermitian_planar) { + try { + normal_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, normal_1D_out_of_place_hermitian_planar_to_real) - { - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_out_of_place_hermitian_planar_to_real) - { - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_forward_in_place_complex_planar_to_complex_planar) - { - try { small_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_forward_in_place_complex_planar_to_complex_planar) - { - try { small_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_backward_in_place_complex_planar_to_complex_planar) - { - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_backward_in_place_complex_planar_to_complex_planar) - { - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { small_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { small_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_in_place_real_to_hermitian_interleaved) - { - try { small_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_in_place_real_to_hermitian_interleaved) - { - try { small_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_in_place_real_to_hermitian_interleaved) { + try { + small_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_in_place_hermitian_interleaved_to_real) - { - try { small_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_in_place_hermitian_interleaved_to_real) - { - try { small_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_in_place_hermitian_interleaved_to_real) { + try { + small_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_out_of_place_real_to_hermitian_interleaved) - { - try { small_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_out_of_place_real_to_hermitian_interleaved) - { - try { small_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_out_of_place_real_to_hermitian_interleaved) { + try { + small_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_out_of_place_hermitian_interleaved_to_real) - { - try { small_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_out_of_place_hermitian_interleaved_to_real) - { - try { small_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_out_of_place_hermitian_interleaved_to_real) { + try { + small_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_out_of_place_real_to_hermitian_planar) - { - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_out_of_place_real_to_hermitian_planar) - { - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, small_1D_out_of_place_hermitian_planar_to_real) - { - try { small_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_out_of_place_hermitian_planar_to_real) - { - try { small_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_1D_out_of_place_hermitian_planar_to_real) { + try { + small_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 1D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, large_1D_forward_in_place_complex_planar_to_complex_planar) - { - try { large_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_forward_in_place_complex_planar_to_complex_planar) - { - try { large_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, large_1D_backward_in_place_complex_planar_to_complex_planar) - { - try { large_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_backward_in_place_complex_planar_to_complex_planar) - { - try { large_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, large_1D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { large_1D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } - - TEST_F(accuracy_test_pow7_single, large_1D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - TEST_F(accuracy_test_pow7_double, large_1D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { large_1D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } - - TEST_F(accuracy_test_pow7_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - TEST_F(accuracy_test_pow7_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } - - TEST_F(accuracy_test_pow7_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - TEST_F(accuracy_test_pow7_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } - - TEST_F(accuracy_test_pow7_single, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - TEST_F(accuracy_test_pow7_double, large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } - - TEST_F(accuracy_test_pow7_single, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - TEST_F(accuracy_test_pow7_double, large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } - - TEST_F(accuracy_test_pow7_single, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } - - TEST_F(accuracy_test_pow7_double, large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_in_place_real_to_hermitian_interleaved) - { - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_in_place_real_to_hermitian_interleaved) - { - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_in_place_hermitian_interleaved_to_real) - { - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_in_place_hermitian_interleaved_to_real) - { - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_out_of_place_real_to_hermitian_interleaved) - { - try { large_1D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_out_of_place_real_to_hermitian_interleaved) - { - try { large_1D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_out_of_place_hermitian_interleaved_to_real) - { - try { large_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_1D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_out_of_place_hermitian_interleaved_to_real) - { - try { large_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_out_of_place_real_to_hermitian_planar) - { - try { large_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_out_of_place_real_to_hermitian_planar) - { - try { large_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_out_of_place_hermitian_planar_to_real) - { - try { large_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_1D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_out_of_place_hermitian_planar_to_real) - { - try { large_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_in_place_complex_planar_to_complex_planar) - { - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_in_place_complex_planar_to_complex_planar) - { - try { normal_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) - { - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) - { - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_out_of_place_real_to_hermitian_interleaved) { + try { + large_1D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_out_of_place_hermitian_interleaved_to_real) { + try { + large_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_out_of_place_real_to_hermitian_planar) { + try { + large_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_1D_out_of_place_hermitian_planar_to_real) { + try { + large_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 2D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_in_place_real_to_hermitian_interleaved) - { - try { normal_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_in_place_real_to_hermitian_interleaved) - { - try { normal_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_in_place_hermitian_interleaved_to_real) - { - try { normal_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_in_place_hermitian_interleaved_to_real) - { - try { normal_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_out_of_place_real_to_hermitian_interleaved) - { - try { normal_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_out_of_place_real_to_hermitian_interleaved) - { - try { normal_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_out_of_place_hermitian_interleaved_to_real) - { - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_out_of_place_hermitian_interleaved_to_real) - { - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_out_of_place_real_to_hermitian_planar) - { - try { normal_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_out_of_place_real_to_hermitian_planar) - { - try { normal_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_out_of_place_hermitian_planar_to_real) - { - try { normal_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_out_of_place_hermitian_planar_to_real) - { - try { normal_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_forward_in_place_complex_planar_to_complex_planar) - { - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_in_place_real_to_hermitian_interleaved) { + try { + normal_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_forward_in_place_complex_planar_to_complex_planar) - { - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_backward_in_place_complex_planar_to_complex_planar) - { - try { small_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_in_place_hermitian_interleaved_to_real) { + try { + normal_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_backward_in_place_complex_planar_to_complex_planar) - { - try { small_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_out_of_place_real_to_hermitian_planar) { + try { + normal_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { small_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_out_of_place_hermitian_planar_to_real) { + try { + normal_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { small_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_in_place_real_to_hermitian_interleaved) - { - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_in_place_real_to_hermitian_interleaved) - { - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_in_place_hermitian_interleaved_to_real) - { - try { small_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_in_place_hermitian_interleaved_to_real) - { - try { small_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_out_of_place_real_to_hermitian_interleaved) - { - try { small_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_out_of_place_real_to_hermitian_interleaved) - { - try { small_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_out_of_place_hermitian_interleaved_to_real) - { - try { small_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_out_of_place_hermitian_interleaved_to_real) - { - try { small_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_out_of_place_real_to_hermitian_planar) - { - try { small_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_out_of_place_real_to_hermitian_planar) - { - try { small_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_out_of_place_hermitian_planar_to_real) - { - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_out_of_place_hermitian_planar_to_real) - { - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_forward_in_place_complex_planar_to_complex_planar) - { - try { large_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_forward_in_place_complex_planar_to_complex_planar) - { - try { large_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_backward_in_place_complex_planar_to_complex_planar) - { - try { large_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_in_place_hermitian_interleaved_to_real) { + try { + small_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_backward_in_place_complex_planar_to_complex_planar) - { - try { large_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_out_of_place_real_to_hermitian_interleaved) { + try { + small_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_out_of_place_hermitian_interleaved_to_real) { + try { + small_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_out_of_place_real_to_hermitian_planar) { + try { + small_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { large_2D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { large_2D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 2D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_in_place_real_to_hermitian_interleaved) - { - try { large_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_in_place_real_to_hermitian_interleaved) - { - try { large_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_in_place_hermitian_interleaved_to_real) - { - try { large_2D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_in_place_hermitian_interleaved_to_real) - { - try { large_2D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_out_of_place_real_to_hermitian_interleaved) - { - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_out_of_place_real_to_hermitian_interleaved) - { - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_out_of_place_hermitian_interleaved_to_real) - { - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_2D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_out_of_place_hermitian_interleaved_to_real) - { - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_out_of_place_real_to_hermitian_planar) - { - try { large_2D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_out_of_place_real_to_hermitian_planar) - { - try { large_2D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_out_of_place_hermitian_planar_to_real) - { - try { large_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_2D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_out_of_place_hermitian_planar_to_real) - { - try { large_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_forward_in_place_complex_planar_to_complex_planar) - { - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_in_place_real_to_hermitian_interleaved) { + try { + large_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_forward_in_place_complex_planar_to_complex_planar) - { - try { normal_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_backward_in_place_complex_planar_to_complex_planar) - { - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_in_place_hermitian_interleaved_to_real) { + try { + large_2D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_backward_in_place_complex_planar_to_complex_planar) - { - try { normal_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_out_of_place_real_to_hermitian_planar) { + try { + large_2D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_2D_out_of_place_hermitian_planar_to_real) { + try { + large_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { normal_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ normal 3D ^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(normal7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_in_place_real_to_hermitian_interleaved) - { - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_in_place_real_to_hermitian_interleaved) - { - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_in_place_hermitian_interleaved_to_real) - { - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_in_place_hermitian_interleaved_to_real) - { - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_out_of_place_real_to_hermitian_interleaved) - { - try { normal_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_out_of_place_real_to_hermitian_interleaved) - { - try { normal_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_out_of_place_hermitian_interleaved_to_real) - { - try { normal_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + normal_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_out_of_place_hermitian_interleaved_to_real) - { - try { normal_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_out_of_place_real_to_hermitian_planar) - { - try { normal_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_out_of_place_real_to_hermitian_planar) - { - try { normal_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_3D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(normal7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_3D_out_of_place_hermitian_planar_to_real) - { - try { normal_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_3D_out_of_place_hermitian_planar_to_real) - { - try { normal_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(normal7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_forward_in_place_complex_planar_to_complex_planar) - { - try { small_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_forward_in_place_complex_planar_to_complex_planar) - { - try { small_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_backward_in_place_complex_planar_to_complex_planar) - { - try { small_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_backward_in_place_complex_planar_to_complex_planar) - { - try { small_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_out_of_place_real_to_hermitian_interleaved) { + try { + normal_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_out_of_place_real_to_hermitian_planar) { + try { + normal_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { small_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(normal7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_3D_out_of_place_hermitian_planar_to_real) { + try { + normal_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { small_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ small 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, _small_3D_in_place_real_to_hermitian_interleaved) - { - try { small_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, _small_3D_in_place_real_to_hermitian_interleaved) - { - try { small_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, _small_3D_in_place_hermitian_interleaved_to_real) - { - try { small_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, _small_3D_in_place_hermitian_interleaved_to_real) - { - try { small_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, _small_3D_out_of_place_real_to_hermitian_interleaved) - { - try { small_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, _small_3D_out_of_place_real_to_hermitian_interleaved) - { - try { small_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, _small_3D_out_of_place_hermitian_interleaved_to_real) - { - try { small_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + small_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, _small_3D_out_of_place_hermitian_interleaved_to_real) - { - try { small_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, _small_3D_out_of_place_real_to_hermitian_planar) - { - try { small_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, _small_3D_out_of_place_real_to_hermitian_planar) - { - try { small_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, _small_3D_out_of_place_hermitian_planar_to_real) - { - try { small_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + small_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, _small_3D_out_of_place_hermitian_planar_to_real) - { - try { small_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_forward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_forward_in_place_complex_planar_to_complex_planar) - { - try { large_3D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + _small_3D_in_place_real_to_hermitian_interleaved) { + try { + small_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_forward_in_place_complex_planar_to_complex_planar) - { - try { large_3D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_backward_in_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_backward_in_place_complex_planar_to_complex_planar) - { - try { large_3D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + _small_3D_in_place_hermitian_interleaved_to_real) { + try { + small_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_backward_in_place_complex_planar_to_complex_planar) - { - try { large_3D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + _small_3D_out_of_place_real_to_hermitian_interleaved) { + try { + small_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + _small_3D_out_of_place_hermitian_interleaved_to_real) { + try { + small_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_forward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + _small_3D_out_of_place_real_to_hermitian_planar) { + try { + small_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) - { - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_backward_out_of_place_complex_planar_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + _small_3D_out_of_place_hermitian_planar_to_real) { + try { + small_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_backward_out_of_place_complex_planar_to_complex_planar) - { - try { large_3D_backward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ large 3D ^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_forward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_backward_in_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) - { - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() - { - std::vector lengths; - lengths.push_back(3); - lengths.push_back(3); - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) - { - try { large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(3); - lengths.push_back(large7); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_backward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) - { - try { large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_in_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(3); - lengths.push_back(3); - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_in_place_real_to_hermitian_interleaved) - { - try { large_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_in_place_real_to_hermitian_interleaved) - { - try { large_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_in_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_in_place_hermitian_interleaved_to_real) - { - try { large_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_in_place_hermitian_interleaved_to_real) - { - try { large_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_out_of_place_real_to_hermitian_interleaved() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_out_of_place_real_to_hermitian_interleaved) - { - try { large_3D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_out_of_place_real_to_hermitian_interleaved) - { - try { large_3D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_planar_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(3); + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_out_of_place_hermitian_interleaved_to_real() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_out_of_place_hermitian_interleaved_to_real) - { - try { large_3D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved) { + try { + large_3D_backward_out_of_place_complex_planar_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_out_of_place_hermitian_interleaved_to_real) - { - try { large_3D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large7); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_out_of_place_real_to_hermitian_planar() - { - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_out_of_place_real_to_hermitian_planar) - { - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_out_of_place_real_to_hermitian_planar) - { - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_backward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_3D_out_of_place_hermitian_planar_to_real() - { - std::vector lengths; - lengths.push_back(3); - lengths.push_back(large7); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_3D_out_of_place_hermitian_planar_to_real) - { - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar) { + try { + large_3D_backward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_3D_out_of_place_hermitian_planar_to_real) - { - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(3); + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_array_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_array_complex_to_complex) - { - try { normal_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_in_place_real_to_hermitian_interleaved) { + try { + large_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_array_complex_to_complex) - { - try { normal_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_array_complex_to_complex_with_odd_batch_size() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_array_complex_to_complex_with_odd_batch_size) - { - try { normal_1D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_in_place_hermitian_interleaved_to_real) { + try { + large_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_array_complex_to_complex_with_odd_batch_size) - { - try { normal_1D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_array_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_array_real_to_hermitian) - { - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_out_of_place_real_to_hermitian_interleaved) { + try { + large_3D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_array_real_to_hermitian) - { - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_array_real_to_hermitian_with_odd_batch_size() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) - { - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_out_of_place_hermitian_interleaved_to_real) { + try { + large_3D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) - { - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_array_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_array_hermitian_to_real) - { - try { normal_1D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_array_hermitian_to_real) - { - try { normal_1D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large7); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_array_hermitian_to_real_with_odd_batch_size() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_array_hermitian_to_real_with_odd_batch_size) - { - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_array_hermitian_to_real_with_odd_batch_size) - { - try { normal_1D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^ special ^^^^^^^^^^^^^^^^^^^^^^^^ // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_array_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_array_real_to_hermitian) - { - try { small_2D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, normal_1D_array_complex_to_complex) { + try { + normal_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_array_real_to_hermitian) - { - try { small_2D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_array_real_to_hermitian_with_odd_batch_size() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_array_real_to_hermitian_with_odd_batch_size) - { - try { small_2D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_1D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_array_real_to_hermitian_with_odd_batch_size) - { - try { small_2D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_array_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_array_hermitian_to_real) - { - try { small_2D_array_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_array_hermitian_to_real) - { - try { small_2D_array_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_array_hermitian_to_real_with_odd_batch_size() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_array_hermitian_to_real_with_odd_batch_size) - { - try { small_2D_array_hermitian_to_real_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_array_hermitian_to_real_with_odd_batch_size) - { - try { small_2D_array_hermitian_to_real_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_array_complex_to_complex() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_1D_array_complex_to_complex) - { - try { large_1D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, normal_1D_array_hermitian_to_real) { + try { + normal_1D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_array_complex_to_complex) - { - try { large_1D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void astoundingly_large_1D_complex_to_complex() - { - std::vector lengths; - lengths.push_back(2187); - size_t batch = 65536; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, DISABLED_astoundingly_large_1D_complex_to_complex) - { - try { astoundingly_large_1D_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_array_hermitian_to_real_with_odd_batch_size) { + try { + normal_1D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, DISABLED_astoundingly_large_1D_complex_to_complex) - { - try { astoundingly_large_1D_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_small_1D_non_unit_stride_complex_to_complex() - { - std::vector lengths; - lengths.push_back(9); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, very_small_1D_non_unit_stride_complex_to_complex) - { - try { very_small_1D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, small_2D_array_real_to_hermitian) { + try { + small_2D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_small_1D_non_unit_stride_complex_to_complex) - { - try { very_small_1D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_non_unit_stride_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_1D_non_unit_stride_real_to_hermitian) - { - try { small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_array_real_to_hermitian_with_odd_batch_size) { + try { + small_2D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_non_unit_stride_real_to_hermitian) - { - try { small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_1D_non_unit_stride_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_1D_non_unit_stride_hermitian_to_real) - { - try { small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, small_2D_array_hermitian_to_real) { + try { + small_2D_array_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_1D_non_unit_stride_hermitian_to_real) - { - try { small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_array_hermitian_to_real_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_small_1D_non_unit_stride_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(27); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, very_small_1D_non_unit_stride_real_to_hermitian) - { - try { very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_array_hermitian_to_real_with_odd_batch_size) { + try { + small_2D_array_hermitian_to_real_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_small_1D_non_unit_stride_real_to_hermitian) - { - try { very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_1D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_small_1D_non_unit_stride_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(27); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, very_small_1D_non_unit_stride_hermitian_to_real) - { - try { very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, large_1D_array_complex_to_complex) { + try { + large_1D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_small_1D_non_unit_stride_hermitian_to_real) - { - try { very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void astoundingly_large_1D_complex_to_complex() { + std::vector lengths; + lengths.push_back(2187); + size_t batch = 65536; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_very_small_1D_non_unit_stride_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(9); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, very_very_small_1D_non_unit_stride_real_to_hermitian) - { - try { very_very_small_1D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + DISABLED_astoundingly_large_1D_complex_to_complex) { + try { + astoundingly_large_1D_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_very_small_1D_non_unit_stride_real_to_hermitian) - { - try { very_very_small_1D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_very_small_1D_non_unit_stride_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(9); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, very_very_small_1D_non_unit_stride_hermitian_to_real) - { - try { very_very_small_1D_non_unit_stride_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + very_small_1D_non_unit_stride_complex_to_complex) { + try { + very_small_1D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_very_small_1D_non_unit_stride_hermitian_to_real) - { - try { very_very_small_1D_non_unit_stride_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_non_unit_stride_and_distance_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(42); - output_strides.push_back(42); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_non_unit_stride_and_distance_complex_to_complex) - { - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, small_1D_non_unit_stride_real_to_hermitian) { + try { + small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_non_unit_stride_and_distance_complex_to_complex) - { - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_small_1D_non_unit_stride_and_distance_real_to_complex() - { - std::vector lengths; - lengths.push_back(9); - size_t batch = 2; +TEST_F(accuracy_test_pow7_single, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector input_strides; - input_strides.push_back(2); +TEST_F(accuracy_test_pow7_double, small_1D_non_unit_stride_hermitian_to_real) { + try { + small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(27); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - std::vector output_strides(input_strides); - size_t output_distance = input_distance; +TEST_F(accuracy_test_pow7_single, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +TEST_F(accuracy_test_pow7_double, + very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - data_pattern pattern = impulse; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(27); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - TEST_F(accuracy_test_pow7_single, very_small_1D_non_unit_stride_and_distance_real_to_complex) - { - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_small_1D_non_unit_stride_and_distance_real_to_complex) - { - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() - { - std::vector lengths; - lengths.push_back(9); - size_t batch = 2; +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - std::vector input_strides; - input_strides.push_back(16); +TEST_F(accuracy_test_pow7_single, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 128; +TEST_F(accuracy_test_pow7_double, + very_very_small_1D_non_unit_stride_real_to_hermitian) { + try { + very_very_small_1D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector output_strides; - output_strides.push_back(2); +// ***************************************************** +// ***************************************************** +template +void very_very_small_1D_non_unit_stride_hermitian_to_real() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 2; +TEST_F(accuracy_test_pow7_single, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +TEST_F(accuracy_test_pow7_double, + very_very_small_1D_non_unit_stride_hermitian_to_real) { + try { + very_very_small_1D_non_unit_stride_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - data_pattern pattern = impulse; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - TEST_F(accuracy_test_pow7_single, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) - { - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) - { - try { very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() - { - std::vector lengths; - lengths.push_back(9); - size_t batch = 2; +// ***************************************************** +// ***************************************************** +template +void very_small_1D_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; - std::vector input_strides; - input_strides.push_back(16); + std::vector input_strides; + input_strides.push_back(2); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 128; + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; - std::vector output_strides; - output_strides.push_back(2); + std::vector output_strides(input_strides); + size_t output_distance = input_distance; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 2; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - data_pattern pattern = impulse; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) - { - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) - { - try { very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_forward_user_defined_scale_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); - } + std::vector input_strides; + input_strides.push_back(16); - TEST_F(accuracy_test_pow7_single, normal_1D_forward_user_defined_scale_complex_to_complex) - { - try { normal_1D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; - TEST_F(accuracy_test_pow7_double, normal_1D_forward_user_defined_scale_complex_to_complex) - { - try { normal_1D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + std::vector output_strides; + output_strides.push_back(2); - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_backward_user_defined_scale_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); - } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; - TEST_F(accuracy_test_pow7_single, normal_1D_backward_user_defined_scale_complex_to_complex) - { - try { normal_1D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - TEST_F(accuracy_test_pow7_double, normal_1D_backward_user_defined_scale_complex_to_complex) - { - try { normal_1D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_non_unit_stride_and_distance_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(42); - output_strides.push_back(42); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F( + accuracy_test_pow7_single, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_non_unit_stride_and_distance_real_to_hermitian) - { - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F( + accuracy_test_pow7_double, + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_out_of_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_non_unit_stride_and_distance_real_to_hermitian) - { - try { normal_1D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_user_defined_scale_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f); - } + std::vector input_strides; + input_strides.push_back(16); - TEST_F(accuracy_test_pow7_single, normal_1D_user_defined_scale_real_to_hermitian) - { - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 128; - TEST_F(accuracy_test_pow7_double, normal_1D_user_defined_scale_real_to_hermitian) - { - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + std::vector output_strides; + output_strides.push_back(2); - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_non_unit_stride_and_distance_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(42); - output_strides.push_back(42); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 2; - TEST_F(accuracy_test_pow7_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) - { - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; - TEST_F(accuracy_test_pow7_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) - { - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_non_unit_stride_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(9); - lengths.push_back(9); - size_t batch = 2; +TEST_F( + accuracy_test_pow7_single, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector input_strides; - input_strides.push_back(5); - input_strides.push_back(lengths[0] * input_strides[0] + 1); +TEST_F( + accuracy_test_pow7_double, + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_in_place_different_input_output_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector output_strides; - output_strides.push_back(2); - output_strides.push_back(lengths[0] * output_strides[0] + 2); +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} - size_t input_distance = 0; - size_t output_distance = 0; +TEST_F(accuracy_test_pow7_single, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +TEST_F(accuracy_test_pow7_double, + normal_1D_forward_user_defined_scale_complex_to_complex) { + try { + normal_1D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} - TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_real_to_hermitian) - { - try { small_2D_non_unit_stride_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_real_to_hermitian) - { - try { small_2D_non_unit_stride_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_backward_user_defined_scale_complex_to_complex) { + try { + normal_1D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_non_unit_distance_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(9); - lengths.push_back(9); - size_t batch = 2; +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - std::vector input_strides; - std::vector output_strides; +TEST_F(accuracy_test_pow7_single, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - size_t input_distance = lengths[0] * lengths[1] + 4; - size_t output_distance = lengths[0] * lengths[1] + 5; +TEST_F(accuracy_test_pow7_double, + normal_1D_non_unit_stride_and_distance_real_to_hermitian) { + try { + normal_1D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_non_unit_distance_real_to_hermitian) - { - try { small_2D_non_unit_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_non_unit_distance_real_to_hermitian) - { - try { small_2D_non_unit_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_non_unit_stride_and_distance_real_to_hermitian() - { - std::vector lengths; - lengths.push_back(9); - lengths.push_back(9); - size_t batch = 2; +TEST_F(accuracy_test_pow7_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector input_strides; - input_strides.push_back(5); - input_strides.push_back(lengths[0] * input_strides[0] + 1); +TEST_F(accuracy_test_pow7_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector output_strides; - output_strides.push_back(2); - output_strides.push_back(lengths[0] * output_strides[0] + 2); +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); + + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 30; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 42; +TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_real_to_hermitian) { + try { + small_2D_non_unit_stride_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - data_pattern pattern = sawtooth; - real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; - TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_and_distance_real_to_hermitian) - { - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + std::vector input_strides; + std::vector output_strides; - TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_and_distance_real_to_hermitian) - { - try { small_2D_non_unit_stride_and_distance_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + size_t input_distance = lengths[0] * lengths[1] + 4; + size_t output_distance = lengths[0] * lengths[1] + 5; - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_non_unit_stride_and_distance_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(9); - lengths.push_back(9); - size_t batch = 2; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; - std::vector input_strides; - input_strides.push_back(12); - input_strides.push_back(lengths[0] * input_strides[0] + 9); + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - std::vector output_strides; - output_strides.push_back(7); - output_strides.push_back(lengths[0] * output_strides[0] + 32); +TEST_F(accuracy_test_pow7_single, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 50; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 60; +TEST_F(accuracy_test_pow7_double, + small_2D_non_unit_distance_real_to_hermitian) { + try { + small_2D_non_unit_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_real_to_hermitian() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(5); + input_strides.push_back(lengths[0] * input_strides[0] + 1); + + std::vector output_strides; + output_strides.push_back(2); + output_strides.push_back(lengths[0] * output_strides[0] + 2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 30; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 42; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + real_to_complex(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_and_distance_hermitian_to_real) - { - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_non_unit_stride_and_distance_real_to_hermitian) { + try { + small_2D_non_unit_stride_and_distance_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_and_distance_hermitian_to_real) - { - try { small_2D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(9); + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(12); + input_strides.push_back(lengths[0] * input_strides[0] + 9); + + std::vector output_strides; + output_strides.push_back(7); + output_strides.push_back(lengths[0] * output_strides[0] + 32); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 50; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 60; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_user_defined_scale_hermitian_to_real() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f); - } +TEST_F(accuracy_test_pow7_single, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_user_defined_scale_hermitian_to_real) - { - try { normal_1D_user_defined_scale_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_non_unit_stride_and_distance_hermitian_to_real) { + try { + small_2D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_user_defined_scale_hermitian_to_real) - { - try { normal_1D_user_defined_scale_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_user_defined_scale_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + complex_to_real(pattern, lengths, batch, input_strides, + output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void single_point_1D_forward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(1); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); - } +TEST_F(accuracy_test_pow7_single, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, single_point_1D_forward_complex_to_complex) - { - try { single_point_1D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_1D_user_defined_scale_hermitian_to_real) { + try { + normal_1D_user_defined_scale_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, single_point_1D_forward_complex_to_complex) - { - try { single_point_1D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void single_point_1D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void single_point_1D_backward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(1); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); - } +TEST_F(accuracy_test_pow7_single, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, single_point_1D_backward_complex_to_complex) - { - try { single_point_1D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, single_point_1D_forward_complex_to_complex) { + try { + single_point_1D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, single_point_1D_backward_complex_to_complex) - { - try { single_point_1D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void single_point_1D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_non_unit_stride_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(3); - output_strides.push_back(3); - input_strides.push_back(lengths[0] * input_strides[0] + 20); - output_strides.push_back(lengths[0] * output_strides[0] + 20); - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_complex_to_complex) - { - try { small_2D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, single_point_1D_backward_complex_to_complex) { + try { + single_point_1D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_complex_to_complex) - { - try { small_2D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(3); + output_strides.push_back(3); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + output_strides.push_back(lengths[0] * output_strides[0] + 20); + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_2D_non_unit_stride_and_distance_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(42); - output_strides.push_back(42); - input_strides.push_back(lengths[0] * input_strides[0] + 19); - output_strides.push_back(lengths[0] * output_strides[0] + 19); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 14; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_2D_non_unit_stride_and_distance_complex_to_complex) - { - try { small_2D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_complex_to_complex) { + try { + small_2D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_2D_non_unit_stride_and_distance_complex_to_complex) - { - try { small_2D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_2D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + output_strides.push_back(lengths[0] * output_strides[0] + 19); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_forward_user_defined_scale_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); - } +TEST_F(accuracy_test_pow7_single, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_forward_user_defined_scale_complex_to_complex) - { - try { normal_2D_forward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_2D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_2D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_forward_user_defined_scale_complex_to_complex) - { - try { normal_2D_forward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_forward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.0f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_backward_user_defined_scale_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_backward_user_defined_scale_complex_to_complex) - { - try { normal_2D_backward_user_defined_scale_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_forward_user_defined_scale_complex_to_complex) { + try { + normal_2D_forward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_backward_user_defined_scale_complex_to_complex) - { - try { normal_2D_backward_user_defined_scale_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_backward_user_defined_scale_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 42.5f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void rectangular_2D_array_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(normal7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, rectangular_2D_array_complex_to_complex) - { - try { rectangular_2D_array_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_backward_user_defined_scale_complex_to_complex) { + try { + normal_2D_backward_user_defined_scale_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, rectangular_2D_array_complex_to_complex) - { - try { rectangular_2D_array_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void rectangular_2D_array_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(normal7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_array_complex_to_complex_with_odd_batch_size() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_array_complex_to_complex_with_odd_batch_size) - { - try { normal_2D_array_complex_to_complex_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, rectangular_2D_array_complex_to_complex) { + try { + rectangular_2D_array_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_array_complex_to_complex_with_odd_batch_size) - { - try { normal_2D_array_complex_to_complex_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_array_complex_to_complex_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_array_forward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(large7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_array_forward_complex_to_complex) - { - try { large_2D_array_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + normal_2D_array_complex_to_complex_with_odd_batch_size) { + try { + normal_2D_array_complex_to_complex_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_array_forward_complex_to_complex) - { - try { large_2D_array_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_array_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(large7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_2D_array_backward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(large7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, large_2D_array_backward_complex_to_complex) - { - try { large_2D_array_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, large_2D_array_forward_complex_to_complex) { + try { + large_2D_array_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_2D_array_backward_complex_to_complex) - { - try { large_2D_array_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void large_2D_array_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(large7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void single_point_2D_forward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(1); - lengths.push_back(1); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); - } +TEST_F(accuracy_test_pow7_single, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, single_point_2D_forward_complex_to_complex) - { - try { single_point_2D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, large_2D_array_backward_complex_to_complex) { + try { + large_2D_array_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, single_point_2D_forward_complex_to_complex) - { - try { single_point_2D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void single_point_2D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void single_point_2D_backward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(1); - lengths.push_back(1); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); - } +TEST_F(accuracy_test_pow7_single, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, single_point_2D_backward_complex_to_complex) - { - try { single_point_2D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, single_point_2D_forward_complex_to_complex) { + try { + single_point_2D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, single_point_2D_backward_complex_to_complex) - { - try { single_point_2D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void single_point_2D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void single_point_3D_forward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(1); - lengths.push_back(1); - lengths.push_back(1); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = impulse; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); - } +TEST_F(accuracy_test_pow7_single, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, single_point_3D_forward_complex_to_complex) - { - try { single_point_3D_forward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, single_point_2D_backward_complex_to_complex) { + try { + single_point_2D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, single_point_3D_forward_complex_to_complex) - { - try { single_point_3D_forward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void single_point_3D_forward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void single_point_3D_backward_complex_to_complex() - { - std::vector lengths; - lengths.push_back(1); - lengths.push_back(1); - lengths.push_back(1); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = impulse; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); - } +TEST_F(accuracy_test_pow7_single, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, single_point_3D_backward_complex_to_complex) - { - try { single_point_3D_backward_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, single_point_3D_forward_complex_to_complex) { + try { + single_point_3D_forward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, single_point_3D_backward_complex_to_complex) - { - try { single_point_3D_backward_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void single_point_3D_backward_complex_to_complex() { + std::vector lengths; + lengths.push_back(1); + lengths.push_back(1); + lengths.push_back(1); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = impulse; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness, 0.42f); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_non_unit_stride_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - input_strides.push_back(2); - input_strides.push_back(lengths[0] * input_strides[0] + 20); - input_strides.push_back(lengths[1] * input_strides[1] + 17); - - std::vector output_strides(input_strides); - - size_t input_distance = 0; - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_non_unit_stride_complex_to_complex) - { - try { small_3D_non_unit_stride_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, single_point_3D_backward_complex_to_complex) { + try { + single_point_3D_backward_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_non_unit_stride_complex_to_complex) - { - try { small_3D_non_unit_stride_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 20); + input_strides.push_back(lengths[1] * input_strides[1] + 17); + + std::vector output_strides(input_strides); + + size_t input_distance = 0; + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_non_unit_stride_and_distance_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 2; - std::vector input_strides; - input_strides.push_back(2); - input_strides.push_back(lengths[0] * input_strides[0] + 19); - input_strides.push_back(lengths[1] * input_strides[1] + 3); - - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - - std::vector output_strides(input_strides); - size_t output_distance = input_distance; - - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); - } +TEST_F(accuracy_test_pow7_single, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_non_unit_stride_and_distance_complex_to_complex) - { - try { small_3D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, small_3D_non_unit_stride_complex_to_complex) { + try { + small_3D_non_unit_stride_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_non_unit_stride_and_distance_complex_to_complex) - { - try { small_3D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 2; + std::vector input_strides; + input_strides.push_back(2); + input_strides.push_back(lengths[0] * input_strides[0] + 19); + input_strides.push_back(lengths[1] * input_strides[1] + 3); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_round_trip_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip(pattern, lengths, batch, layout); - } +TEST_F(accuracy_test_pow7_single, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_round_trip_complex_to_complex) - { - try { normal_1D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, + small_3D_non_unit_stride_and_distance_complex_to_complex) { + try { + small_3D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_round_trip_complex_to_complex) - { - try { normal_1D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; + + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_round_trip_complex_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip(pattern, lengths, batch, layout); - } +TEST_F(accuracy_test_pow7_single, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_2D_round_trip_complex_to_complex) - { - try { normal_2D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_2D_round_trip_complex_to_complex) - { - try { normal_2D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; + + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_round_trip_complex_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_planar; - - data_pattern pattern = sawtooth; - complex_to_complex_round_trip(pattern, lengths, batch, layout); - } +TEST_F(accuracy_test_pow7_single, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_round_trip_complex_to_complex) - { - try { small_3D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, normal_2D_round_trip_complex_to_complex) { + try { + normal_2D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, small_3D_round_trip_complex_to_complex) - { - try { small_3D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void small_3D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_planar; + + data_pattern pattern = sawtooth; + complex_to_complex_round_trip(pattern, lengths, batch, + layout); +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_1D_round_trip_real_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip(pattern, lengths, batch); - } +TEST_F(accuracy_test_pow7_single, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, normal_1D_round_trip_real_to_complex) - { - try { normal_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, small_3D_round_trip_complex_to_complex) { + try { + small_3D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, normal_1D_round_trip_real_to_complex) - { - try { normal_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void large_1D_round_trip_real_to_complex() - { - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip(pattern, lengths, batch); - } + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); +} - TEST_F(accuracy_test_pow7_single, large_1D_round_trip_real_to_complex) - { - try { large_1D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_double, large_1D_round_trip_real_to_complex) - { - try { large_1D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_double, normal_1D_round_trip_real_to_complex) { + try { + normal_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void normal_2D_round_trip_real_to_complex() - { - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip(pattern, lengths, batch); - } +// ***************************************************** +// ***************************************************** +template +void large_1D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; - TEST_F(accuracy_test_pow7_single, normal_2D_round_trip_real_to_complex) - { - try { normal_2D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); +} - TEST_F(accuracy_test_pow7_double, normal_2D_round_trip_real_to_complex) - { - try { normal_2D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - template< class T, class cl_T, class fftw_T > - void small_3D_round_trip_real_to_complex() - { - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - - data_pattern pattern = impulse; - real_to_complex_round_trip(pattern, lengths, batch); - } +TEST_F(accuracy_test_pow7_double, large_1D_round_trip_real_to_complex) { + try { + large_1D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - TEST_F(accuracy_test_pow7_single, small_3D_round_trip_real_to_complex) - { - try { small_3D_round_trip_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +// ***************************************************** +// ***************************************************** +template +void normal_2D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); +} - TEST_F(accuracy_test_pow7_double, small_3D_round_trip_real_to_complex) - { - try { small_3D_round_trip_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } - } +TEST_F(accuracy_test_pow7_single, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** - - struct InpSizeParameters { - unsigned int x_dim; - unsigned int y_dim; - unsigned int z_dim; - clfftPrecision precision; - - InpSizeParameters(unsigned int ip_x_dim, unsigned int ip_y_dim, unsigned int ip_z_dim, clfftPrecision ip_precision) - { - x_dim = ip_x_dim; - y_dim = ip_y_dim; - z_dim = ip_z_dim; - precision = ip_precision; - } - }; - - class TestParameterGenerator { - private: - std::vector data_sets; - public: - TestParameterGenerator() - { - generate(); - } +TEST_F(accuracy_test_pow7_double, normal_2D_round_trip_real_to_complex) { + try { + normal_2D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - std::vector & parameter_sets() { return data_sets; } - - private: - void generate(void) { - - size_t SP_MAX_LEN = 1 << 24; - size_t DP_MAX_LEN = 1 << 22; - int x, y, z, is_1D_parameters_pushed = 0; - size_t max_pow7 = 8; /*because 7 ^ 9 is greater than SP_MAX_LEN*/ - - /*Generate test parameters*/ - for ( z = 0; z <= max_pow7; z++) - { - for ( y = is_1D_parameters_pushed; y <= max_pow7; y++) - { - for ( x = 1; x <= max_pow7; x++) - { - is_1D_parameters_pushed = 1; - if (pow(7,(x + y + z)) <= (SP_MAX_LEN)) - { - data_sets.push_back(InpSizeParameters((unsigned int)pow(7 , x), (unsigned int)pow(7 , y), (unsigned int)pow(7 , z), CLFFT_SINGLE)); - } - else - { - break; - } - if (pow(7,(x + y + z)) <= (DP_MAX_LEN)) - { - data_sets.push_back(InpSizeParameters((unsigned int)pow(7 , x), (unsigned int)pow(7 , y), (unsigned int)pow(7 , z), CLFFT_DOUBLE)); - } - } - } - } - } - }; //class TestParameterGenerator +// ***************************************************** +// ***************************************************** +template +void small_3D_round_trip_real_to_complex() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + + data_pattern pattern = impulse; + real_to_complex_round_trip(pattern, lengths, batch); +} -}; //namespace +TEST_F(accuracy_test_pow7_single, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} - // ***************************************************** - // ***************************************************** +TEST_F(accuracy_test_pow7_double, small_3D_round_trip_real_to_complex) { + try { + small_3D_round_trip_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} -class accuracy_test_pow7_all_ip_size : public ::testing::TestWithParam { - protected: - accuracy_test_pow7_all_ip_size() {} - virtual ~accuracy_test_pow7_all_ip_size() {} - virtual void SetUp() {} - virtual void TearDown() {} +// ***************************************************** +// ***************************************************** + +struct InpSizeParameters { + unsigned int x_dim; + unsigned int y_dim; + unsigned int z_dim; + clfftPrecision precision; + + InpSizeParameters(unsigned int ip_x_dim, unsigned int ip_y_dim, + unsigned int ip_z_dim, clfftPrecision ip_precision) { + x_dim = ip_x_dim; + y_dim = ip_y_dim; + z_dim = ip_z_dim; + precision = ip_precision; + } }; -template< class T, class cl_T, class fftw_T > -void accuracy_test_pow7_all_ip_size_in_place(power7::InpSizeParameters params) -{ - std::vector lengths; - if (params.x_dim > 1) lengths.push_back(params.x_dim); - if (params.y_dim > 1) lengths.push_back(params.y_dim); - if (params.z_dim > 1) lengths.push_back(params.z_dim); +class TestParameterGenerator { +private: + std::vector data_sets; + +public: + TestParameterGenerator() { generate(); } + + std::vector ¶meter_sets() { return data_sets; } + +private: + void generate(void) { + + size_t SP_MAX_LEN = 1 << 24; + size_t DP_MAX_LEN = 1 << 22; + int x, y, z, is_1D_parameters_pushed = 0; + size_t max_pow7 = 8; /*because 7 ^ 9 is greater than SP_MAX_LEN*/ + + /*Generate test parameters*/ + for (z = 0; z <= max_pow7; z++) { + for (y = is_1D_parameters_pushed; y <= max_pow7; y++) { + for (x = 1; x <= max_pow7; x++) { + is_1D_parameters_pushed = 1; + if (pow(7, (x + y + z)) <= (SP_MAX_LEN)) { + data_sets.push_back(InpSizeParameters( + (unsigned int)pow(7, x), (unsigned int)pow(7, y), + (unsigned int)pow(7, z), CLFFT_SINGLE)); + } else { + break; + } + if (pow(7, (x + y + z)) <= (DP_MAX_LEN)) { + data_sets.push_back(InpSizeParameters( + (unsigned int)pow(7, x), (unsigned int)pow(7, y), + (unsigned int)pow(7, z), CLFFT_DOUBLE)); + } + } + } + } + } +}; // class TestParameterGenerator - size_t batch = (1 << 24) / (params.x_dim * params.y_dim * params.z_dim); - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; +}; // namespace power7 - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; +// ***************************************************** +// ***************************************************** - data_pattern pattern = sawtooth; +class accuracy_test_pow7_all_ip_size + : public ::testing::TestWithParam { +protected: + accuracy_test_pow7_all_ip_size() {} + virtual ~accuracy_test_pow7_all_ip_size() {} + virtual void SetUp() {} + virtual void TearDown() {} +}; - complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); +template +void accuracy_test_pow7_all_ip_size_in_place(power7::InpSizeParameters params) { + std::vector lengths; + if (params.x_dim > 1) + lengths.push_back(params.x_dim); + if (params.y_dim > 1) + lengths.push_back(params.y_dim); + if (params.z_dim > 1) + lengths.push_back(params.z_dim); + + size_t batch = (1 << 24) / (params.x_dim * params.y_dim * params.z_dim); + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + + complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); } TEST_P(accuracy_test_pow7_all_ip_size, power7_all_input_size) { - power7::InpSizeParameters params = GetParam(); - - RecordProperty("x_dim_size", params.x_dim); - RecordProperty("y_dim_size", params.y_dim); - RecordProperty("z_dim_size", params.z_dim); - RecordProperty("precision", params.precision); - - switch(params.precision ) - { - case CLFFT_SINGLE: - try { accuracy_test_pow7_all_ip_size_in_place< float, cl_float, fftwf_complex >(params); } - catch (const std::exception& err) { handle_exception(err); } - break; - case CLFFT_DOUBLE: - try { accuracy_test_pow7_all_ip_size_in_place< double, cl_double, fftw_complex >(params); } - catch (const std::exception& err) { handle_exception(err); } - break; - default: - FAIL() << "input parameter corruption in the test:accuracy_test_pow7_all_ip_size."; - }; - + power7::InpSizeParameters params = GetParam(); + + RecordProperty("x_dim_size", params.x_dim); + RecordProperty("y_dim_size", params.y_dim); + RecordProperty("z_dim_size", params.z_dim); + RecordProperty("precision", params.precision); + + switch (params.precision) { + case CLFFT_SINGLE: + try { + accuracy_test_pow7_all_ip_size_in_place( + params); + } catch (const std::exception &err) { + handle_exception(err); + } + break; + case CLFFT_DOUBLE: + try { + accuracy_test_pow7_all_ip_size_in_place( + params); + } catch (const std::exception &err) { + handle_exception(err); + } + break; + default: + FAIL() << "input parameter corruption in the " + "test:accuracy_test_pow7_all_ip_size."; + }; } INSTANTIATE_TEST_CASE_P( - clfft_pow7_AllInpSizeTest, - accuracy_test_pow7_all_ip_size, - ::testing::ValuesIn(power7::TestParameterGenerator - ().parameter_sets()) - ); + clfft_pow7_AllInpSizeTest, accuracy_test_pow7_all_ip_size, + ::testing::ValuesIn(power7::TestParameterGenerator().parameter_sets())); diff --git a/src/tests/accuracy_test_pow7_precallback.cpp b/src/tests/accuracy_test_pow7_precallback.cpp index acde9eff..37fcae9e 100644 --- a/src/tests/accuracy_test_pow7_precallback.cpp +++ b/src/tests/accuracy_test_pow7_precallback.cpp @@ -15,13 +15,13 @@ * ************************************************************************/ #include -#include +#include -#include "test_constants.h" -#include "fftw_transform.h" +#include "accuracy_test_common.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" #include #include @@ -29,1057 +29,1358 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow7_precallback_single : public ::testing::Test { protected: - accuracy_test_pow7_precallback_single(){} - virtual ~accuracy_test_pow7_precallback_single(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow7_precallback_single() {} + virtual ~accuracy_test_pow7_precallback_single() {} + virtual void SetUp() {} + virtual void TearDown() {} }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class accuracy_test_pow7_precallback_double : public ::testing::Test { protected: - accuracy_test_pow7_precallback_double(){} - virtual ~accuracy_test_pow7_precallback_double(){} - virtual void SetUp(){} - virtual void TearDown(){ - } + accuracy_test_pow7_precallback_double() {} + virtual ~accuracy_test_pow7_precallback_double() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -namespace precallback_power7 -{ +namespace precallback_power7 { /********************************************************************************************** -**************************************Complex To Complex*************************************** +**************************************Complex To +*Complex*************************************** **********************************************************************************************/ #pragma region Complex_To_Complex // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_forward_in_place_complex_planar_to_complex_planar) -{ - try { normal_1D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - - // ***************************************************** -// ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_complex_to_complex() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(42); - output_strides.push_back(42); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 14; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_non_unit_stride_and_distance_complex_to_complex) -{ - try { normal_1D_non_unit_stride_and_distance_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void small_1D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, small_1D_backward_in_place_complex_planar_to_complex_planar) -{ - try { small_1D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_round_trip_complex_to_complex() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - layout::buffer_layout_t layout = layout::complex_interleaved; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex_round_trip(pattern, lengths, batch, layout); +template +void normal_1D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_forward_in_place_complex_planar_to_complex_planar) { + try { + normal_1D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_round_trip_complex_to_complex) -{ - try { normal_1D_round_trip_complex_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } +// ***************************************************** +// ***************************************************** +template +void normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_non_unit_stride_and_distance_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_non_unit_stride_and_distance_complex_to_complex) { + try { + normal_1D_non_unit_stride_and_distance_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void small_1D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + small_1D_backward_in_place_complex_planar_to_complex_planar) { + try { + small_1D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_round_trip_complex_to_complex() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + layout::buffer_layout_t layout = layout::complex_interleaved; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex_round_trip(pattern, lengths, + batch, layout); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_round_trip_complex_to_complex) { + try { + normal_1D_round_trip_complex_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_2D_backward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::backward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_2D_backward_in_place_complex_planar_to_complex_planar) -{ - try { normal_2D_backward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } +template +void large_1D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_1D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_2D_backward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::backward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_2D_backward_in_place_complex_planar_to_complex_planar) { + try { + normal_2D_backward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) -{ - try { normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void small_2D_forward_in_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, small_2D_forward_in_place_complex_planar_to_complex_planar) -{ - try { small_2D_forward_in_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() -{ - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_interleaved; - layout::buffer_layout_t out_layout = layout::complex_interleaved; - placeness::placeness_t placeness = placeness::in_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) -{ - try { normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_3D_forward_out_of_place_complex_planar_to_complex_planar() -{ - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t in_layout = layout::complex_planar; - layout::buffer_layout_t out_layout = layout::complex_planar; - placeness::placeness_t placeness = placeness::out_of_place; - direction::direction_t direction = direction::forward; - - data_pattern pattern = sawtooth; - precallback_complex_to_complex(pattern, direction, lengths, batch, input_strides, output_strides, input_distance, output_distance, in_layout, out_layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_3D_forward_out_of_place_complex_planar_to_complex_planar) -{ - try { large_3D_forward_out_of_place_complex_planar_to_complex_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } +template +void normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar) { + try { + normal_2D_forward_out_of_place_complex_interleaved_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_2D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + large_2D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void small_2D_forward_in_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + small_2D_forward_in_place_complex_planar_to_complex_planar) { + try { + small_2D_forward_in_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_interleaved; + layout::buffer_layout_t out_layout = layout::complex_interleaved; + placeness::placeness_t placeness = placeness::in_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved) { + try { + normal_3D_forward_in_place_complex_interleaved_to_complex_interleaved< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_3D_forward_out_of_place_complex_planar_to_complex_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t in_layout = layout::complex_planar; + layout::buffer_layout_t out_layout = layout::complex_planar; + placeness::placeness_t placeness = placeness::out_of_place; + direction::direction_t direction = direction::forward; + + data_pattern pattern = sawtooth; + precallback_complex_to_complex( + pattern, direction, lengths, batch, input_strides, output_strides, + input_distance, output_distance, in_layout, out_layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + float, cl_float, fftwf_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_3D_forward_out_of_place_complex_planar_to_complex_planar) { + try { + large_3D_forward_out_of_place_complex_planar_to_complex_planar< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion /********************************************************************************************** -**************************************Complex To Real*************************************** +**************************************Complex To +*Real*************************************** **********************************************************************************************/ #pragma region Complex_To_Real // ***************************************************** // ***************************************************** -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_in_place_hermitian_interleaved_to_real) -{ - try { normal_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_1D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_out_of_place_hermitian_planar_to_real) -{ - try { normal_1D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_1D_in_place_hermitian_interleaved_to_real) -{ - try { large_1D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_non_unit_stride_and_distance_hermitian_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 2; - std::vector input_strides; - std::vector output_strides; - input_strides.push_back(42); - output_strides.push_back(42); - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 14; - size_t output_distance = lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + 14; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_non_unit_stride_and_distance_hermitian_to_real) -{ - try { normal_1D_non_unit_stride_and_distance_hermitian_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { normal_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void small_2D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, small_2D_out_of_place_hermitian_planar_to_real) -{ - try { small_2D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_2D_out_of_place_hermitian_interleaved_to_real) -{ - try { large_2D_out_of_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_hermitian_interleaved_to_real() -{ - std::vector lengths; - lengths.push_back(normal7); - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_3D_in_place_hermitian_interleaved_to_real) -{ - try { normal_3D_in_place_hermitian_interleaved_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_hermitian_planar_to_real() -{ - std::vector lengths; - lengths.push_back(3); - lengths.push_back(large7); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_complex_to_real(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_3D_out_of_place_hermitian_planar_to_real) -{ - try { large_3D_out_of_place_hermitian_planar_to_real< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } +template +void normal_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_in_place_hermitian_interleaved_to_real) { + try { + normal_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_1D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_out_of_place_hermitian_planar_to_real) { + try { + normal_1D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_1D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_1D_in_place_hermitian_interleaved_to_real) { + try { + large_1D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_non_unit_stride_and_distance_hermitian_to_real() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 2; + std::vector input_strides; + std::vector output_strides; + input_strides.push_back(42); + output_strides.push_back(42); + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + + 14; + size_t output_distance = + lengths[lengths.size() - 1] * output_strides[output_strides.size() - 1] + + 14; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_non_unit_stride_and_distance_hermitian_to_real) { + try { + normal_1D_non_unit_stride_and_distance_hermitian_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_2D_out_of_place_hermitian_interleaved_to_real) { + try { + normal_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void small_2D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + small_2D_out_of_place_hermitian_planar_to_real) { + try { + small_2D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_2D_out_of_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_2D_out_of_place_hermitian_interleaved_to_real) { + try { + large_2D_out_of_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_3D_in_place_hermitian_interleaved_to_real() { + std::vector lengths; + lengths.push_back(normal7); + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_3D_in_place_hermitian_interleaved_to_real) { + try { + normal_3D_in_place_hermitian_interleaved_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_3D_out_of_place_hermitian_planar_to_real() { + std::vector lengths; + lengths.push_back(3); + lengths.push_back(large7); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_complex_to_real( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_3D_out_of_place_hermitian_planar_to_real) { + try { + large_3D_out_of_place_hermitian_planar_to_real(); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion /********************************************************************************************** -**************************************Real To Complex*************************************** +**************************************Real To +*Complex*************************************** **********************************************************************************************/ #pragma region Real_To_Complex -template< class T, class cl_T, class fftw_T > -void normal_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_in_place_real_to_hermitian_interleaved) -{ - try { normal_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void small_1D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, small_1D_out_of_place_real_to_hermitian_planar) -{ - try { small_1D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_1D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(large7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_1D_in_place_real_to_hermitian_interleaved) -{ - try { large_1D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void small_2D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, small_2D_in_place_real_to_hermitian_interleaved) -{ - try { small_2D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_2D_out_of_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(MaxLength2D(7)); - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_2D_out_of_place_real_to_hermitian_interleaved) -{ - try { large_2D_out_of_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_3D_in_place_real_to_hermitian_interleaved() -{ - std::vector lengths; - lengths.push_back(small7); - lengths.push_back(normal7); - lengths.push_back(small7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_3D_in_place_real_to_hermitian_interleaved) -{ - try { normal_3D_in_place_real_to_hermitian_interleaved< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void large_3D_out_of_place_real_to_hermitian_planar() -{ - std::vector lengths; - lengths.push_back(large7); - lengths.push_back(3); - lengths.push_back(3); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, large_3D_out_of_place_real_to_hermitian_planar) -{ - try { large_3D_out_of_place_real_to_hermitian_planar< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 8; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_array_real_to_hermitian) -{ - try { normal_1D_array_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_array_real_to_hermitian_with_odd_batch_size() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 5; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::in_place; - - data_pattern pattern = sawtooth; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_array_real_to_hermitian_with_odd_batch_size) -{ - try { normal_1D_array_real_to_hermitian_with_odd_batch_size< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void very_small_1D_non_unit_stride_and_distance_real_to_complex() -{ - std::vector lengths; - lengths.push_back(9); - size_t batch = 2; - - std::vector input_strides; - input_strides.push_back(2); - - size_t input_distance = lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; - - std::vector output_strides(input_strides); - size_t output_distance = input_distance; - - layout::buffer_layout_t layout = layout::hermitian_interleaved; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness); -} - -TEST_F(accuracy_test_pow7_precallback_single, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, very_small_1D_non_unit_stride_and_distance_real_to_complex) -{ - try { very_small_1D_non_unit_stride_and_distance_real_to_complex< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -template< class T, class cl_T, class fftw_T > -void normal_1D_user_defined_scale_real_to_hermitian() -{ - std::vector lengths; - lengths.push_back(normal7); - size_t batch = 1; - std::vector input_strides; - std::vector output_strides; - size_t input_distance = 0; - size_t output_distance = 0; - layout::buffer_layout_t layout = layout::hermitian_planar; - placeness::placeness_t placeness = placeness::out_of_place; - - data_pattern pattern = impulse; - precallback_real_to_complex(pattern, lengths, batch, input_strides, output_strides, input_distance, output_distance, layout, placeness, 42.0f); -} - -TEST_F(accuracy_test_pow7_precallback_single, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< float, cl_float, fftwf_complex >(); } - catch (const std::exception& err) { handle_exception(err); } -} - -TEST_F(accuracy_test_pow7_precallback_double, normal_1D_user_defined_scale_real_to_hermitian) -{ - try { normal_1D_user_defined_scale_real_to_hermitian< double, cl_double, fftw_complex >(); } - catch (const std::exception& err) { handle_exception(err); } +template +void normal_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_in_place_real_to_hermitian_interleaved) { + try { + normal_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void small_1D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + small_1D_out_of_place_real_to_hermitian_planar) { + try { + small_1D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_1D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(large7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_1D_in_place_real_to_hermitian_interleaved) { + try { + large_1D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void small_2D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + small_2D_in_place_real_to_hermitian_interleaved) { + try { + small_2D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_2D_out_of_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(MaxLength2D(7)); + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_2D_out_of_place_real_to_hermitian_interleaved) { + try { + large_2D_out_of_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_3D_in_place_real_to_hermitian_interleaved() { + std::vector lengths; + lengths.push_back(small7); + lengths.push_back(normal7); + lengths.push_back(small7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_3D_in_place_real_to_hermitian_interleaved) { + try { + normal_3D_in_place_real_to_hermitian_interleaved(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void large_3D_out_of_place_real_to_hermitian_planar() { + std::vector lengths; + lengths.push_back(large7); + lengths.push_back(3); + lengths.push_back(3); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + large_3D_out_of_place_real_to_hermitian_planar) { + try { + large_3D_out_of_place_real_to_hermitian_planar(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_array_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 8; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_array_real_to_hermitian) { + try { + normal_1D_array_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_array_real_to_hermitian_with_odd_batch_size() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 5; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::in_place; + + data_pattern pattern = sawtooth; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_array_real_to_hermitian_with_odd_batch_size) { + try { + normal_1D_array_real_to_hermitian_with_odd_batch_size(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void very_small_1D_non_unit_stride_and_distance_real_to_complex() { + std::vector lengths; + lengths.push_back(9); + size_t batch = 2; + + std::vector input_strides; + input_strides.push_back(2); + + size_t input_distance = + lengths[lengths.size() - 1] * input_strides[input_strides.size() - 1] + 2; + + std::vector output_strides(input_strides); + size_t output_distance = input_distance; + + layout::buffer_layout_t layout = layout::hermitian_interleaved; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness); +} + +TEST_F(accuracy_test_pow7_precallback_single, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + very_small_1D_non_unit_stride_and_distance_real_to_complex) { + try { + very_small_1D_non_unit_stride_and_distance_real_to_complex< + double, cl_double, fftw_complex>(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +template +void normal_1D_user_defined_scale_real_to_hermitian() { + std::vector lengths; + lengths.push_back(normal7); + size_t batch = 1; + std::vector input_strides; + std::vector output_strides; + size_t input_distance = 0; + size_t output_distance = 0; + layout::buffer_layout_t layout = layout::hermitian_planar; + placeness::placeness_t placeness = placeness::out_of_place; + + data_pattern pattern = impulse; + precallback_real_to_complex( + pattern, lengths, batch, input_strides, output_strides, input_distance, + output_distance, layout, placeness, 42.0f); +} + +TEST_F(accuracy_test_pow7_precallback_single, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } +} + +TEST_F(accuracy_test_pow7_precallback_double, + normal_1D_user_defined_scale_real_to_hermitian) { + try { + normal_1D_user_defined_scale_real_to_hermitian(); + } catch (const std::exception &err) { + handle_exception(err); + } } #pragma endregion -} \ No newline at end of file +} // namespace precallback_power7 \ No newline at end of file diff --git a/src/tests/accuracy_test_random.cpp b/src/tests/accuracy_test_random.cpp index 430a4e55..9900fc54 100644 --- a/src/tests/accuracy_test_random.cpp +++ b/src/tests/accuracy_test_random.cpp @@ -14,713 +14,678 @@ * limitations under the License. * ************************************************************************/ - #include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include "accuracy_test_common.h" #include "clFFT.h" -#include "test_constants.h" -#include "fftw_transform.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" #include "typedefs.h" -#include "accuracy_test_common.h" size_t super_duper_global_seed; namespace ParameterizedTest { - //TODO this is pasted from cl_transform.h - // it should be put in one place for everybody to use - /*****************************************************/ - layout::buffer_layout_t cl_layout_to_buffer_layout( clfftLayout cl_layout ) - { - if( cl_layout == CLFFT_REAL ) - return layout::real; - else if( cl_layout == CLFFT_HERMITIAN_PLANAR ) - return layout::hermitian_planar; - else if( cl_layout == CLFFT_COMPLEX_PLANAR ) - return layout::complex_planar; - else if( cl_layout == CLFFT_HERMITIAN_INTERLEAVED ) - return layout::hermitian_interleaved; - else if( cl_layout == CLFFT_COMPLEX_INTERLEAVED ) - return layout::complex_interleaved; - else - throw std::runtime_error( "invalid cl_layout" ); - } - - const size_t one_gb = 1024 * 1024 * 1024; - - size_t size_of_one_point( clfftPrecision precision, clfftLayout layout ) - { - size_t size_of_one_point; - // size of one point will be 1 or 2, depending on whether the points are real or complex - if( layout == CLFFT_COMPLEX_INTERLEAVED || layout == CLFFT_COMPLEX_PLANAR || layout == CLFFT_HERMITIAN_PLANAR || layout == CLFFT_HERMITIAN_INTERLEAVED ) - size_of_one_point = 2; - else if( layout == CLFFT_REAL ) - size_of_one_point = 1; - else throw std::invalid_argument("random_supported_problem_size: invalid layout provided"); - - // each value in a point will be the size of a float or the size of a double, depending on the precision - if( precision == CLFFT_SINGLE ) size_of_one_point *= sizeof(float); - else if( precision == CLFFT_DOUBLE ) size_of_one_point *= sizeof(double); - else throw std::invalid_argument("random_supported_problem_size: invalid precision provided"); - - return size_of_one_point; - } - - // the CPU can have a lot of memory hanging off of it. in these cases and when CPU is the cl device, - // huge amounts of memory might be dedicated to each buffer. in practice, large buffer sizes _destroy_ - // performance (and can effectively hang the machine). that is bad. to get around this, we limit - // each buffer to a GB - size_t max_memory_size_for_one_buffer() - { - size_t max_mem = max_mem_available_on_cl_device(0); - if( max_mem > one_gb ) - return one_gb; - else - return max_mem; - } - - size_t max_problem_size_in_datapoints( clfftPrecision precision, clfftLayout layout ) - { - // we divide by 32 to shrink things just a bit. otherwise problems take a billion hours each - return max_memory_size_for_one_buffer() / size_of_one_point(precision,layout) / 32; - } - - - boost::mt19937 random_parameter_generator; - boost::uniform_int<> distribution(1, INT_MAX); - boost::variate_generator > - random_value(random_parameter_generator, distribution); - - size_t random_int() { - return random_value(); - } - - size_t random_int(size_t max) { - return random_value() % (max+1); - } - - size_t random_int(size_t min, size_t max) { - return (random_value() % ((max+1)-min)) + min; - } - - std::vector random_supported_problem_size( size_t dimensions, clfftPrecision precision, clfftLayout layout ) - { - std::vector lengths; - - std::vector supported_radices; - supported_radices.push_back(2); - supported_radices.push_back(3); - supported_radices.push_back(5); - supported_radices.push_back(7); - - // total size of this problem should be some fraction of the total space available on the device - size_t this_problem_size = random_int(1, max_problem_size_in_datapoints(precision,layout)); - - size_t total_problem_size = 1; - std::vector factors; - - while( total_problem_size < this_problem_size ) - { - size_t a_factor = supported_radices[random_int(0, supported_radices.size()-1)]; - if( total_problem_size * a_factor <= this_problem_size ) - { - total_problem_size *= a_factor; - factors.push_back(a_factor); - } - else - break; - } // problem size is now factored into some permutation of 2s, 3s, and 5s - // (exact combination stored in "factors" - - for( size_t i = 0; i < dimensions; ++i ) - lengths.push_back(1); - - // distribute the values in factors to each valid length value - while( !factors.empty() ) - { - size_t which_factor = random_int( 0, factors.size()-1 ); - size_t dim = random_int( 0, dimensions-1 ); - lengths[dim] *= factors[which_factor]; - factors.erase(factors.begin() + which_factor); - } - - // by the time we reach the end, we've calculated the total problem size, split it up into valid radices, and - // distributed those among the dimensions available - - if( lengths.size() != dimensions ) - throw std::runtime_error( "random_supported_problem_size: number of lengths does not corroborate number of dimensions" ); - - return lengths; - } - - struct Parameters { - size_t batch_size; - clfftPrecision precision; - clfftDirection direction; - clfftDim dimensions; - std::vector lengths; - std::vector input_strides; - std::vector output_strides; - size_t input_distance; - size_t output_distance; - clfftLayout input_layout; - clfftLayout output_layout; - clfftResultLocation placeness; - double forward_scale; - double backward_scale; - data_pattern pattern; - size_t data_seed; - // start scales at double. we can just cast to float at the cost of - // a little precision if single precision is randomly chosen. no biggie - - //we want to define a maximum stride so that memory does not get out of control - static const size_t max_stride = 5; - static const size_t max_distance = 128; - - size_t total_size_in_points() - { - if( lengths.empty() ) - throw std::runtime_error( "you shouldn't be here!" ); - - size_t total_size = 1; - for( size_t i = 0; i < lengths.size(); i++ ) - total_size *= lengths[i]; - - return total_size; - } - - bool is_in_place() - { - if( placeness == CLFFT_INPLACE ) return true; - else return false; - } - - bool is_out_of_place() - { - return !is_in_place(); - } - - bool is_r2c() - { - if( input_layout == CLFFT_REAL ) return true; - else return false; - } - - bool is_c2r() - { - if( output_layout == CLFFT_REAL ) return true; - else return false; - } - - bool is_c2c() - { - if( ( input_layout == CLFFT_COMPLEX_INTERLEAVED || input_layout == CLFFT_COMPLEX_PLANAR ) - && ( output_layout == CLFFT_COMPLEX_INTERLEAVED || output_layout == CLFFT_COMPLEX_PLANAR ) ) - return true; - else - return false; - } - - bool fifty_percent_chance() - { - if( random_int(0,1) ) - return true; - else - return false; - } - - void generate_x_strides() - { - input_strides.push_back( random_int(1,max_stride) ); - output_strides.push_back( random_int(1,max_stride) ); - } - - Parameters() - : precision( static_cast(random_int(CLFFT_SINGLE,CLFFT_DOUBLE)) ) - , dimensions( static_cast(random_int(CLFFT_1D,ENDDIMENSION-1)) ) - , placeness( static_cast(random_int(CLFFT_INPLACE, CLFFT_OUTOFPLACE)) ) - , input_layout( static_cast(random_int(CLFFT_COMPLEX_INTERLEAVED, CLFFT_REAL)) ) - , forward_scale( static_cast(random_int())/static_cast(random_int()) ) - , backward_scale( static_cast(random_int())/static_cast(random_int()) ) - , pattern( erratic ) - , data_seed( random_int() ) - { - try - { - // input and output layouts have strict requirements, so we'll base the output layout - // off of our randomly selected input layout - if( input_layout == CLFFT_REAL ) - { - if( placeness == CLFFT_INPLACE ) - output_layout = CLFFT_HERMITIAN_INTERLEAVED; - else if( placeness == CLFFT_OUTOFPLACE ) - output_layout = static_cast(random_int(CLFFT_HERMITIAN_INTERLEAVED, CLFFT_HERMITIAN_PLANAR)); - else - throw std::runtime_error( "parameter generator invalid placeness" ); - } - else if( input_layout == CLFFT_HERMITIAN_INTERLEAVED ) - { - output_layout = CLFFT_REAL; - } - else if( input_layout == CLFFT_HERMITIAN_PLANAR ) - { - // in-place transforms not supported with hermitian planar - placeness = CLFFT_OUTOFPLACE; - - output_layout = CLFFT_REAL; - } - else if( input_layout == CLFFT_COMPLEX_INTERLEAVED || input_layout == CLFFT_COMPLEX_PLANAR ) - { - // complex is a little simpler. we can do them together here - if( placeness == CLFFT_INPLACE ) - output_layout = input_layout; - else - output_layout = static_cast(random_int(CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_PLANAR)); - } - else - { - throw std::runtime_error( "parameter generator invalid input layout" ); - } - - direction = random_int(0,1) ? CLFFT_FORWARD : CLFFT_BACKWARD; - - lengths = random_supported_problem_size(dimensions, precision, input_layout); - - // strides and distances - - if( fifty_percent_chance() ) // about half the time, we just want unit strides - { - // input_strides and output_strides remain empty - - input_distance = 0; - output_distance = 0; - } - else if( is_in_place() && is_r2c() ) - { - generate_x_strides(); - - // generate y strides - if( dimensions >= 2 ) - { - size_t random_y_stride = random_int(0,max_stride); - input_strides.push_back( input_strides[0] * ( 1 + lengths[0] / 2 ) * 2 + 2 * random_y_stride ); - output_strides.push_back( output_strides[0] * ( 1 + lengths[0] / 2 ) + random_y_stride ); - - // both strides need to be able to fit both the input and the output - if( input_strides[1] > 2 * output_strides[1] ) - { - output_strides[1] = input_strides[1] / 2; - } - else if( input_strides[1] < 2 * output_strides[1] ) - { - input_strides[1] = 2 * output_strides[1]; - } - } - - // generate z strides - if( dimensions >= 3 ) - { - output_strides.push_back( output_strides[1] * lengths[1] ); - input_strides.push_back( 2 * output_strides[2] ); - } - - // generate distance - - // 1D is a special case with distances, because we need to make sure - // we have the extra padding that we would have otherwise gotten from - // the y dimension - if( dimensions == 1 ) - { - input_distance = input_strides[0] * ( 1 + lengths[0] / 2 ) * 2; - output_distance = output_strides[0] * ( 1 + lengths[0] / 2 ); - - // both strides need to be able to fit both the input and the output - if( input_distance > 2 * output_distance ) - { - output_distance = input_distance / 2; - } - else if( input_distance < 2 * output_distance ) - { - input_distance = 2 * output_distance; - } - - size_t random_distance = random_int(0,max_distance); - input_distance += 2 * random_distance; - output_distance += random_distance; - } - else - { - output_distance = output_strides[dimensions-1] * lengths[dimensions-1] + random_int(0,max_distance); - input_distance = 2 * output_distance; - } - - // check for ok - if( dimensions >= 2 ) - if( input_strides[1] != 2 * output_strides[1] ) - throw std::runtime_error( "invalid stride y generated for r2c" ); - - if( dimensions >= 3 ) - if( input_strides[2] != 2 * output_strides[2] ) - throw std::runtime_error( "invalid stride z generated for r2c" ); - - if( input_distance != 2 * output_distance ) - throw std::runtime_error( "invalid distance generated for r2c" ); - } - else if( is_in_place() && is_c2r() ) - { - generate_x_strides(); - - // generate y strides - if( dimensions >= 2 ) - { - size_t random_y_stride = random_int(0,max_stride); - output_strides.push_back( output_strides[0] * ( 1 + lengths[0] / 2 ) * 2 + 2 * random_y_stride ); - input_strides.push_back( input_strides[0] * ( 1 + lengths[0] / 2 ) + random_y_stride ); - - // both strides need to be able to fit both the output and the input - if( output_strides[1] > 2 * input_strides[1] ) - { - input_strides[1] = output_strides[1] / 2; - } - else if( output_strides[1] < 2 * input_strides[1] ) - { - output_strides[1] = 2 * input_strides[1]; - } - } - - // generate z strides - if( dimensions >= 3 ) - { - input_strides.push_back( input_strides[1] * lengths[1] ); - output_strides.push_back( 2 * input_strides[2] ); - } - - // generate distance - - // 1D is a special case with distances, because we need to make sure - // we have the extra padding that we would have otherwise gotten from - // the y dimension - if( dimensions == 1 ) - { - output_distance = output_strides[0] * ( 1 + lengths[0] / 2 ) * 2; - input_distance = input_strides[0] * ( 1 + lengths[0] / 2 ); - - // both strides need to be able to fit both the output and the input - if( output_distance > 2 * input_distance ) - { - input_distance = output_distance / 2; - } - else if( output_distance < 2 * input_distance ) - { - output_distance = 2 * input_distance; - } - - size_t random_distance = random_int(0,max_distance); - output_distance += 2 * random_distance; - input_distance += random_distance; - } - else - { - input_distance = input_strides[dimensions-1] * lengths[dimensions-1] + random_int(0,max_distance); - output_distance = 2 * input_distance; - } - - // check for ok - if( dimensions >= 2 ) - if( output_strides[1] != 2 * input_strides[1] ) - throw std::runtime_error( "invalid stride y generated for c2r" ); - - if( dimensions >= 3 ) - if( output_strides[2] != 2 * input_strides[2] ) - throw std::runtime_error( "invalid stride z generated for c2r" ); - - if( output_distance != 2 * input_distance ) - throw std::runtime_error( "invalid distance generated for c2r" ); - } - else // placeness::in_place c2c or placeness::out_of_place - { - // input first - if( fifty_percent_chance() ) - { - // tightly packed input - // leave stride vector empty - - input_distance = 0; - } - else // input has padding - { - for( int i = 0; i < dimensions; i++) - { - if( i == 0 ) - input_strides.push_back( random_int(1,max_stride) ); - else - input_strides.push_back( lengths[i-1] * input_strides[i-1] + random_int(0,max_stride) ); - } - - input_distance = input_strides[dimensions-1] * lengths[dimensions-1] + random_int(max_distance); - } - - // output next - if( is_in_place() && is_c2c() ) - { - output_strides = input_strides; - output_distance = input_distance; - } - else if( fifty_percent_chance() ) - { - // tightly packed output - // leave stride vector empty - - output_distance = 0; - } - else // output has padding - { - for( int i = 0; i < dimensions; i++) - { - if( i == 0 ) - output_strides.push_back( random_int(1,max_stride) ); - else - output_strides.push_back( lengths[i-1] * output_strides[i-1] + random_int(0,max_stride) ); - } - - output_distance = output_strides[dimensions-1] * lengths[dimensions-1] + random_int(max_distance); - } - } - - if( fifty_percent_chance() ) - { - // we'll want batches sometimes . . . - - // limit the batch size, taking in account available space and size of each pass - size_t current_problem_size; - if( input_strides.empty() ) - current_problem_size = total_size_in_points(); - else - current_problem_size = input_strides[dimensions-1] * lengths[dimensions-1]; - - size_t max_problem_size = max_problem_size_in_datapoints( precision, input_layout ); - size_t max_batch_size_for_this_problem = max_problem_size / current_problem_size; - if( max_batch_size_for_this_problem <= 1 ) - batch_size = 1; - else - batch_size = random_int( 1, max_batch_size_for_this_problem ); - } - else - { - // . . . and sometimes we won't - - batch_size = 1; - } - } - catch( const std::exception& err ) - { - handle_exception(err); - } - } - }; //struct Parameters - - struct plant_seed { - time_t the_seed; - - plant_seed(time_t seed_in) : - the_seed( seed_in ) - { - random_parameter_generator.seed( static_cast( the_seed ) ); - ::testing::Test::RecordProperty("parameter_seed", static_cast(the_seed)); - std::cout << "Random test's seed is " << the_seed << std::endl; - } - }; - - class TestParameterGenerator { - private: - std::vector data_sets; - public: - TestParameterGenerator(int number_of_data_sets) - : initial_seed(random_test_parameter_seed) - { - generate(number_of_data_sets); - } - - std::vector & parameter_sets() { return data_sets; } - - private: - void generate(int number_of_data_sets) { - for( int i=0; i { - protected: - accuracy_test_random(){} - virtual ~accuracy_test_random(){} - virtual void SetUp(){} - virtual void TearDown(){} +// TODO this is pasted from cl_transform.h +// it should be put in one place for everybody to use +/*****************************************************/ +layout::buffer_layout_t cl_layout_to_buffer_layout(clfftLayout cl_layout) { + if (cl_layout == CLFFT_REAL) + return layout::real; + else if (cl_layout == CLFFT_HERMITIAN_PLANAR) + return layout::hermitian_planar; + else if (cl_layout == CLFFT_COMPLEX_PLANAR) + return layout::complex_planar; + else if (cl_layout == CLFFT_HERMITIAN_INTERLEAVED) + return layout::hermitian_interleaved; + else if (cl_layout == CLFFT_COMPLEX_INTERLEAVED) + return layout::complex_interleaved; + else + throw std::runtime_error("invalid cl_layout"); +} + +const size_t one_gb = 1024 * 1024 * 1024; + +size_t size_of_one_point(clfftPrecision precision, clfftLayout layout) { + size_t size_of_one_point; + // size of one point will be 1 or 2, depending on whether the points are real + // or complex + if (layout == CLFFT_COMPLEX_INTERLEAVED || layout == CLFFT_COMPLEX_PLANAR || + layout == CLFFT_HERMITIAN_PLANAR || layout == CLFFT_HERMITIAN_INTERLEAVED) + size_of_one_point = 2; + else if (layout == CLFFT_REAL) + size_of_one_point = 1; + else + throw std::invalid_argument( + "random_supported_problem_size: invalid layout provided"); + + // each value in a point will be the size of a float or the size of a double, + // depending on the precision + if (precision == CLFFT_SINGLE) + size_of_one_point *= sizeof(float); + else if (precision == CLFFT_DOUBLE) + size_of_one_point *= sizeof(double); + else + throw std::invalid_argument( + "random_supported_problem_size: invalid precision provided"); + + return size_of_one_point; +} + +// the CPU can have a lot of memory hanging off of it. in these cases and when +// CPU is the cl device, huge amounts of memory might be dedicated to each +// buffer. in practice, large buffer sizes _destroy_ performance (and can +// effectively hang the machine). that is bad. to get around this, we limit each +// buffer to a GB +size_t max_memory_size_for_one_buffer() { + size_t max_mem = max_mem_available_on_cl_device(0); + if (max_mem > one_gb) + return one_gb; + else + return max_mem; +} + +size_t max_problem_size_in_datapoints(clfftPrecision precision, + clfftLayout layout) { + // we divide by 32 to shrink things just a bit. otherwise problems take a + // billion hours each + return max_memory_size_for_one_buffer() / + size_of_one_point(precision, layout) / 32; +} + +boost::mt19937 random_parameter_generator; +boost::uniform_int<> distribution(1, INT_MAX); +boost::variate_generator> + random_value(random_parameter_generator, distribution); + +size_t random_int() { return random_value(); } + +size_t random_int(size_t max) { return random_value() % (max + 1); } + +size_t random_int(size_t min, size_t max) { + return (random_value() % ((max + 1) - min)) + min; +} + +std::vector random_supported_problem_size(size_t dimensions, + clfftPrecision precision, + clfftLayout layout) { + std::vector lengths; + + std::vector supported_radices; + supported_radices.push_back(2); + supported_radices.push_back(3); + supported_radices.push_back(5); + supported_radices.push_back(7); + + // total size of this problem should be some fraction of the total space + // available on the device + size_t this_problem_size = + random_int(1, max_problem_size_in_datapoints(precision, layout)); + + size_t total_problem_size = 1; + std::vector factors; + + while (total_problem_size < this_problem_size) { + size_t a_factor = + supported_radices[random_int(0, supported_radices.size() - 1)]; + if (total_problem_size * a_factor <= this_problem_size) { + total_problem_size *= a_factor; + factors.push_back(a_factor); + } else + break; + } // problem size is now factored into some permutation of 2s, 3s, and 5s + // (exact combination stored in "factors" + + for (size_t i = 0; i < dimensions; ++i) + lengths.push_back(1); + + // distribute the values in factors to each valid length value + while (!factors.empty()) { + size_t which_factor = random_int(0, factors.size() - 1); + size_t dim = random_int(0, dimensions - 1); + lengths[dim] *= factors[which_factor]; + factors.erase(factors.begin() + which_factor); + } + + // by the time we reach the end, we've calculated the total problem size, + // split it up into valid radices, and distributed those among the dimensions + // available + + if (lengths.size() != dimensions) + throw std::runtime_error("random_supported_problem_size: number of lengths " + "does not corroborate number of dimensions"); + + return lengths; +} + +struct Parameters { + size_t batch_size; + clfftPrecision precision; + clfftDirection direction; + clfftDim dimensions; + std::vector lengths; + std::vector input_strides; + std::vector output_strides; + size_t input_distance; + size_t output_distance; + clfftLayout input_layout; + clfftLayout output_layout; + clfftResultLocation placeness; + double forward_scale; + double backward_scale; + data_pattern pattern; + size_t data_seed; + // start scales at double. we can just cast to float at the cost of + // a little precision if single precision is randomly chosen. no biggie + + // we want to define a maximum stride so that memory does not get out of + // control + static const size_t max_stride = 5; + static const size_t max_distance = 128; + + size_t total_size_in_points() { + if (lengths.empty()) + throw std::runtime_error("you shouldn't be here!"); + + size_t total_size = 1; + for (size_t i = 0; i < lengths.size(); i++) + total_size *= lengths[i]; + + return total_size; + } + + bool is_in_place() { + if (placeness == CLFFT_INPLACE) + return true; + else + return false; + } + + bool is_out_of_place() { return !is_in_place(); } + + bool is_r2c() { + if (input_layout == CLFFT_REAL) + return true; + else + return false; + } + + bool is_c2r() { + if (output_layout == CLFFT_REAL) + return true; + else + return false; + } + + bool is_c2c() { + if ((input_layout == CLFFT_COMPLEX_INTERLEAVED || + input_layout == CLFFT_COMPLEX_PLANAR) && + (output_layout == CLFFT_COMPLEX_INTERLEAVED || + output_layout == CLFFT_COMPLEX_PLANAR)) + return true; + else + return false; + } + + bool fifty_percent_chance() { + if (random_int(0, 1)) + return true; + else + return false; + } + + void generate_x_strides() { + input_strides.push_back(random_int(1, max_stride)); + output_strides.push_back(random_int(1, max_stride)); + } + + Parameters() + : precision(static_cast( + random_int(CLFFT_SINGLE, CLFFT_DOUBLE))), + dimensions( + static_cast(random_int(CLFFT_1D, ENDDIMENSION - 1))), + placeness(static_cast( + random_int(CLFFT_INPLACE, CLFFT_OUTOFPLACE))), + input_layout(static_cast( + random_int(CLFFT_COMPLEX_INTERLEAVED, CLFFT_REAL))), + forward_scale(static_cast(random_int()) / + static_cast(random_int())), + backward_scale(static_cast(random_int()) / + static_cast(random_int())), + pattern(erratic), data_seed(random_int()) { + try { + // input and output layouts have strict requirements, so we'll base the + // output layout off of our randomly selected input layout + if (input_layout == CLFFT_REAL) { + if (placeness == CLFFT_INPLACE) + output_layout = CLFFT_HERMITIAN_INTERLEAVED; + else if (placeness == CLFFT_OUTOFPLACE) + output_layout = static_cast( + random_int(CLFFT_HERMITIAN_INTERLEAVED, CLFFT_HERMITIAN_PLANAR)); + else + throw std::runtime_error("parameter generator invalid placeness"); + } else if (input_layout == CLFFT_HERMITIAN_INTERLEAVED) { + output_layout = CLFFT_REAL; + } else if (input_layout == CLFFT_HERMITIAN_PLANAR) { + // in-place transforms not supported with hermitian planar + placeness = CLFFT_OUTOFPLACE; + + output_layout = CLFFT_REAL; + } else if (input_layout == CLFFT_COMPLEX_INTERLEAVED || + input_layout == CLFFT_COMPLEX_PLANAR) { + // complex is a little simpler. we can do them together here + if (placeness == CLFFT_INPLACE) + output_layout = input_layout; + else + output_layout = static_cast( + random_int(CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_PLANAR)); + } else { + throw std::runtime_error("parameter generator invalid input layout"); + } + + direction = random_int(0, 1) ? CLFFT_FORWARD : CLFFT_BACKWARD; + + lengths = + random_supported_problem_size(dimensions, precision, input_layout); + + // strides and distances + + if (fifty_percent_chance()) // about half the time, we just want unit + // strides + { + // input_strides and output_strides remain empty + + input_distance = 0; + output_distance = 0; + } else if (is_in_place() && is_r2c()) { + generate_x_strides(); + + // generate y strides + if (dimensions >= 2) { + size_t random_y_stride = random_int(0, max_stride); + input_strides.push_back(input_strides[0] * (1 + lengths[0] / 2) * 2 + + 2 * random_y_stride); + output_strides.push_back(output_strides[0] * (1 + lengths[0] / 2) + + random_y_stride); + + // both strides need to be able to fit both the input and the output + if (input_strides[1] > 2 * output_strides[1]) { + output_strides[1] = input_strides[1] / 2; + } else if (input_strides[1] < 2 * output_strides[1]) { + input_strides[1] = 2 * output_strides[1]; + } + } + + // generate z strides + if (dimensions >= 3) { + output_strides.push_back(output_strides[1] * lengths[1]); + input_strides.push_back(2 * output_strides[2]); + } + + // generate distance + + // 1D is a special case with distances, because we need to make sure + // we have the extra padding that we would have otherwise gotten from + // the y dimension + if (dimensions == 1) { + input_distance = input_strides[0] * (1 + lengths[0] / 2) * 2; + output_distance = output_strides[0] * (1 + lengths[0] / 2); + + // both strides need to be able to fit both the input and the output + if (input_distance > 2 * output_distance) { + output_distance = input_distance / 2; + } else if (input_distance < 2 * output_distance) { + input_distance = 2 * output_distance; + } + + size_t random_distance = random_int(0, max_distance); + input_distance += 2 * random_distance; + output_distance += random_distance; + } else { + output_distance = + output_strides[dimensions - 1] * lengths[dimensions - 1] + + random_int(0, max_distance); + input_distance = 2 * output_distance; + } + + // check for ok + if (dimensions >= 2) + if (input_strides[1] != 2 * output_strides[1]) + throw std::runtime_error("invalid stride y generated for r2c"); + + if (dimensions >= 3) + if (input_strides[2] != 2 * output_strides[2]) + throw std::runtime_error("invalid stride z generated for r2c"); + + if (input_distance != 2 * output_distance) + throw std::runtime_error("invalid distance generated for r2c"); + } else if (is_in_place() && is_c2r()) { + generate_x_strides(); + + // generate y strides + if (dimensions >= 2) { + size_t random_y_stride = random_int(0, max_stride); + output_strides.push_back(output_strides[0] * (1 + lengths[0] / 2) * + 2 + + 2 * random_y_stride); + input_strides.push_back(input_strides[0] * (1 + lengths[0] / 2) + + random_y_stride); + + // both strides need to be able to fit both the output and the input + if (output_strides[1] > 2 * input_strides[1]) { + input_strides[1] = output_strides[1] / 2; + } else if (output_strides[1] < 2 * input_strides[1]) { + output_strides[1] = 2 * input_strides[1]; + } + } + + // generate z strides + if (dimensions >= 3) { + input_strides.push_back(input_strides[1] * lengths[1]); + output_strides.push_back(2 * input_strides[2]); + } + + // generate distance + + // 1D is a special case with distances, because we need to make sure + // we have the extra padding that we would have otherwise gotten from + // the y dimension + if (dimensions == 1) { + output_distance = output_strides[0] * (1 + lengths[0] / 2) * 2; + input_distance = input_strides[0] * (1 + lengths[0] / 2); + + // both strides need to be able to fit both the output and the input + if (output_distance > 2 * input_distance) { + input_distance = output_distance / 2; + } else if (output_distance < 2 * input_distance) { + output_distance = 2 * input_distance; + } + + size_t random_distance = random_int(0, max_distance); + output_distance += 2 * random_distance; + input_distance += random_distance; + } else { + input_distance = + input_strides[dimensions - 1] * lengths[dimensions - 1] + + random_int(0, max_distance); + output_distance = 2 * input_distance; + } + + // check for ok + if (dimensions >= 2) + if (output_strides[1] != 2 * input_strides[1]) + throw std::runtime_error("invalid stride y generated for c2r"); + + if (dimensions >= 3) + if (output_strides[2] != 2 * input_strides[2]) + throw std::runtime_error("invalid stride z generated for c2r"); + + if (output_distance != 2 * input_distance) + throw std::runtime_error("invalid distance generated for c2r"); + } else // placeness::in_place c2c or placeness::out_of_place + { + // input first + if (fifty_percent_chance()) { + // tightly packed input + // leave stride vector empty + + input_distance = 0; + } else // input has padding + { + for (int i = 0; i < dimensions; i++) { + if (i == 0) + input_strides.push_back(random_int(1, max_stride)); + else + input_strides.push_back(lengths[i - 1] * input_strides[i - 1] + + random_int(0, max_stride)); + } + + input_distance = + input_strides[dimensions - 1] * lengths[dimensions - 1] + + random_int(max_distance); + } + + // output next + if (is_in_place() && is_c2c()) { + output_strides = input_strides; + output_distance = input_distance; + } else if (fifty_percent_chance()) { + // tightly packed output + // leave stride vector empty + + output_distance = 0; + } else // output has padding + { + for (int i = 0; i < dimensions; i++) { + if (i == 0) + output_strides.push_back(random_int(1, max_stride)); + else + output_strides.push_back(lengths[i - 1] * output_strides[i - 1] + + random_int(0, max_stride)); + } + + output_distance = + output_strides[dimensions - 1] * lengths[dimensions - 1] + + random_int(max_distance); + } + } + + if (fifty_percent_chance()) { + // we'll want batches sometimes . . . + + // limit the batch size, taking in account available space and size of + // each pass + size_t current_problem_size; + if (input_strides.empty()) + current_problem_size = total_size_in_points(); + else + current_problem_size = + input_strides[dimensions - 1] * lengths[dimensions - 1]; + + size_t max_problem_size = + max_problem_size_in_datapoints(precision, input_layout); + size_t max_batch_size_for_this_problem = + max_problem_size / current_problem_size; + if (max_batch_size_for_this_problem <= 1) + batch_size = 1; + else + batch_size = random_int(1, max_batch_size_for_this_problem); + } else { + // . . . and sometimes we won't + + batch_size = 1; + } + } catch (const std::exception &err) { + handle_exception(err); + } + } +}; // struct Parameters + +struct plant_seed { + time_t the_seed; + + plant_seed(time_t seed_in) : the_seed(seed_in) { + random_parameter_generator.seed(static_cast(the_seed)); + ::testing::Test::RecordProperty("parameter_seed", + static_cast(the_seed)); + std::cout << "Random test's seed is " << the_seed << std::endl; + } +}; + +class TestParameterGenerator { +private: + std::vector data_sets; + +public: + TestParameterGenerator(int number_of_data_sets) + : initial_seed(random_test_parameter_seed) { + generate(number_of_data_sets); + } + + std::vector ¶meter_sets() { return data_sets; } + +private: + void generate(int number_of_data_sets) { + for (int i = 0; i < number_of_data_sets; i++) { + data_sets.push_back(Parameters()); + } + } + + ParameterizedTest::plant_seed initial_seed; +}; // class TestParameterGenerator + +} // namespace ParameterizedTest + +class accuracy_test_random + : public ::testing::TestWithParam { +protected: + accuracy_test_random() {} + virtual ~accuracy_test_random() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -TEST_P( accuracy_test_random, random_transform ) { - try { - ParameterizedTest::Parameters params = GetParam(); - RecordProperty("batch_size", (int)params.batch_size); - RecordProperty("precision", params.precision); - RecordProperty("direction", params.direction); - RecordProperty("dimensions", params.dimensions); - RecordProperty("length_x", (int)params.lengths[0]); - if( params.dimensions >= CLFFT_2D) RecordProperty("length_y", (int)params.lengths[1]); - if( params.dimensions >= CLFFT_3D) RecordProperty("length_z", (int)params.lengths[2]); - - if( params.input_strides.empty() ) - { - RecordProperty("input_strides", 0); - } - else - { - RecordProperty("input_stride_x", (int)params.input_strides[0]); - if( params.dimensions >= CLFFT_2D) RecordProperty("input_stride_y", (int)params.input_strides[1]); - if( params.dimensions >= CLFFT_3D) RecordProperty("input_stride_z", (int)params.input_strides[2]); - } - - if( params.output_strides.empty() ) - { - RecordProperty("output_strides", 0); - } - else - { - RecordProperty("output_stride_x", (int)params.output_strides[0]); - if( params.dimensions >= CLFFT_2D) RecordProperty("output_stride_y", (int)params.output_strides[1]); - if( params.dimensions >= CLFFT_3D) RecordProperty("output_stride_z", (int)params.output_strides[2]); - } - - RecordProperty("input_distance", (int)params.input_distance); - RecordProperty("output_distance", (int)params.output_distance); - RecordProperty("input_layout", params.input_layout); - RecordProperty("output_layout", params.output_layout); - RecordProperty("placeness", params.placeness); - RecordProperty("forward_scale", (int)params.forward_scale); - RecordProperty("backward_scale", (int)params.backward_scale); - RecordProperty("data_seed", (int)params.data_seed); - - // SO BAD - super_duper_global_seed = params.data_seed; - - if( params.precision == CLFFT_SINGLE ) - { - if( params.input_layout == CLFFT_REAL && ( params.output_layout == CLFFT_HERMITIAN_INTERLEAVED || params.output_layout == CLFFT_HERMITIAN_PLANAR ) ) - { - real_to_complex( params.pattern, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - ParameterizedTest::cl_layout_to_buffer_layout( params.output_layout ), - params.placeness == CLFFT_INPLACE ? placeness::in_place : placeness::out_of_place ); - } - else if( ( params.input_layout == CLFFT_HERMITIAN_INTERLEAVED || params.input_layout == CLFFT_HERMITIAN_PLANAR ) && params.output_layout == CLFFT_REAL ) - { - complex_to_real( params.pattern, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - ParameterizedTest::cl_layout_to_buffer_layout( params.input_layout ), - params.placeness == CLFFT_INPLACE ? placeness::in_place : placeness::out_of_place ); - } - else if( ( params.input_layout == CLFFT_COMPLEX_INTERLEAVED || params.input_layout == CLFFT_COMPLEX_PLANAR ) && - ( params.output_layout == CLFFT_COMPLEX_INTERLEAVED || params.output_layout == CLFFT_COMPLEX_PLANAR ) ) - { - complex_to_complex( params.pattern, - params.direction == CLFFT_FORWARD ? direction::forward : direction::backward, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - ParameterizedTest::cl_layout_to_buffer_layout( params.input_layout ), - ParameterizedTest::cl_layout_to_buffer_layout( params.output_layout ), - params.placeness == CLFFT_INPLACE ? placeness::in_place : placeness::out_of_place ); - } - else - { - throw std::runtime_error( "bad layout combination" ); - } - } - else if( params.precision == CLFFT_DOUBLE ) - { - if( params.input_layout == CLFFT_REAL && ( params.output_layout == CLFFT_HERMITIAN_INTERLEAVED || params.output_layout == CLFFT_HERMITIAN_PLANAR ) ) - { - real_to_complex( params.pattern, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - ParameterizedTest::cl_layout_to_buffer_layout( params.output_layout ), - params.placeness == CLFFT_INPLACE ? placeness::in_place : placeness::out_of_place ); - } - else if( ( params.input_layout == CLFFT_HERMITIAN_INTERLEAVED || params.input_layout == CLFFT_HERMITIAN_PLANAR ) && params.output_layout == CLFFT_REAL ) - { - complex_to_real( params.pattern, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - ParameterizedTest::cl_layout_to_buffer_layout( params.input_layout ), - params.placeness == CLFFT_INPLACE ? placeness::in_place : placeness::out_of_place ); - } - else if( ( params.input_layout == CLFFT_COMPLEX_INTERLEAVED || params.input_layout == CLFFT_COMPLEX_PLANAR ) && - ( params.output_layout == CLFFT_COMPLEX_INTERLEAVED || params.output_layout == CLFFT_COMPLEX_PLANAR ) ) - { - complex_to_complex( params.pattern, - params.direction == CLFFT_FORWARD ? direction::forward : direction::backward, - params.lengths, - params.batch_size, - params.input_strides, - params.output_strides, - params.input_distance, - params.output_distance, - ParameterizedTest::cl_layout_to_buffer_layout( params.input_layout ), - ParameterizedTest::cl_layout_to_buffer_layout( params.output_layout ), - params.placeness == CLFFT_INPLACE ? placeness::in_place : placeness::out_of_place ); - } - else - { - throw std::runtime_error( "bad layout combination" ); - } - } - else - { - throw std::runtime_error("Random test: this code path should never be executed"); - } - } - catch( const std::exception& err ) { - handle_exception(err); - } +TEST_P(accuracy_test_random, random_transform) { + try { + ParameterizedTest::Parameters params = GetParam(); + RecordProperty("batch_size", (int)params.batch_size); + RecordProperty("precision", params.precision); + RecordProperty("direction", params.direction); + RecordProperty("dimensions", params.dimensions); + RecordProperty("length_x", (int)params.lengths[0]); + if (params.dimensions >= CLFFT_2D) + RecordProperty("length_y", (int)params.lengths[1]); + if (params.dimensions >= CLFFT_3D) + RecordProperty("length_z", (int)params.lengths[2]); + + if (params.input_strides.empty()) { + RecordProperty("input_strides", 0); + } else { + RecordProperty("input_stride_x", (int)params.input_strides[0]); + if (params.dimensions >= CLFFT_2D) + RecordProperty("input_stride_y", (int)params.input_strides[1]); + if (params.dimensions >= CLFFT_3D) + RecordProperty("input_stride_z", (int)params.input_strides[2]); + } + + if (params.output_strides.empty()) { + RecordProperty("output_strides", 0); + } else { + RecordProperty("output_stride_x", (int)params.output_strides[0]); + if (params.dimensions >= CLFFT_2D) + RecordProperty("output_stride_y", (int)params.output_strides[1]); + if (params.dimensions >= CLFFT_3D) + RecordProperty("output_stride_z", (int)params.output_strides[2]); + } + + RecordProperty("input_distance", (int)params.input_distance); + RecordProperty("output_distance", (int)params.output_distance); + RecordProperty("input_layout", params.input_layout); + RecordProperty("output_layout", params.output_layout); + RecordProperty("placeness", params.placeness); + RecordProperty("forward_scale", (int)params.forward_scale); + RecordProperty("backward_scale", (int)params.backward_scale); + RecordProperty("data_seed", (int)params.data_seed); + + // SO BAD + super_duper_global_seed = params.data_seed; + + if (params.precision == CLFFT_SINGLE) { + if (params.input_layout == CLFFT_REAL && + (params.output_layout == CLFFT_HERMITIAN_INTERLEAVED || + params.output_layout == CLFFT_HERMITIAN_PLANAR)) { + real_to_complex( + params.pattern, params.lengths, params.batch_size, + params.input_strides, params.output_strides, params.input_distance, + params.output_distance, + ParameterizedTest::cl_layout_to_buffer_layout(params.output_layout), + params.placeness == CLFFT_INPLACE ? placeness::in_place + : placeness::out_of_place); + } else if ((params.input_layout == CLFFT_HERMITIAN_INTERLEAVED || + params.input_layout == CLFFT_HERMITIAN_PLANAR) && + params.output_layout == CLFFT_REAL) { + complex_to_real( + params.pattern, params.lengths, params.batch_size, + params.input_strides, params.output_strides, params.input_distance, + params.output_distance, + ParameterizedTest::cl_layout_to_buffer_layout(params.input_layout), + params.placeness == CLFFT_INPLACE ? placeness::in_place + : placeness::out_of_place); + } else if ((params.input_layout == CLFFT_COMPLEX_INTERLEAVED || + params.input_layout == CLFFT_COMPLEX_PLANAR) && + (params.output_layout == CLFFT_COMPLEX_INTERLEAVED || + params.output_layout == CLFFT_COMPLEX_PLANAR)) { + complex_to_complex( + params.pattern, + params.direction == CLFFT_FORWARD ? direction::forward + : direction::backward, + params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + ParameterizedTest::cl_layout_to_buffer_layout(params.input_layout), + ParameterizedTest::cl_layout_to_buffer_layout(params.output_layout), + params.placeness == CLFFT_INPLACE ? placeness::in_place + : placeness::out_of_place); + } else { + throw std::runtime_error("bad layout combination"); + } + } else if (params.precision == CLFFT_DOUBLE) { + if (params.input_layout == CLFFT_REAL && + (params.output_layout == CLFFT_HERMITIAN_INTERLEAVED || + params.output_layout == CLFFT_HERMITIAN_PLANAR)) { + real_to_complex( + params.pattern, params.lengths, params.batch_size, + params.input_strides, params.output_strides, params.input_distance, + params.output_distance, + ParameterizedTest::cl_layout_to_buffer_layout(params.output_layout), + params.placeness == CLFFT_INPLACE ? placeness::in_place + : placeness::out_of_place); + } else if ((params.input_layout == CLFFT_HERMITIAN_INTERLEAVED || + params.input_layout == CLFFT_HERMITIAN_PLANAR) && + params.output_layout == CLFFT_REAL) { + complex_to_real( + params.pattern, params.lengths, params.batch_size, + params.input_strides, params.output_strides, params.input_distance, + params.output_distance, + ParameterizedTest::cl_layout_to_buffer_layout(params.input_layout), + params.placeness == CLFFT_INPLACE ? placeness::in_place + : placeness::out_of_place); + } else if ((params.input_layout == CLFFT_COMPLEX_INTERLEAVED || + params.input_layout == CLFFT_COMPLEX_PLANAR) && + (params.output_layout == CLFFT_COMPLEX_INTERLEAVED || + params.output_layout == CLFFT_COMPLEX_PLANAR)) { + complex_to_complex( + params.pattern, + params.direction == CLFFT_FORWARD ? direction::forward + : direction::backward, + params.lengths, params.batch_size, params.input_strides, + params.output_strides, params.input_distance, + params.output_distance, + ParameterizedTest::cl_layout_to_buffer_layout(params.input_layout), + ParameterizedTest::cl_layout_to_buffer_layout(params.output_layout), + params.placeness == CLFFT_INPLACE ? placeness::in_place + : placeness::out_of_place); + } else { + throw std::runtime_error("bad layout combination"); + } + } else { + throw std::runtime_error( + "Random test: this code path should never be executed"); + } + } catch (const std::exception &err) { + handle_exception(err); + } } INSTANTIATE_TEST_CASE_P( - clfft_RandomTest, - accuracy_test_random, - ::testing::ValuesIn( ParameterizedTest::TestParameterGenerator - ((int)number_of_random_tests).parameter_sets()) -); + clfft_RandomTest, accuracy_test_random, + ::testing::ValuesIn( + ParameterizedTest::TestParameterGenerator((int)number_of_random_tests) + .parameter_sets())); diff --git a/src/tests/buffer.cpp b/src/tests/buffer.cpp index 4ed68482..1ad0c667 100644 --- a/src/tests/buffer.cpp +++ b/src/tests/buffer.cpp @@ -14,7 +14,6 @@ * limitations under the License. * ************************************************************************/ - #include #include "buffer.h" @@ -23,447 +22,482 @@ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ class test_harness_tests_buffer : public ::testing::Test { protected: - test_harness_tests_buffer() {} - virtual ~test_harness_tests_buffer(){ - } - virtual void SetUp() - { - suppress_output = true; - } - virtual void TearDown() - { - suppress_output = false; - } + test_harness_tests_buffer() {} + virtual ~test_harness_tests_buffer() {} + virtual void SetUp() { suppress_output = true; } + virtual void TearDown() { suppress_output = false; } }; /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, even_length_hermitian_buffers_are_halfish_size) { - size_t dimensions = 3; - size_t lengths[3] = {8, 2, 4}; - size_t* stride_null = NULL; - size_t batch = 3; - size_t distance = 0; - - buffer interleaved_buffer( dimensions, lengths, stride_null, batch, distance, layout::hermitian_interleaved, CLFFT_OUTOFPLACE ); - EXPECT_EQ( 5, interleaved_buffer.length(dimx) ); - EXPECT_EQ( 2, interleaved_buffer.length(dimy) ); - EXPECT_EQ( 4, interleaved_buffer.length(dimz) ); - - buffer planar_buffer( dimensions, lengths, stride_null, batch, distance, layout::hermitian_planar, CLFFT_OUTOFPLACE ); - EXPECT_EQ( 5, planar_buffer.length(dimx) ); - EXPECT_EQ( 2, planar_buffer.length(dimy) ); - EXPECT_EQ( 4, planar_buffer.length(dimz) ); +TEST_F(test_harness_tests_buffer, + even_length_hermitian_buffers_are_halfish_size) { + size_t dimensions = 3; + size_t lengths[3] = {8, 2, 4}; + size_t *stride_null = NULL; + size_t batch = 3; + size_t distance = 0; + + buffer interleaved_buffer(dimensions, lengths, stride_null, batch, + distance, layout::hermitian_interleaved, + CLFFT_OUTOFPLACE); + EXPECT_EQ(5, interleaved_buffer.length(dimx)); + EXPECT_EQ(2, interleaved_buffer.length(dimy)); + EXPECT_EQ(4, interleaved_buffer.length(dimz)); + + buffer planar_buffer(dimensions, lengths, stride_null, batch, distance, + layout::hermitian_planar, CLFFT_OUTOFPLACE); + EXPECT_EQ(5, planar_buffer.length(dimx)); + EXPECT_EQ(2, planar_buffer.length(dimy)); + EXPECT_EQ(4, planar_buffer.length(dimz)); } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, odd_length_hermitian_buffers_are_halfish_size) { - size_t dimensions = 3; - size_t lengths[3] = {9, 2, 4}; - size_t* stride_null = NULL; - size_t batch = 3; - size_t distance = 0; - - buffer interleaved_buffer( dimensions, lengths, stride_null, batch, distance, layout::hermitian_interleaved, CLFFT_OUTOFPLACE ); - EXPECT_EQ( 5, interleaved_buffer.length(dimx) ); - EXPECT_EQ( 2, interleaved_buffer.length(dimy) ); - EXPECT_EQ( 4, interleaved_buffer.length(dimz) ); - - buffer planar_buffer( dimensions, lengths, stride_null, batch, distance, layout::hermitian_planar, CLFFT_OUTOFPLACE ); - EXPECT_EQ( 5, planar_buffer.length(dimx) ); - EXPECT_EQ( 2, planar_buffer.length(dimy) ); - EXPECT_EQ( 4, planar_buffer.length(dimz) ); +TEST_F(test_harness_tests_buffer, + odd_length_hermitian_buffers_are_halfish_size) { + size_t dimensions = 3; + size_t lengths[3] = {9, 2, 4}; + size_t *stride_null = NULL; + size_t batch = 3; + size_t distance = 0; + + buffer interleaved_buffer(dimensions, lengths, stride_null, batch, + distance, layout::hermitian_interleaved, + CLFFT_OUTOFPLACE); + EXPECT_EQ(5, interleaved_buffer.length(dimx)); + EXPECT_EQ(2, interleaved_buffer.length(dimy)); + EXPECT_EQ(4, interleaved_buffer.length(dimz)); + + buffer planar_buffer(dimensions, lengths, stride_null, batch, distance, + layout::hermitian_planar, CLFFT_OUTOFPLACE); + EXPECT_EQ(5, planar_buffer.length(dimx)); + EXPECT_EQ(2, planar_buffer.length(dimy)); + EXPECT_EQ(4, planar_buffer.length(dimz)); } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, even_sized_in_place_real_buffers_should_have_padding) { - // TODO for now, they should all have padding - // eventually, this should be just in-place buffers - size_t dimensions = 1; - size_t lengths[1] = {8}; - size_t* stride_null = NULL; - size_t batch = 3; - size_t distance = 0; - - buffer buffer_1d_float( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - // length of x should not change - EXPECT_EQ( 8, buffer_1d_float.length(dimx) ); - // just the memory size should change - EXPECT_EQ( 10 * batch * sizeof(float), buffer_1d_float.size_in_bytes() ); - - buffer buffer_1d_double( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - EXPECT_EQ( 8, buffer_1d_double.length(dimx) ); - EXPECT_EQ( 10 * batch * sizeof(double), buffer_1d_double.size_in_bytes() ); - - dimensions = 2; - size_t lengths2d[2] = {4, 2}; - buffer buffer_2d_float( dimensions, lengths2d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - EXPECT_EQ( 4, buffer_2d_float.length(dimx) ); - EXPECT_EQ( 6 * lengths2d[dimy] * batch * sizeof(float), buffer_2d_float.size_in_bytes() ); - - buffer buffer_2d_double( dimensions, lengths2d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - EXPECT_EQ( 4, buffer_2d_double.length(dimx) ); - EXPECT_EQ( 6 * lengths2d[dimy] * batch * sizeof(double), buffer_2d_double.size_in_bytes() ); - - dimensions = 3; - size_t lengths3d[3] = {16, 8, 2}; - buffer buffer_3d_float( dimensions, lengths3d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - EXPECT_EQ( 16, buffer_3d_float.length(dimx) ); - EXPECT_EQ( 18 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(float), buffer_3d_float.size_in_bytes() ); - - buffer buffer_3d_double( dimensions, lengths3d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - EXPECT_EQ( 16, buffer_3d_double.length(dimx) ); - EXPECT_EQ( 18 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(double), buffer_3d_double.size_in_bytes() ); +TEST_F(test_harness_tests_buffer, + even_sized_in_place_real_buffers_should_have_padding) { + // TODO for now, they should all have padding + // eventually, this should be just in-place buffers + size_t dimensions = 1; + size_t lengths[1] = {8}; + size_t *stride_null = NULL; + size_t batch = 3; + size_t distance = 0; + + buffer buffer_1d_float(dimensions, lengths, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + // length of x should not change + EXPECT_EQ(8, buffer_1d_float.length(dimx)); + // just the memory size should change + EXPECT_EQ(10 * batch * sizeof(float), buffer_1d_float.size_in_bytes()); + + buffer buffer_1d_double(dimensions, lengths, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + EXPECT_EQ(8, buffer_1d_double.length(dimx)); + EXPECT_EQ(10 * batch * sizeof(double), buffer_1d_double.size_in_bytes()); + + dimensions = 2; + size_t lengths2d[2] = {4, 2}; + buffer buffer_2d_float(dimensions, lengths2d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + EXPECT_EQ(4, buffer_2d_float.length(dimx)); + EXPECT_EQ(6 * lengths2d[dimy] * batch * sizeof(float), + buffer_2d_float.size_in_bytes()); + + buffer buffer_2d_double(dimensions, lengths2d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + EXPECT_EQ(4, buffer_2d_double.length(dimx)); + EXPECT_EQ(6 * lengths2d[dimy] * batch * sizeof(double), + buffer_2d_double.size_in_bytes()); + + dimensions = 3; + size_t lengths3d[3] = {16, 8, 2}; + buffer buffer_3d_float(dimensions, lengths3d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + EXPECT_EQ(16, buffer_3d_float.length(dimx)); + EXPECT_EQ(18 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(float), + buffer_3d_float.size_in_bytes()); + + buffer buffer_3d_double(dimensions, lengths3d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + EXPECT_EQ(16, buffer_3d_double.length(dimx)); + EXPECT_EQ(18 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(double), + buffer_3d_double.size_in_bytes()); } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, odd_sized_in_place_real_buffers_should_have_padding) { - // TODO for now, they should all have padding - // eventually, this should be just in-place buffers - size_t dimensions = 1; - size_t lengths[1] = {15}; - size_t* stride_null = NULL; - size_t batch = 3; - size_t distance = 0; - - buffer buffer_1d_float( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - buffer_1d_float.set_all_to_linear_increase(); - // length of x should not change - EXPECT_EQ( 15, buffer_1d_float.length(dimx) ); - // just the memory size should change - EXPECT_EQ( 16 * batch * sizeof(float), buffer_1d_float.size_in_bytes() ); - - buffer buffer_1d_double( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - buffer_1d_double.set_all_to_linear_increase(); - EXPECT_EQ( 15, buffer_1d_double.length(dimx) ); - EXPECT_EQ( 16 * batch * sizeof(double), buffer_1d_double.size_in_bytes() ); - - dimensions = 2; - size_t lengths2d[2] = {7, 2}; - buffer buffer_2d_float( dimensions, lengths2d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - buffer_2d_float.set_all_to_linear_increase(); - EXPECT_EQ( 7, buffer_2d_float.length(dimx) ); - EXPECT_EQ( 8 * lengths2d[dimy] * batch * sizeof(float), buffer_2d_float.size_in_bytes() ); - - buffer buffer_2d_double( dimensions, lengths2d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - buffer_2d_double.set_all_to_linear_increase(); - EXPECT_EQ( 7, buffer_2d_double.length(dimx) ); - EXPECT_EQ( 8 * lengths2d[dimy] * batch * sizeof(double), buffer_2d_double.size_in_bytes() ); - - dimensions = 3; - size_t lengths3d[3] = {7, 4, 2}; - buffer buffer_3d_float( dimensions, lengths3d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - buffer_3d_float.set_all_to_linear_increase(); - EXPECT_EQ( 7, buffer_3d_float.length(dimx) ); - EXPECT_EQ( 8 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(float), buffer_3d_float.size_in_bytes() ); - - buffer buffer_3d_double( dimensions, lengths3d, stride_null, batch, distance, layout::real, CLFFT_INPLACE ); - buffer_3d_double.set_all_to_linear_increase(); - EXPECT_EQ( 7, buffer_3d_double.length(dimx) ); - EXPECT_EQ( 8 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(double), buffer_3d_double.size_in_bytes() ); +TEST_F(test_harness_tests_buffer, + odd_sized_in_place_real_buffers_should_have_padding) { + // TODO for now, they should all have padding + // eventually, this should be just in-place buffers + size_t dimensions = 1; + size_t lengths[1] = {15}; + size_t *stride_null = NULL; + size_t batch = 3; + size_t distance = 0; + + buffer buffer_1d_float(dimensions, lengths, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + buffer_1d_float.set_all_to_linear_increase(); + // length of x should not change + EXPECT_EQ(15, buffer_1d_float.length(dimx)); + // just the memory size should change + EXPECT_EQ(16 * batch * sizeof(float), buffer_1d_float.size_in_bytes()); + + buffer buffer_1d_double(dimensions, lengths, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + buffer_1d_double.set_all_to_linear_increase(); + EXPECT_EQ(15, buffer_1d_double.length(dimx)); + EXPECT_EQ(16 * batch * sizeof(double), buffer_1d_double.size_in_bytes()); + + dimensions = 2; + size_t lengths2d[2] = {7, 2}; + buffer buffer_2d_float(dimensions, lengths2d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + buffer_2d_float.set_all_to_linear_increase(); + EXPECT_EQ(7, buffer_2d_float.length(dimx)); + EXPECT_EQ(8 * lengths2d[dimy] * batch * sizeof(float), + buffer_2d_float.size_in_bytes()); + + buffer buffer_2d_double(dimensions, lengths2d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + buffer_2d_double.set_all_to_linear_increase(); + EXPECT_EQ(7, buffer_2d_double.length(dimx)); + EXPECT_EQ(8 * lengths2d[dimy] * batch * sizeof(double), + buffer_2d_double.size_in_bytes()); + + dimensions = 3; + size_t lengths3d[3] = {7, 4, 2}; + buffer buffer_3d_float(dimensions, lengths3d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + buffer_3d_float.set_all_to_linear_increase(); + EXPECT_EQ(7, buffer_3d_float.length(dimx)); + EXPECT_EQ(8 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(float), + buffer_3d_float.size_in_bytes()); + + buffer buffer_3d_double(dimensions, lengths3d, stride_null, batch, + distance, layout::real, CLFFT_INPLACE); + buffer_3d_double.set_all_to_linear_increase(); + EXPECT_EQ(7, buffer_3d_double.length(dimx)); + EXPECT_EQ(8 * lengths3d[dimy] * lengths3d[dimz] * batch * sizeof(double), + buffer_3d_double.size_in_bytes()); } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, real_imag_and_complex_functions_return_correct_values) { - try - { - size_t dimensions = 1; - size_t length = 8; - size_t* stride_null = NULL; - size_t batch = 1; - size_t distance = 0; - - buffer interleaved_buffer( dimensions, &length, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - interleaved_buffer.set_all_to_linear_increase(); - - EXPECT_FLOAT_EQ( 1.0f, interleaved_buffer.real( 0 ) ); - EXPECT_FLOAT_EQ( 1.5f, interleaved_buffer.imag( 0 ) ); - EXPECT_FLOAT_EQ( 1.0f, interleaved_buffer.complex( 0 ).real() ); - EXPECT_FLOAT_EQ( 1.5f, interleaved_buffer.complex( 0 ).imag() ); - EXPECT_FLOAT_EQ( 4.0f, interleaved_buffer.real( 3 ) ); - EXPECT_FLOAT_EQ( 4.5f, interleaved_buffer.imag( 3 ) ); - EXPECT_FLOAT_EQ( 4.0f, interleaved_buffer.complex( 3 ).real() ); - EXPECT_FLOAT_EQ( 4.5f, interleaved_buffer.complex( 3 ).imag() ); - EXPECT_FLOAT_EQ( 8.0f, interleaved_buffer.real( 7 ) ); - EXPECT_FLOAT_EQ( 8.5f, interleaved_buffer.imag( 7 ) ); - EXPECT_FLOAT_EQ( 8.0f, interleaved_buffer.complex( 7 ).real() ); - EXPECT_FLOAT_EQ( 8.5f, interleaved_buffer.complex( 7 ).imag() ); - - dimensions = 3; - size_t lengths[3] = { 2, 4, 8 }; - batch = 2; - buffer real_buffer( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - real_buffer.set_all_to_linear_increase(); - - EXPECT_FLOAT_EQ( 1.0f, real_buffer.real( 0, 0, 0, 0 ) ); - EXPECT_FLOAT_EQ( 4.0f, real_buffer.real( 1, 1, 0, 0 ) ); - EXPECT_FLOAT_EQ( 68.0f, real_buffer.real( 1, 1, 0, 1 ) ); - EXPECT_FLOAT_EQ( 56.0f, real_buffer.real( 1, 3, 6, 0 ) ); - EXPECT_FLOAT_EQ( 120.0f, real_buffer.real( 1, 3, 6, 1 ) ); - - dimensions = 2; - lengths[0] = 4; - lengths[1] = 2; - size_t strides[2] = {2, 11}; - distance = 30; - - buffer planar_buffer( dimensions, lengths, strides, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - planar_buffer.set_all_to_linear_increase(); - - EXPECT_DOUBLE_EQ( 1.0f, planar_buffer.real( 0, 0, 0, 0 ) ); - EXPECT_DOUBLE_EQ( 1.5f, planar_buffer.imag( 0, 0, 0, 0 ) ); - EXPECT_DOUBLE_EQ( 1.0f, planar_buffer.complex( 0, 0, 0, 0 ).real() ); - EXPECT_DOUBLE_EQ( 1.5f, planar_buffer.complex( 0, 0, 0, 0 ).imag() ); - EXPECT_DOUBLE_EQ( 4.0f, planar_buffer.real( 3, 0, 0, 0 ) ); - EXPECT_DOUBLE_EQ( 4.5f, planar_buffer.imag( 3, 0, 0, 0 ) ); - EXPECT_DOUBLE_EQ( 4.0f, planar_buffer.complex( 3, 0, 0, 0 ).real() ); - EXPECT_DOUBLE_EQ( 4.5f, planar_buffer.complex( 3, 0, 0, 0 ).imag() ); - EXPECT_DOUBLE_EQ( 15.0f, planar_buffer.real( 2, 1, 0, 1 ) ); - EXPECT_DOUBLE_EQ( 15.5f, planar_buffer.imag( 2, 1, 0, 1 ) ); - EXPECT_DOUBLE_EQ( 15.0f, planar_buffer.complex( 2, 1, 0, 1 ).real() ); - EXPECT_DOUBLE_EQ( 15.5f, planar_buffer.complex( 2, 1, 0, 1 ).imag() ); - } - catch( const std::exception& err ) - { - handle_exception(err); - } +TEST_F(test_harness_tests_buffer, + real_imag_and_complex_functions_return_correct_values) { + try { + size_t dimensions = 1; + size_t length = 8; + size_t *stride_null = NULL; + size_t batch = 1; + size_t distance = 0; + + buffer interleaved_buffer(dimensions, &length, stride_null, batch, + distance, layout::complex_interleaved, + CLFFT_OUTOFPLACE); + interleaved_buffer.set_all_to_linear_increase(); + + EXPECT_FLOAT_EQ(1.0f, interleaved_buffer.real(0)); + EXPECT_FLOAT_EQ(1.5f, interleaved_buffer.imag(0)); + EXPECT_FLOAT_EQ(1.0f, interleaved_buffer.complex(0).real()); + EXPECT_FLOAT_EQ(1.5f, interleaved_buffer.complex(0).imag()); + EXPECT_FLOAT_EQ(4.0f, interleaved_buffer.real(3)); + EXPECT_FLOAT_EQ(4.5f, interleaved_buffer.imag(3)); + EXPECT_FLOAT_EQ(4.0f, interleaved_buffer.complex(3).real()); + EXPECT_FLOAT_EQ(4.5f, interleaved_buffer.complex(3).imag()); + EXPECT_FLOAT_EQ(8.0f, interleaved_buffer.real(7)); + EXPECT_FLOAT_EQ(8.5f, interleaved_buffer.imag(7)); + EXPECT_FLOAT_EQ(8.0f, interleaved_buffer.complex(7).real()); + EXPECT_FLOAT_EQ(8.5f, interleaved_buffer.complex(7).imag()); + + dimensions = 3; + size_t lengths[3] = {2, 4, 8}; + batch = 2; + buffer real_buffer(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + real_buffer.set_all_to_linear_increase(); + + EXPECT_FLOAT_EQ(1.0f, real_buffer.real(0, 0, 0, 0)); + EXPECT_FLOAT_EQ(4.0f, real_buffer.real(1, 1, 0, 0)); + EXPECT_FLOAT_EQ(68.0f, real_buffer.real(1, 1, 0, 1)); + EXPECT_FLOAT_EQ(56.0f, real_buffer.real(1, 3, 6, 0)); + EXPECT_FLOAT_EQ(120.0f, real_buffer.real(1, 3, 6, 1)); + + dimensions = 2; + lengths[0] = 4; + lengths[1] = 2; + size_t strides[2] = {2, 11}; + distance = 30; + + buffer planar_buffer(dimensions, lengths, strides, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + planar_buffer.set_all_to_linear_increase(); + + EXPECT_DOUBLE_EQ(1.0f, planar_buffer.real(0, 0, 0, 0)); + EXPECT_DOUBLE_EQ(1.5f, planar_buffer.imag(0, 0, 0, 0)); + EXPECT_DOUBLE_EQ(1.0f, planar_buffer.complex(0, 0, 0, 0).real()); + EXPECT_DOUBLE_EQ(1.5f, planar_buffer.complex(0, 0, 0, 0).imag()); + EXPECT_DOUBLE_EQ(4.0f, planar_buffer.real(3, 0, 0, 0)); + EXPECT_DOUBLE_EQ(4.5f, planar_buffer.imag(3, 0, 0, 0)); + EXPECT_DOUBLE_EQ(4.0f, planar_buffer.complex(3, 0, 0, 0).real()); + EXPECT_DOUBLE_EQ(4.5f, planar_buffer.complex(3, 0, 0, 0).imag()); + EXPECT_DOUBLE_EQ(15.0f, planar_buffer.real(2, 1, 0, 1)); + EXPECT_DOUBLE_EQ(15.5f, planar_buffer.imag(2, 1, 0, 1)); + EXPECT_DOUBLE_EQ(15.0f, planar_buffer.complex(2, 1, 0, 1).real()); + EXPECT_DOUBLE_EQ(15.5f, planar_buffer.complex(2, 1, 0, 1).imag()); + } catch (const std::exception &err) { + handle_exception(err); + } } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, equivalence_operator_returns_correct_result_with_pointwise_compare) { - try - { - bool comparison_type_restore = comparison_type; - comparison_type = pointwise_compare; - - size_t dimensions = 3; - size_t lengths[3] = { 16, 32, 64 }; - size_t* stride_null = NULL; - size_t batch = 2; - size_t distance = 0; - - // complex test - buffer thing_1( dimensions, lengths, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - buffer thing_2( dimensions, lengths, stride_null, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - EXPECT_EQ( true, thing_1 == thing_2 ); - - thing_2.set_one_data_point( 42.0f, 0.0f, 0, 0, 0, 0 ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - thing_2.set_one_data_point( 16.0f, 0.0f, 15, 31, 63, 1 ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - thing_2.set_one_data_point( 96.0f, 7.8f, 7, 16, 12, 1 ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - thing_1.set_all_to_sawtooth( 42.0f ); - thing_2.set_all_to_sawtooth( 42.0f ); - EXPECT_EQ( true, thing_1 == thing_2 ); - - //---------------------------------------------------// - - // real test - buffer thing_3( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - buffer thing_4( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - - thing_3.set_all_to_sawtooth(1.0f); - thing_4.set_all_to_sawtooth(1.0f); - EXPECT_EQ( true, thing_3 == thing_4 ); - - thing_4.set_one_data_point( 42.0f, 0, 0, 0, 0 ); - EXPECT_EQ( false, thing_3 == thing_4 ); - - thing_3.set_all_to_sawtooth( 42.0f ); - thing_4.set_all_to_sawtooth( 42.0f ); - EXPECT_EQ( true, thing_3 == thing_4 ); - - comparison_type = comparison_type_restore; - } - catch( const std::exception& err ) - { - handle_exception(err); - } +TEST_F(test_harness_tests_buffer, + equivalence_operator_returns_correct_result_with_pointwise_compare) { + try { + bool comparison_type_restore = comparison_type; + comparison_type = pointwise_compare; + + size_t dimensions = 3; + size_t lengths[3] = {16, 32, 64}; + size_t *stride_null = NULL; + size_t batch = 2; + size_t distance = 0; + + // complex test + buffer thing_1(dimensions, lengths, stride_null, batch, distance, + layout::complex_interleaved, CLFFT_OUTOFPLACE); + buffer thing_2(dimensions, lengths, stride_null, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + EXPECT_EQ(true, thing_1 == thing_2); + + thing_2.set_one_data_point(42.0f, 0.0f, 0, 0, 0, 0); + EXPECT_EQ(false, thing_1 == thing_2); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + thing_2.set_one_data_point(16.0f, 0.0f, 15, 31, 63, 1); + EXPECT_EQ(false, thing_1 == thing_2); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + thing_2.set_one_data_point(96.0f, 7.8f, 7, 16, 12, 1); + EXPECT_EQ(false, thing_1 == thing_2); + + thing_1.set_all_to_sawtooth(42.0f); + thing_2.set_all_to_sawtooth(42.0f); + EXPECT_EQ(true, thing_1 == thing_2); + + //---------------------------------------------------// + + // real test + buffer thing_3(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + buffer thing_4(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + + thing_3.set_all_to_sawtooth(1.0f); + thing_4.set_all_to_sawtooth(1.0f); + EXPECT_EQ(true, thing_3 == thing_4); + + thing_4.set_one_data_point(42.0f, 0, 0, 0, 0); + EXPECT_EQ(false, thing_3 == thing_4); + + thing_3.set_all_to_sawtooth(42.0f); + thing_4.set_all_to_sawtooth(42.0f); + EXPECT_EQ(true, thing_3 == thing_4); + + comparison_type = comparison_type_restore; + } catch (const std::exception &err) { + handle_exception(err); + } } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, inequivalence_operator_returns_correct_result_with_pointwise_compare) { - try - { - bool comparison_type_restore = comparison_type; - comparison_type = pointwise_compare; - - size_t dimensions = 3; - size_t lengths[3] = { 16, 32, 64 }; - size_t* stride_null = NULL; - size_t batch = 2; - size_t distance = 0; - - buffer thing_1( dimensions, lengths, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - - buffer thing_2( dimensions, lengths, stride_null, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - EXPECT_EQ( false, thing_1 != thing_2 ); - - thing_2.set_one_data_point( 42.0f, 0, 0, 0, 0, 0 ); - EXPECT_EQ( true, thing_1 != thing_2 ); - - thing_1.set_all_to_sawtooth( 42.0f ); - thing_2.set_all_to_sawtooth( 42.0f ); - EXPECT_EQ( false, thing_1 != thing_2 ); - - comparison_type = comparison_type_restore; - } - catch( const std::exception& err ) - { - handle_exception(err); - } +TEST_F(test_harness_tests_buffer, + inequivalence_operator_returns_correct_result_with_pointwise_compare) { + try { + bool comparison_type_restore = comparison_type; + comparison_type = pointwise_compare; + + size_t dimensions = 3; + size_t lengths[3] = {16, 32, 64}; + size_t *stride_null = NULL; + size_t batch = 2; + size_t distance = 0; + + buffer thing_1(dimensions, lengths, stride_null, batch, distance, + layout::complex_interleaved, CLFFT_OUTOFPLACE); + + buffer thing_2(dimensions, lengths, stride_null, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + EXPECT_EQ(false, thing_1 != thing_2); + + thing_2.set_one_data_point(42.0f, 0, 0, 0, 0, 0); + EXPECT_EQ(true, thing_1 != thing_2); + + thing_1.set_all_to_sawtooth(42.0f); + thing_2.set_all_to_sawtooth(42.0f); + EXPECT_EQ(false, thing_1 != thing_2); + + comparison_type = comparison_type_restore; + } catch (const std::exception &err) { + handle_exception(err); + } } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, equivalence_operator_returns_correct_result_with_rms) { - try - { - bool comparison_type_restore = comparison_type; - comparison_type = root_mean_square; - - size_t dimensions = 3; - size_t lengths[3] = { 16, 32, 64 }; - size_t* stride_null = NULL; - size_t batch = 2; - size_t distance = 0; - - // complex test - buffer thing_1( dimensions, lengths, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - buffer thing_2( dimensions, lengths, stride_null, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - EXPECT_EQ( true, thing_1 == thing_2 ); - - thing_2.set_one_data_point( 42.0f, 0.0f, 0, 0, 0, 0 ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - thing_2.set_one_data_point( 16.0f, 0.0f, 15, 31, 63, 1 ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - thing_2.set_one_data_point( 96.0f, 7.8f, 7, 16, 12, 1 ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - thing_1.set_all_to_sawtooth( 42.0f ); - thing_2.set_all_to_sawtooth( 42.0f ); - EXPECT_EQ( true, thing_1 == thing_2 ); - - //---------------------------------------------------// - - // real test - buffer thing_3( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - buffer thing_4( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - - thing_3.set_all_to_sawtooth(1.0f); - thing_4.set_all_to_sawtooth(1.0f); - EXPECT_EQ( true, thing_3 == thing_4 ); - - thing_4.set_one_data_point( 42.0f, 0, 0, 0, 0 ); - EXPECT_EQ( false, thing_3 == thing_4 ); - - thing_3.set_all_to_sawtooth( 42.0f ); - thing_4.set_all_to_sawtooth( 42.0f ); - EXPECT_EQ( true, thing_3 == thing_4 ); - - comparison_type = comparison_type_restore; - } - catch( const std::exception& err ) - { - handle_exception(err); - } +TEST_F(test_harness_tests_buffer, + equivalence_operator_returns_correct_result_with_rms) { + try { + bool comparison_type_restore = comparison_type; + comparison_type = root_mean_square; + + size_t dimensions = 3; + size_t lengths[3] = {16, 32, 64}; + size_t *stride_null = NULL; + size_t batch = 2; + size_t distance = 0; + + // complex test + buffer thing_1(dimensions, lengths, stride_null, batch, distance, + layout::complex_interleaved, CLFFT_OUTOFPLACE); + buffer thing_2(dimensions, lengths, stride_null, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + EXPECT_EQ(true, thing_1 == thing_2); + + thing_2.set_one_data_point(42.0f, 0.0f, 0, 0, 0, 0); + EXPECT_EQ(false, thing_1 == thing_2); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + thing_2.set_one_data_point(16.0f, 0.0f, 15, 31, 63, 1); + EXPECT_EQ(false, thing_1 == thing_2); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + thing_2.set_one_data_point(96.0f, 7.8f, 7, 16, 12, 1); + EXPECT_EQ(false, thing_1 == thing_2); + + thing_1.set_all_to_sawtooth(42.0f); + thing_2.set_all_to_sawtooth(42.0f); + EXPECT_EQ(true, thing_1 == thing_2); + + //---------------------------------------------------// + + // real test + buffer thing_3(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + buffer thing_4(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + + thing_3.set_all_to_sawtooth(1.0f); + thing_4.set_all_to_sawtooth(1.0f); + EXPECT_EQ(true, thing_3 == thing_4); + + thing_4.set_one_data_point(42.0f, 0, 0, 0, 0); + EXPECT_EQ(false, thing_3 == thing_4); + + thing_3.set_all_to_sawtooth(42.0f); + thing_4.set_all_to_sawtooth(42.0f); + EXPECT_EQ(true, thing_3 == thing_4); + + comparison_type = comparison_type_restore; + } catch (const std::exception &err) { + handle_exception(err); + } } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, inequivalence_operator_returns_correct_result_with_rms) { - try - { - bool comparison_type_restore = comparison_type; - comparison_type = root_mean_square; - - size_t dimensions = 3; - size_t lengths[3] = { 16, 32, 64 }; - size_t* stride_null = NULL; - size_t batch = 2; - size_t distance = 0; - - buffer thing_1( dimensions, lengths, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - - buffer thing_2( dimensions, lengths, stride_null, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - - thing_1.set_all_to_sawtooth(1.0f); - thing_2.set_all_to_sawtooth(1.0f); - EXPECT_EQ( false, thing_1 != thing_2 ); - - thing_2.set_one_data_point( 42.0f, 0, 0, 0, 0, 0 ); - EXPECT_EQ( true, thing_1 != thing_2 ); - - thing_1.set_all_to_sawtooth( 42.0f ); - thing_2.set_all_to_sawtooth( 42.0f ); - EXPECT_EQ( false, thing_1 != thing_2 ); - - comparison_type = comparison_type_restore; - } - catch( const std::exception& err ) - { - handle_exception(err); - } +TEST_F(test_harness_tests_buffer, + inequivalence_operator_returns_correct_result_with_rms) { + try { + bool comparison_type_restore = comparison_type; + comparison_type = root_mean_square; + + size_t dimensions = 3; + size_t lengths[3] = {16, 32, 64}; + size_t *stride_null = NULL; + size_t batch = 2; + size_t distance = 0; + + buffer thing_1(dimensions, lengths, stride_null, batch, distance, + layout::complex_interleaved, CLFFT_OUTOFPLACE); + + buffer thing_2(dimensions, lengths, stride_null, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + + thing_1.set_all_to_sawtooth(1.0f); + thing_2.set_all_to_sawtooth(1.0f); + EXPECT_EQ(false, thing_1 != thing_2); + + thing_2.set_one_data_point(42.0f, 0, 0, 0, 0, 0); + EXPECT_EQ(true, thing_1 != thing_2); + + thing_1.set_all_to_sawtooth(42.0f); + thing_2.set_all_to_sawtooth(42.0f); + EXPECT_EQ(false, thing_1 != thing_2); + + comparison_type = comparison_type_restore; + } catch (const std::exception &err) { + handle_exception(err); + } } /*****************************************************/ /*****************************************************/ -TEST_F(test_harness_tests_buffer, equivalence_should_fail_given_non_matching_complexities) { - try - { - size_t dimensions = 1; - size_t lengths[3] = { 5, 1, 1 }; - size_t* stride_null = NULL; - size_t batch = 1; - size_t distance = 0; - - buffer thing_1( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - buffer thing_2( dimensions, lengths, stride_null, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - EXPECT_EQ( false, thing_1 == thing_2 ); - - buffer thing_3( dimensions, lengths, stride_null, batch, distance, layout::complex_planar, CLFFT_OUTOFPLACE ); - buffer thing_4( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - EXPECT_EQ( false, thing_3 == thing_4 ); - - buffer thing_5( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - buffer thing_6( dimensions, lengths, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - EXPECT_EQ( false, thing_5 == thing_6 ); - - buffer thing_7( dimensions, lengths, stride_null, batch, distance, layout::complex_interleaved, CLFFT_OUTOFPLACE ); - buffer thing_8( dimensions, lengths, stride_null, batch, distance, layout::real, CLFFT_OUTOFPLACE ); - EXPECT_EQ( false, thing_7 == thing_8 ); - } - catch( const std::exception& err ) - { - handle_exception(err); - } +TEST_F(test_harness_tests_buffer, + equivalence_should_fail_given_non_matching_complexities) { + try { + size_t dimensions = 1; + size_t lengths[3] = {5, 1, 1}; + size_t *stride_null = NULL; + size_t batch = 1; + size_t distance = 0; + + buffer thing_1(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + buffer thing_2(dimensions, lengths, stride_null, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + EXPECT_EQ(false, thing_1 == thing_2); + + buffer thing_3(dimensions, lengths, stride_null, batch, distance, + layout::complex_planar, CLFFT_OUTOFPLACE); + buffer thing_4(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + EXPECT_EQ(false, thing_3 == thing_4); + + buffer thing_5(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + buffer thing_6(dimensions, lengths, stride_null, batch, distance, + layout::complex_interleaved, CLFFT_OUTOFPLACE); + EXPECT_EQ(false, thing_5 == thing_6); + + buffer thing_7(dimensions, lengths, stride_null, batch, distance, + layout::complex_interleaved, CLFFT_OUTOFPLACE); + buffer thing_8(dimensions, lengths, stride_null, batch, distance, + layout::real, CLFFT_OUTOFPLACE); + EXPECT_EQ(false, thing_7 == thing_8); + } catch (const std::exception &err) { + handle_exception(err); + } } \ No newline at end of file diff --git a/src/tests/buffer.h b/src/tests/buffer.h index bcaeb231..01ec3aba 100644 --- a/src/tests/buffer.h +++ b/src/tests/buffer.h @@ -14,1264 +14,1152 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_BUFFER_H ) +#if !defined(CLFFT_BUFFER_H) #define CLFFT_BUFFER_H +#include "../include/clFFT.h" +#include "buffer_memory.h" +#include "test_constants.h" +#include #include #include -#include #include -#include -#include #include -#include "../include/clFFT.h" -#include "test_constants.h" -#include +#include #include -#include "buffer_memory.h" +#include +#include /*****************************************************/ /*****************************************************/ -template< typename T > -bool floats_are_about_equal( T a, T b) { - // explicit check to see if a and b are both zero-ish . . . - if( fabs(a) < 0.00001f && fabs(b) < 0.00001f) return true; - // . . . and if not, we'll see if they're the same-ish - return ( fabs(a-b) > fabs(a*tolerance) ) ? false : true; +template bool floats_are_about_equal(T a, T b) { + // explicit check to see if a and b are both zero-ish . . . + if (fabs(a) < 0.00001f && fabs(b) < 0.00001f) + return true; + // . . . and if not, we'll see if they're the same-ish + return (fabs(a - b) > fabs(a * tolerance)) ? false : true; } /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ struct index_t { - size_t x, y, z, batch; - - index_t( size_t inx, size_t iny, size_t inz, size_t inbatch ) - : x(inx) - , y(iny) - , z(inz) - , batch(inbatch) - {} + size_t x, y, z, batch; + + index_t(size_t inx, size_t iny, size_t inz, size_t inbatch) + : x(inx), y(iny), z(inz), batch(inbatch) {} }; -namespace layout -{ - // buffer_layout_t will be used to let class buffer know how many instances of buffer_memory to make and their sizes - enum buffer_layout_t - { - real, - complex_interleaved, - complex_planar, - hermitian_interleaved, - hermitian_planar - }; -} +namespace layout { +// buffer_layout_t will be used to let class buffer know how many instances of +// buffer_memory to make and their sizes +enum buffer_layout_t { + real, + complex_interleaved, + complex_planar, + hermitian_interleaved, + hermitian_planar +}; +} // namespace layout /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -template -class buffer { +template class buffer { private: - // we need to save the requested length x, because - // if we change the buffer from complex to real, - // (as in a round-trip test) we need to be able to - // get back to the original length of x. in the case - // of an odd transform length, that's not possible - // due to round-off error unless we explicitly save it - size_t _requested_length_x; - size_t _number_of_dimensions; - size_t _batch_size; - size_t _distance; - layout::buffer_layout_t _layout; - clfftResultLocation _placeness; - - std::vector< size_t > _lengths; - std::vector< size_t > _strides; - bool _tightly_packed_strides; - bool _tightly_packed_distance; - - static const size_t tightly_packed = 0; - - // if real or planar: - // _the_buffers[re] will hold the real portion - // _the_buffers[im] will hold the imaginary portion (planar only) - // if interleaved: - // _the_buffers[interleaved] will hold the whole banana - std::vector< buffer_memory< T > > _the_buffers; - - enum - { - interleaved = 0, - re = 0, // real - im = 1 // imaginary - }; + // we need to save the requested length x, because + // if we change the buffer from complex to real, + // (as in a round-trip test) we need to be able to + // get back to the original length of x. in the case + // of an odd transform length, that's not possible + // due to round-off error unless we explicitly save it + size_t _requested_length_x; + size_t _number_of_dimensions; + size_t _batch_size; + size_t _distance; + layout::buffer_layout_t _layout; + clfftResultLocation _placeness; + + std::vector _lengths; + std::vector _strides; + bool _tightly_packed_strides; + bool _tightly_packed_distance; + + static const size_t tightly_packed = 0; + + // if real or planar: + // _the_buffers[re] will hold the real portion + // _the_buffers[im] will hold the imaginary portion (planar only) + // if interleaved: + // _the_buffers[interleaved] will hold the whole banana + std::vector> _the_buffers; + + enum { + interleaved = 0, + re = 0, // real + im = 1 // imaginary + }; public: - /*****************************************************/ - buffer( const size_t dimensions_in, - const size_t* lengths_in, - const size_t* strides_in, - const size_t batch_size_in, - const size_t distance_in, - const layout::buffer_layout_t layout_in, - const clfftResultLocation placeness_in - ) - : _number_of_dimensions( dimensions_in ) - , _batch_size( batch_size_in ) - , _distance( distance_in ) - , _layout( layout_in ) - , _placeness( placeness_in ) - , _lengths() - , _strides() - , _the_buffers() - { - initialize_lengths(lengths_in); - initialize_strides(strides_in); - initialize_distance(distance_in); - create_buffer_memory(); - clear(); - } - - /*****************************************************/ - ~buffer() - {} - - /*****************************************************/ - // this assignment operator only copies _data_. - // it does not change the rest of the buffer information - // and in fact, it requires that the buffer sizes be the same going in - buffer & operator=( buffer & that ) - { - if( this->is_real() != that.is_real() || - this->is_hermitian() != that.is_hermitian() || - this->is_complex() != that.is_complex() ) - { - throw std::runtime_error( "Buffers must be the same layout type for assignment operator" ); - } - - if( this->_number_of_dimensions != that._number_of_dimensions || - this->_batch_size != that._batch_size || - this->_lengths != that._lengths ) - { - throw std::runtime_error( "Buffers must be the same size for assignment operator" ); - } - - if( this->is_real() ) - { - for( size_t batch = 0; batch < batch_size(); batch++ ) { - for( size_t z = 0; z < length(dimz); z++ ) { - for( size_t y = 0; y < length(dimy); y++ ) { - for( size_t x = 0; x < length(dimx); x++ ) { - this->set_one_data_point( that.real(x,y,z,batch), x, y, z, batch ); - } - } - } - } - } - else - { - for( size_t batch = 0; batch < batch_size(); batch++ ) { - for( size_t z = 0; z < length(dimz); z++ ) { - for( size_t y = 0; y < length(dimy); y++ ) { - for( size_t x = 0; x < length(dimx); x++ ) { - this->set_one_data_point( that.real(x,y,z,batch), that.imag(x,y,z,batch), x, y, z, batch ); - } - } - } - } - } - - return *this; - } + /*****************************************************/ + buffer(const size_t dimensions_in, const size_t *lengths_in, + const size_t *strides_in, const size_t batch_size_in, + const size_t distance_in, const layout::buffer_layout_t layout_in, + const clfftResultLocation placeness_in) + : _number_of_dimensions(dimensions_in), _batch_size(batch_size_in), + _distance(distance_in), _layout(layout_in), _placeness(placeness_in), + _lengths(), _strides(), _the_buffers() { + initialize_lengths(lengths_in); + initialize_strides(strides_in); + initialize_distance(distance_in); + create_buffer_memory(); + clear(); + } + + /*****************************************************/ + ~buffer() {} + + /*****************************************************/ + // this assignment operator only copies _data_. + // it does not change the rest of the buffer information + // and in fact, it requires that the buffer sizes be the same going in + buffer &operator=(buffer &that) { + if (this->is_real() != that.is_real() || + this->is_hermitian() != that.is_hermitian() || + this->is_complex() != that.is_complex()) { + throw std::runtime_error( + "Buffers must be the same layout type for assignment operator"); + } + + if (this->_number_of_dimensions != that._number_of_dimensions || + this->_batch_size != that._batch_size || + this->_lengths != that._lengths) { + throw std::runtime_error( + "Buffers must be the same size for assignment operator"); + } + + if (this->is_real()) { + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + this->set_one_data_point(that.real(x, y, z, batch), x, y, z, + batch); + } + } + } + } + } else { + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + this->set_one_data_point(that.real(x, y, z, batch), + that.imag(x, y, z, batch), x, y, z, + batch); + } + } + } + } + } + + return *this; + } private: - /*****************************************************/ - void preinitialize_lengths_to_1_1_1() - { - _lengths.clear(); - - for( int i = 0; i < max_dimension; ++i ) { - _lengths.push_back(1); - } - } - - /*****************************************************/ - void initialize_lengths(const size_t* lengths_in) - { - preinitialize_lengths_to_1_1_1(); - - for( size_t i = 0; i < _number_of_dimensions; ++i ) - { - _lengths[i] = lengths_in[i]; - } - - _requested_length_x = _lengths[dimx]; - adjust_length_x_for_hermitian_buffers(); - } - - /*****************************************************/ - void adjust_length_x_for_hermitian_buffers() - { - // complex-to-complex transforms do not require any change - // to the number of points in the buffer - - // real buffers also never require a change to the number of - // points in the buffer - - // a hermitian buffer with a length of "X" will actually - // have X/2 + 1 points (the other half-ish are conjugates - // and do not need to be stored). lenY and lenZ are never - // modified - if( is_hermitian() ) - { - _lengths[dimx] = _lengths[dimx] / 2 + 1; - } - } - - /*****************************************************/ - void preinitialize_strides_to_1_1_1() - { - _strides.clear(); - - for( int i = 0; i < max_dimension; ++i ) { - _strides.push_back(1); - } - } - - /*****************************************************/ - void initialize_strides(const size_t* strides_in) - { - preinitialize_strides_to_1_1_1(); - - // we need to calculate the strides if tightly packed - if( strides_in == nullptr ) { - _strides[dimx] = 1; - for( size_t i = 1; i < _number_of_dimensions; ++i ) - { - _strides[i] = _strides[i-1]*_lengths[i-1]; - } - - _tightly_packed_strides = true; - } - // we do not need to calculate anything if the user specifies strides - // we just copy the input strides into place - else - { - for( size_t i = 0; i < _number_of_dimensions; ++i ) - { - _strides[i] = strides_in[i]; - } - - _tightly_packed_strides = false; - } - } - - /*****************************************************/ - void initialize_distance(const size_t distance_in) - { - if( distance_in == tightly_packed ) - { - // calculate distance if not passed in - _distance = _lengths[_number_of_dimensions-1] * _strides[_number_of_dimensions-1]; - - _tightly_packed_distance = true; - } - else - { - // or copy it if passed in - _distance = distance_in; - - _tightly_packed_distance = false; - } - } - - /*****************************************************/ - void create_buffer_memory() - { - if( is_real() ) - { - // just one real buffer - _the_buffers.push_back( buffer_memory< T >( total_number_of_points_including_data_and_intervening() ) ); - - increase_memory_allocation_for_real_in_place_buffers(); - } - else if( is_planar() ) - { - // one real buffer - _the_buffers.push_back( buffer_memory< T >( total_number_of_points_including_data_and_intervening() ) ); - // and one imaginary buffer - _the_buffers.push_back( buffer_memory< T >( total_number_of_points_including_data_and_intervening() ) ); - } - else if( is_interleaved() ) - { - // one double-wide interleaved buffer - _the_buffers.push_back( buffer_memory< T >( 2 * total_number_of_points_including_data_and_intervening() ) ); - } - } - - /*****************************************************/ - size_t amount_of_extra_padding_per_x() - { - if( length(dimx) % 2 == 0 ) // even lengths of x add 2 per row - return 2; - else // odd lengths of x add 1 per row - return 1; - } - - /*****************************************************/ - void adjust_strides_and_distance_for_in_place_real_buffer() - { - if( is_real() ) - { - if( is_in_place() ) - { - size_t amount_to_add_for_this_dimension = stride(dimx) * amount_of_extra_padding_per_x(); - - // strides first - if( number_of_dimensions() >= 2 ) - { - _strides[dimy] += amount_to_add_for_this_dimension; - } - - if( number_of_dimensions() == 3 ) - { - amount_to_add_for_this_dimension *= length(dimy); - _strides[dimz] += amount_to_add_for_this_dimension; - } - - // distance next - if( number_of_dimensions() == 1 ) - { - _distance += amount_to_add_for_this_dimension; - } - else if( number_of_dimensions() == 2 ) - { - _distance += ( amount_to_add_for_this_dimension * length(dimy) ); - } - else if( number_of_dimensions() == 3 ) - { - _distance += ( amount_to_add_for_this_dimension * length(dimz) ); - } - else throw std::runtime_error( "invalid dimensions in adjust_strides_and_distance_for_in_place_real_buffer()" ); - } - else throw std::runtime_error( "this buffer is out of place and shouldn't be adjusting strides" ); - } - else throw std::runtime_error( "this buffer is unreal and shouldn't be adjusting strides" ); - } - - /*****************************************************/ - void increase_memory_allocation_for_real_in_place_buffers() - { - // when performing an in-place, real-to-hermitian transform, - // we want a little extra space to account for the larger size - // of the hermitian output. - - // each row in the X dimension should have enough space for 2 extra reals - // (to account for the one extra complex number that will be put - // into the buffer after the transform) - - // we don't want to change the length, because the number of points - // in the transform isn't changing. we only want to change the - // amount of memory reserved - if( is_real() ) - { - if( is_in_place() ) - { - if( _tightly_packed_strides && _tightly_packed_distance ) - { - // request extra memory - _the_buffers[re].increase_allocated_memory( amount_of_extra_padding_per_x() * stride(dimx) * length(dimy) * length(dimz) * batch_size() ); - - // adjust strides/distances so that the padding is at the end of each row in the Xth dimension - adjust_strides_and_distance_for_in_place_real_buffer(); - } - } - } - } - - /*****************************************************/ - size_t index( const size_t x, const size_t y=0, const size_t z=0, const size_t batch=0) - { - size_t interleaved_offset = 1; - - // if this buffer is interleaved, the index should actually be double what it appears. - // interleaved_offset will accomplish this magical doubling. - if( is_interleaved() ) - interleaved_offset = 2; - - size_t the_index = ( stride(dimx) * x + stride(dimy) * y + stride(dimz) * z + distance() * batch ) * interleaved_offset; - - return the_index; - } - - /*****************************************************/ - size_t next_index( const size_t x, const size_t y=0, const size_t z=0, const size_t batch=0) - { - if( x+1 < length(dimx)) - return index( x+1, y, z, batch ); - else if( y+1 < length(dimy) ) - return index( 0, y+1, z, batch ); - else if( z+1 < length(dimz) ) - return index( 0, 0, z+1, batch ); - else if( batch+1 < batch_size() ) - return index( 0, 0, 0, batch+1 ); - else - // we are at the last point - // return the location immediately after the last point - return index( 0, 0, 0, batch+1 ); - } - - /*****************************************************/ - bool points_are_about_equal( buffer & other_buffer, size_t x, size_t y, size_t z, size_t batch ) - { - if( is_real() ) - return floats_are_about_equal( real(x, y, z, batch), other_buffer.real(x, y, z, batch) ); - else if( is_complex() || is_hermitian() ) - return ( floats_are_about_equal( real(x, y, z, batch), other_buffer.real(x, y, z, batch) ) && - floats_are_about_equal( imag(x, y, z, batch), other_buffer.imag(x, y, z, batch) ) ); - else - throw std::runtime_error( "invalid layout in points_are_about_equal()" ); - } - - /*****************************************************/ - size_t buffer_mismatches( buffer & other_buffer, bool compare_method) - { - std::vector< index_t > mismatched_point_indices; - - if (compare_method == pointwise_compare) - { - for( size_t batch = 0; batch < batch_size(); batch++ ) - for( size_t z = 0; z < length(dimz); z++ ) - for( size_t y = 0; y < length(dimy); y++ ) - for( size_t x = 0; x < length(dimx); x++ ) - if( !points_are_about_equal( other_buffer, x, y, z, batch ) ) - { - mismatched_point_indices.push_back( index_t(x, y, z, batch)); - } - - const size_t max_mismatches_output = default_number_of_mismatches_to_output; - - if( mismatched_point_indices.size() != 0 && max_mismatches_output != 0 && suppress_output == false) { - std::cout << std::endl << std::dec << mismatched_point_indices.size() << " of " << batch_size() * number_of_data_points_single_batch() - <<" data points did not match. The first " << max_mismatches_output << " (max) mismatching points follow:" << std::endl; - - std::cout << std::endl << "(array index)(index) "; - std::cout << "[test value (dec)] / [expected value (dec)]"; - std::cout << std::endl; - for( size_t i = 0; i < max_mismatches_output && i < mismatched_point_indices.size(); i++ ) - { - index_t mismatch = mismatched_point_indices[i]; - - std::cout - << std::dec << "(" << mismatched_point_indices.at(i).batch << ")" - << std::dec << "(" << mismatched_point_indices.at(i).x << "," << mismatched_point_indices.at(i).y << "," << mismatched_point_indices.at(i).z << ") "; - std::cout - << real( mismatch.x, mismatch.y, mismatch.z, mismatch.batch ); - - if( is_complex() || is_hermitian() ) - { - std::cout << "+i*" << imag( mismatch.x, mismatch.y, mismatch.z, mismatch.batch ); - } - std::cout - << " / " << other_buffer.real( mismatch.x, mismatch.y, mismatch.z, mismatch.batch ); - - if( is_complex() || is_hermitian() ) - { - std::cout << "+i*" << other_buffer.imag( mismatch.x, mismatch.y, mismatch.z, mismatch.batch ); - } - std::cout << std::endl; - } - std::cout << std::endl; - } - return mismatched_point_indices.size(); - } - else - { - //RMS accuracy judgement - - size_t problem_size_per_transform = length(dimx) * length(dimy) * length(dimz); - double rmse_tolerance_this = rmse_tolerance * sqrt((double)problem_size_per_transform / 4096.0); - - for (size_t batch = 0; batch < batch_size(); batch++) { - - double maxMag = 0.0, maxMagInv = 1.0; - - // Compute RMS error relative to maximum magnitude - double rms = 0; - - for (size_t z = 0; z < length(dimz); z++) { - for (size_t y = 0; y < length(dimy); y++) { - for (size_t x = 0; x < length(dimx); x++) { - double ex_r, ex_i, ac_r, ac_i; - double mag; - - ex_r = other_buffer.real(x, y, z, batch); - ac_r = real(x, y, z, batch); - - if (other_buffer.is_complex() || other_buffer.is_hermitian()) - ex_i = other_buffer.imag(x, y, z, batch); - else - ex_i = 0; - - if (other_buffer.is_complex() || other_buffer.is_hermitian()) - ac_i = imag(x, y, z, batch); - else - ac_i = 0; - - // find maximum magnitude - mag = ex_r*ex_r + ex_i*ex_i; - maxMag = (mag > maxMag) ? mag : maxMag; - - // compute square error - rms += ((ex_r - ac_r)*(ex_r - ac_r) + (ex_i - ac_i)*(ex_i - ac_i)); - } - } - } - - if (maxMag > magnitude_lower_limit) - { - maxMagInv = 1.0 / maxMag; - } - - rms = sqrt(rms*maxMagInv); - - if (fabs(rms) > rmse_tolerance_this) - { - if (suppress_output == false) - std::cout << std::endl << "RMSE accuracy judgement failure -- RMSE = " << std::dec << rms << - ", maximum allowed RMSE = " << std::dec << rmse_tolerance_this << std::endl; - return 1; - } - } - - return 0; - } - } + /*****************************************************/ + void preinitialize_lengths_to_1_1_1() { + _lengths.clear(); + + for (int i = 0; i < max_dimension; ++i) { + _lengths.push_back(1); + } + } + + /*****************************************************/ + void initialize_lengths(const size_t *lengths_in) { + preinitialize_lengths_to_1_1_1(); + + for (size_t i = 0; i < _number_of_dimensions; ++i) { + _lengths[i] = lengths_in[i]; + } + + _requested_length_x = _lengths[dimx]; + adjust_length_x_for_hermitian_buffers(); + } + + /*****************************************************/ + void adjust_length_x_for_hermitian_buffers() { + // complex-to-complex transforms do not require any change + // to the number of points in the buffer + + // real buffers also never require a change to the number of + // points in the buffer + + // a hermitian buffer with a length of "X" will actually + // have X/2 + 1 points (the other half-ish are conjugates + // and do not need to be stored). lenY and lenZ are never + // modified + if (is_hermitian()) { + _lengths[dimx] = _lengths[dimx] / 2 + 1; + } + } + + /*****************************************************/ + void preinitialize_strides_to_1_1_1() { + _strides.clear(); + + for (int i = 0; i < max_dimension; ++i) { + _strides.push_back(1); + } + } + + /*****************************************************/ + void initialize_strides(const size_t *strides_in) { + preinitialize_strides_to_1_1_1(); + + // we need to calculate the strides if tightly packed + if (strides_in == nullptr) { + _strides[dimx] = 1; + for (size_t i = 1; i < _number_of_dimensions; ++i) { + _strides[i] = _strides[i - 1] * _lengths[i - 1]; + } + + _tightly_packed_strides = true; + } + // we do not need to calculate anything if the user specifies strides + // we just copy the input strides into place + else { + for (size_t i = 0; i < _number_of_dimensions; ++i) { + _strides[i] = strides_in[i]; + } + + _tightly_packed_strides = false; + } + } + + /*****************************************************/ + void initialize_distance(const size_t distance_in) { + if (distance_in == tightly_packed) { + // calculate distance if not passed in + _distance = _lengths[_number_of_dimensions - 1] * + _strides[_number_of_dimensions - 1]; + + _tightly_packed_distance = true; + } else { + // or copy it if passed in + _distance = distance_in; + + _tightly_packed_distance = false; + } + } + + /*****************************************************/ + void create_buffer_memory() { + if (is_real()) { + // just one real buffer + _the_buffers.push_back(buffer_memory( + total_number_of_points_including_data_and_intervening())); + + increase_memory_allocation_for_real_in_place_buffers(); + } else if (is_planar()) { + // one real buffer + _the_buffers.push_back(buffer_memory( + total_number_of_points_including_data_and_intervening())); + // and one imaginary buffer + _the_buffers.push_back(buffer_memory( + total_number_of_points_including_data_and_intervening())); + } else if (is_interleaved()) { + // one double-wide interleaved buffer + _the_buffers.push_back(buffer_memory( + 2 * total_number_of_points_including_data_and_intervening())); + } + } + + /*****************************************************/ + size_t amount_of_extra_padding_per_x() { + if (length(dimx) % 2 == 0) // even lengths of x add 2 per row + return 2; + else // odd lengths of x add 1 per row + return 1; + } + + /*****************************************************/ + void adjust_strides_and_distance_for_in_place_real_buffer() { + if (is_real()) { + if (is_in_place()) { + size_t amount_to_add_for_this_dimension = + stride(dimx) * amount_of_extra_padding_per_x(); + + // strides first + if (number_of_dimensions() >= 2) { + _strides[dimy] += amount_to_add_for_this_dimension; + } + + if (number_of_dimensions() == 3) { + amount_to_add_for_this_dimension *= length(dimy); + _strides[dimz] += amount_to_add_for_this_dimension; + } + + // distance next + if (number_of_dimensions() == 1) { + _distance += amount_to_add_for_this_dimension; + } else if (number_of_dimensions() == 2) { + _distance += (amount_to_add_for_this_dimension * length(dimy)); + } else if (number_of_dimensions() == 3) { + _distance += (amount_to_add_for_this_dimension * length(dimz)); + } else + throw std::runtime_error( + "invalid dimensions in " + "adjust_strides_and_distance_for_in_place_real_buffer()"); + } else + throw std::runtime_error( + "this buffer is out of place and shouldn't be adjusting strides"); + } else + throw std::runtime_error( + "this buffer is unreal and shouldn't be adjusting strides"); + } + + /*****************************************************/ + void increase_memory_allocation_for_real_in_place_buffers() { + // when performing an in-place, real-to-hermitian transform, + // we want a little extra space to account for the larger size + // of the hermitian output. + + // each row in the X dimension should have enough space for 2 extra reals + // (to account for the one extra complex number that will be put + // into the buffer after the transform) + + // we don't want to change the length, because the number of points + // in the transform isn't changing. we only want to change the + // amount of memory reserved + if (is_real()) { + if (is_in_place()) { + if (_tightly_packed_strides && _tightly_packed_distance) { + // request extra memory + _the_buffers[re].increase_allocated_memory( + amount_of_extra_padding_per_x() * stride(dimx) * length(dimy) * + length(dimz) * batch_size()); + + // adjust strides/distances so that the padding is at the end of each + // row in the Xth dimension + adjust_strides_and_distance_for_in_place_real_buffer(); + } + } + } + } + + /*****************************************************/ + size_t index(const size_t x, const size_t y = 0, const size_t z = 0, + const size_t batch = 0) { + size_t interleaved_offset = 1; + + // if this buffer is interleaved, the index should actually be double what + // it appears. interleaved_offset will accomplish this magical doubling. + if (is_interleaved()) + interleaved_offset = 2; + + size_t the_index = (stride(dimx) * x + stride(dimy) * y + stride(dimz) * z + + distance() * batch) * + interleaved_offset; + + return the_index; + } + + /*****************************************************/ + size_t next_index(const size_t x, const size_t y = 0, const size_t z = 0, + const size_t batch = 0) { + if (x + 1 < length(dimx)) + return index(x + 1, y, z, batch); + else if (y + 1 < length(dimy)) + return index(0, y + 1, z, batch); + else if (z + 1 < length(dimz)) + return index(0, 0, z + 1, batch); + else if (batch + 1 < batch_size()) + return index(0, 0, 0, batch + 1); + else + // we are at the last point + // return the location immediately after the last point + return index(0, 0, 0, batch + 1); + } + + /*****************************************************/ + bool points_are_about_equal(buffer &other_buffer, size_t x, size_t y, + size_t z, size_t batch) { + if (is_real()) + return floats_are_about_equal(real(x, y, z, batch), + other_buffer.real(x, y, z, batch)); + else if (is_complex() || is_hermitian()) + return (floats_are_about_equal(real(x, y, z, batch), + other_buffer.real(x, y, z, batch)) && + floats_are_about_equal(imag(x, y, z, batch), + other_buffer.imag(x, y, z, batch))); + else + throw std::runtime_error("invalid layout in points_are_about_equal()"); + } + + /*****************************************************/ + size_t buffer_mismatches(buffer &other_buffer, bool compare_method) { + std::vector mismatched_point_indices; + + if (compare_method == pointwise_compare) { + for (size_t batch = 0; batch < batch_size(); batch++) + for (size_t z = 0; z < length(dimz); z++) + for (size_t y = 0; y < length(dimy); y++) + for (size_t x = 0; x < length(dimx); x++) + if (!points_are_about_equal(other_buffer, x, y, z, batch)) { + mismatched_point_indices.push_back(index_t(x, y, z, batch)); + } + + const size_t max_mismatches_output = + default_number_of_mismatches_to_output; + + if (mismatched_point_indices.size() != 0 && max_mismatches_output != 0 && + suppress_output == false) { + std::cout << std::endl + << std::dec << mismatched_point_indices.size() << " of " + << batch_size() * number_of_data_points_single_batch() + << " data points did not match. The first " + << max_mismatches_output + << " (max) mismatching points follow:" << std::endl; + + std::cout << std::endl << "(array index)(index) "; + std::cout << "[test value (dec)] / [expected value (dec)]"; + std::cout << std::endl; + for (size_t i = 0; + i < max_mismatches_output && i < mismatched_point_indices.size(); + i++) { + index_t mismatch = mismatched_point_indices[i]; + + std::cout << std::dec << "(" << mismatched_point_indices.at(i).batch + << ")" << std::dec << "(" + << mismatched_point_indices.at(i).x << "," + << mismatched_point_indices.at(i).y << "," + << mismatched_point_indices.at(i).z << ") "; + std::cout << real(mismatch.x, mismatch.y, mismatch.z, mismatch.batch); + + if (is_complex() || is_hermitian()) { + std::cout << "+i*" + << imag(mismatch.x, mismatch.y, mismatch.z, + mismatch.batch); + } + std::cout << " / " + << other_buffer.real(mismatch.x, mismatch.y, mismatch.z, + mismatch.batch); + + if (is_complex() || is_hermitian()) { + std::cout << "+i*" + << other_buffer.imag(mismatch.x, mismatch.y, mismatch.z, + mismatch.batch); + } + std::cout << std::endl; + } + std::cout << std::endl; + } + return mismatched_point_indices.size(); + } else { + // RMS accuracy judgement + + size_t problem_size_per_transform = + length(dimx) * length(dimy) * length(dimz); + double rmse_tolerance_this = + rmse_tolerance * sqrt((double)problem_size_per_transform / 4096.0); + + for (size_t batch = 0; batch < batch_size(); batch++) { + + double maxMag = 0.0, maxMagInv = 1.0; + + // Compute RMS error relative to maximum magnitude + double rms = 0; + + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + double ex_r, ex_i, ac_r, ac_i; + double mag; + + ex_r = other_buffer.real(x, y, z, batch); + ac_r = real(x, y, z, batch); + + if (other_buffer.is_complex() || other_buffer.is_hermitian()) + ex_i = other_buffer.imag(x, y, z, batch); + else + ex_i = 0; + + if (other_buffer.is_complex() || other_buffer.is_hermitian()) + ac_i = imag(x, y, z, batch); + else + ac_i = 0; + + // find maximum magnitude + mag = ex_r * ex_r + ex_i * ex_i; + maxMag = (mag > maxMag) ? mag : maxMag; + + // compute square error + rms += ((ex_r - ac_r) * (ex_r - ac_r) + + (ex_i - ac_i) * (ex_i - ac_i)); + } + } + } + + if (maxMag > magnitude_lower_limit) { + maxMagInv = 1.0 / maxMag; + } + + rms = sqrt(rms * maxMagInv); + + if (fabs(rms) > rmse_tolerance_this) { + if (suppress_output == false) + std::cout << std::endl + << "RMSE accuracy judgement failure -- RMSE = " + << std::dec << rms + << ", maximum allowed RMSE = " << std::dec + << rmse_tolerance_this << std::endl; + return 1; + } + } + + return 0; + } + } public: - /*****************************************************/ - bool operator==( buffer & other_buffer ) - { - // complexity of each dimension must be the same - if( ( is_real() && !other_buffer.is_real() ) || ( !is_real() && other_buffer.is_real() ) || - ( is_hermitian() && !other_buffer.is_hermitian() ) || ( !is_hermitian() && other_buffer.is_hermitian() ) || - ( is_complex() && !other_buffer.is_complex() ) || ( !is_complex() && other_buffer.is_complex() ) ) - { - return false; - } - - // batch_size of the data must be the same - if( batch_size() != other_buffer.batch_size() ) - { - return false; - } - - // dimensionality of the data must be the same - if( number_of_dimensions() != other_buffer.number_of_dimensions() ) - { - return false; - } - - // size of each dimension must be the same - for( size_t i = 0; i < number_of_dimensions(); ++i ) - { - if( length(i) != other_buffer.length(i)) return false; - } - - size_t number_deaths = 0; - number_deaths += buffer_mismatches( other_buffer, comparison_type); - - if( number_deaths == 0 ) return true; - else return false; - } - - /*****************************************************/ - bool operator!=( buffer & other_buffer ) - { - return !( *this == other_buffer ); - } - - void operator*=( buffer & other_buffer ) - { - size_t the_index; - T* base_ptr; - T* real_ptr; - T* imag_ptr; - - if( is_interleaved() ) - { - base_ptr = _the_buffers[interleaved].ptr(); - } - else if ( is_planar() ) - { - real_ptr = _the_buffers[re].ptr(); - imag_ptr = _the_buffers[im].ptr(); - } - else if ( is_real() ) - { - base_ptr = _the_buffers[re].ptr(); - } - - for( size_t batch = 0; batch < batch_size(); batch++ ) - for( size_t z = 0; z < length(dimz); z++ ) - for( size_t y = 0; y < length(dimy); y++ ) - for( size_t x = 0; x < length(dimx); x++ ) - { - the_index = index(x, y, z, batch); - if( is_interleaved() ) - { - *( base_ptr + the_index ) *= other_buffer.real(x, y, z, batch); - - the_index = the_index + 1; // the imaginary component immediately follows the real - if (other_buffer.is_real()) - { - *( base_ptr + the_index ) *= other_buffer.real(x, y, z, batch); - } - else - { - *( base_ptr + the_index ) *= other_buffer.imag(x, y, z, batch); - } - } - else if ( is_planar() ) - { - *( real_ptr + the_index ) *= other_buffer.real(x, y, z, batch); - - if (other_buffer.is_real()) - { - *( imag_ptr + the_index ) *= other_buffer.real(x, y, z, batch); - } - else - { - *( imag_ptr + the_index ) *= other_buffer.imag(x, y, z, batch); - } - } - else if ( is_real() ) - { - *( base_ptr + the_index ) *= other_buffer.real(x, y, z, batch); - } - } - } - - //Calculates a 3 point average of other_buffer and - //multiplies with buffer - //only real layout is supported for other_buffer currently - void multiply_3pt_average( buffer & other_buffer ) - { - if (!other_buffer.is_real()) - { - throw std::runtime_error( "only real layout is supported currently for other_buffer" ); - } - - size_t the_index, o_the_index; - T *base_ptr, *o_base_ptr; - T *real_ptr; - T *imag_ptr; - T o_prev_val, o_next_val; - T average; - - if( is_interleaved() ) - { - base_ptr = _the_buffers[interleaved].ptr(); - } - else if ( is_planar() ) - { - real_ptr = _the_buffers[re].ptr(); - imag_ptr = _the_buffers[im].ptr(); - } - else if ( is_real() ) - { - base_ptr = _the_buffers[re].ptr(); - } - o_base_ptr = other_buffer.real_ptr(); - - for( size_t batch = 0; batch < batch_size(); batch++ ) - for( size_t z = 0; z < length(dimz); z++ ) - for( size_t y = 0; y < length(dimy); y++ ) - for( size_t x = 0; x < length(dimx); x++ ) - { - the_index = index(x, y, z, batch); - o_the_index = other_buffer.index(x, y, z, batch); - o_prev_val = o_the_index <= 0 ? 0 : *(o_base_ptr + o_the_index - 1); - o_next_val = o_the_index >= (other_buffer.total_number_of_points_including_data_and_intervening() - 1) ? 0 : *(o_base_ptr + o_the_index + 1); - - average = (o_prev_val + *(o_base_ptr + o_the_index) + o_next_val)/ 3.0f ; - - if( is_interleaved() ) - { - *( base_ptr + the_index ) *= average; - - the_index = the_index + 1; // the imaginary component immediately follows the real - *( base_ptr + the_index ) *= average; - } - else if ( is_planar() ) - { - *( real_ptr + the_index ) *= average; - - *( imag_ptr + the_index ) *= average; - } - else if ( is_real() ) - { - *( base_ptr + the_index ) *= average; - } - } - } - - /*****************************************************/ - // strides and distance are those of the output (that is, the new hermitian buffer) - void change_real_to_hermitian( const size_t* strides_in, const size_t distance_in ) - { - if( !is_real() || !is_in_place() ) - { - throw std::runtime_error( "can only change a real buffer used in an in-place transform to a hermitian one" ); - } - - // we currently only support hermitian interleaved for in-place transforms - _layout = layout::hermitian_interleaved; - adjust_length_x_for_hermitian_buffers(); - initialize_strides(strides_in); - initialize_distance(distance_in); - } - - /*****************************************************/ - // strides and distance are those of the output (that is, the new real buffer) - void change_hermitian_to_real( const size_t* strides_in, const size_t distance_in ) - { - // we currently only support hermitian interleaved for in-place transforms - if( _layout != layout::hermitian_interleaved || !is_in_place() ) - { - throw std::runtime_error( "can only change a hermitian interleaved buffer used in an in-place transform to a real one" ); - } - - _layout = layout::real; - _lengths[dimx] = _requested_length_x; - initialize_strides(strides_in); - initialize_distance(distance_in); - } - - /*****************************************************/ - bool is_real() - { - return _layout == layout::real; - } - - /*****************************************************/ - bool is_complex() - { - return _layout == layout::complex_interleaved || _layout == layout::complex_planar; - } - - /*****************************************************/ - bool is_hermitian() - { - return _layout == layout::hermitian_interleaved || _layout == layout::hermitian_planar; - } - - /*****************************************************/ - bool is_planar() - { - return _layout == layout::complex_planar || _layout == layout::hermitian_planar; - } - - /*****************************************************/ - bool is_interleaved() - { - return _layout == layout::complex_interleaved || _layout == layout::hermitian_interleaved; - } - - /*****************************************************/ - bool is_in_place() - { - if( _placeness == CLFFT_INPLACE ) return true; - else if( _placeness == CLFFT_OUTOFPLACE) return false; - else throw std::runtime_error( "invalid placeness value in is_in_place()" ); - } - - /*****************************************************/ - T* interleaved_ptr() - { - if( is_interleaved() ) - return _the_buffers[interleaved].ptr(); - else - throw std::runtime_error( "interleaved_ptr() is only available on interleaved buffers" ); - } - - /*****************************************************/ - T* real_ptr() - { - if( is_planar() || is_real() ) - return _the_buffers[re].ptr(); - else - throw std::runtime_error( "real() is only available on real and planar buffers" ); - } - - /*****************************************************/ - T* imag_ptr() - { - if( is_planar() ) - return _the_buffers[im].ptr(); - else - throw std::runtime_error( "imag_ptr() is only available on planar buffers" ); - } - - /*****************************************************/ - T real( const size_t x, const size_t y=0, const size_t z=0, const size_t batch=0 ) - { - size_t this_index = index( x, y, z, batch ); - - // all layouts will have a real component - // using [re] will catch the real component for - // layout::interleaved as well - T this_value = _the_buffers[re][this_index]; - return this_value; - } - - /*****************************************************/ - T imag( const size_t x, const size_t y=0, const size_t z=0, const size_t batch=0 ) - { - size_t this_index = index( x, y, z, batch ); - - if( is_real() ) - throw std::runtime_error( "imag() is not available for this real buffer" ); - else if( is_planar() ) - return _the_buffers[im][this_index]; - else if( is_interleaved() ) - // index always points to the real component of an interleaved number - // the following memory location is the imaginary component - return _the_buffers[interleaved][this_index + 1]; - else - throw std::runtime_error( "invalid layout type in imag()" ); - } - - /*****************************************************/ - std::complex complex( const size_t x, const size_t y=0, const size_t z=0, const size_t batch=0 ) - { - if( is_real() ) - throw std::runtime_error( "complex() is not available for this real buffer" ); - else if( is_complex() || is_hermitian() ) - { - std::complex this_complex( real( x, y, z, batch ), imag( x, y, z, batch ) ); - return this_complex; - } - else - throw std::runtime_error( "invalid layout type in complex()" ); - } - - /*****************************************************/ - size_t number_of_dimensions() - { - return _number_of_dimensions; - } - - /*****************************************************/ - size_t number_of_data_points_single_batch() - { - size_t number_of_points = 1; - for( size_t i = 0; i < _number_of_dimensions; ++i ) - { - number_of_points *= length(i); - } - return number_of_points; - } - - /*****************************************************/ - size_t number_of_data_points() - { - return number_of_data_points_single_batch() * batch_size(); - } - - /*****************************************************/ - // note that this returns the size in number of points and - // does not take layout into consideration. this will yield - // the same number for real, interleaved, and planar layouts. - // whomever uses this information will need to know if they - // want 1x buffer of this size (real), 2x buffer of this - // size (planar), or 1x double-wide buffer (interleaved) - size_t total_number_of_points_including_data_and_intervening() - { - return distance() * batch_size(); - } - - /*****************************************************/ - // note that this will return the size of ONE BUFFER in bytes - // for real and interleaved, that doesn't change anything - // for planar, you will get the size of the real _or_ the imaginary - // (which should always be the same) - size_t size_in_bytes() - { - return _the_buffers[0].size_in_bytes(); - } - - /*****************************************************/ - size_t length(size_t dim) - { - return _lengths[dim]; - } - - /*****************************************************/ - size_t stride(size_t dim) - { - return _strides[dim]; - } - - /*****************************************************/ - size_t* lengths() - { - return &_lengths[0]; - } - - /*****************************************************/ - size_t* strides() - { - return &_strides[0]; - } - - /*****************************************************/ - size_t batch_size() - { - return _batch_size; - } - - /*****************************************************/ - size_t distance() - { - return _distance; - } - - /*****************************************************/ - void clear() - { - // for all batches - - if( is_real() ) - set_all_to_value( 0.0f ); - else - set_all_to_value( 0.0f, 0.0f ); - } - - /*****************************************************/ - void set_one_data_point( T real, const size_t x, const size_t y, const size_t z, const size_t batch ) - { - if( is_real() ) - { - T* base_ptr = _the_buffers[re].ptr(); - size_t real_index = index(x, y, z, batch); - - *( base_ptr + real_index ) = real; - } - else - throw std::runtime_error( "attempting to use real data point setter for complex or hermitian buffer" ); - } - - /*****************************************************/ - void set_one_data_point( T real, T imag, const size_t x, const size_t y, const size_t z, const size_t batch ) - { - if( is_real() ) - throw std::runtime_error( "attempting to use complex data point setter for real buffer" ); - else if( is_interleaved() ) - { - T* base_ptr = _the_buffers[interleaved].ptr(); - size_t real_index = index(x, y, z, batch); - size_t imag_index = real_index + 1; // the imaginary component immediately follows the real - - *( base_ptr + real_index ) = real; - *( base_ptr + imag_index ) = imag; - } - else // planar - { - T* real_ptr = _the_buffers[re].ptr(); - T* imag_ptr = _the_buffers[im].ptr(); - size_t the_index = index(x, y, z, batch); - - *( real_ptr + the_index ) = real; - *( imag_ptr + the_index ) = imag; - } - } - - /*****************************************************/ - void set_all_to_value( T real ) - { - // for all batches - - for( size_t batch = 0; batch < batch_size(); batch++ ) { - for( size_t z = 0; z < length(dimz); z++ ) { - for( size_t y = 0; y < length(dimy); y++ ) { - for( size_t x = 0; x < length(dimx); x++ ) { - set_one_data_point( real, x, y, z, batch ); - } - } - } - } - } - - /*****************************************************/ - void set_all_to_value( T real, T imag ) - { - // for all batches - - for( size_t batch = 0; batch < batch_size(); batch++ ) { - for( size_t z = 0; z < length(dimz); z++ ) { - for( size_t y = 0; y < length(dimy); y++ ) { - for( size_t x = 0; x < length(dimx); x++ ) { - set_one_data_point( real, imag, x, y, z, batch ); - } - } - } - } - } - - /*****************************************************/ - void set_all_to_linear_increase() - { - // for all batches - - size_t val = 1; - for( size_t batch = 0; batch < batch_size(); batch++ ) { - for( size_t z = 0; z < length(dimz); z++ ) { - for( size_t y = 0; y < length(dimy); y++ ) { - for( size_t x = 0; x < length(dimx); x++ ) { - if( is_real() ) - { - set_one_data_point( static_cast(val), x, y, z, batch ); - } - - else - { - set_one_data_point( static_cast(val), static_cast(val) + 0.5f, x, y, z, batch ); - } - - ++val; - } - } - } - } - } - - /*****************************************************/ - void set_all_to_sawtooth( T amplitude ) - { - // for all batches - - for( size_t batch = 0; batch < batch_size(); batch++ ) - { - for( size_t z = 0; z < length(dimz); z++ ) - { - for( size_t y = 0; y < length(dimy); y++ ) - { - // waveform will be 1 period of sawtooth - size_t number_of_points_in_one_period = length(dimx); - size_t number_of_points_on_one_line = number_of_points_in_one_period / 2; - - // the sawtooth will start at 0 and increase to amplitude at T/2 - // at T/2, value will change to -amplitude and increase back up to 0 at T - // if there are an odd number of points in the whole period, - // we'll make a stop at 0 in the middle of the jump - T value = 0.0f; - T per_point_delta = amplitude / (number_of_points_on_one_line - 1); - - for( size_t x = 0; x < number_of_points_in_one_period; x++) { - if( is_real() ) - { - set_one_data_point( value, x, y, z, batch); - } - else - { - // for the real value, we want the sawtooth as described above - // for the imaginary value, we want the 2 times the inverse - // (so that real and imaginary don't match, possibly obscuring errors) - set_one_data_point( value, -2.0f * value, x, y, z, batch); - } - - // if we're at T/2, we want to saw on down to the negative amplitude . . . - if( floats_are_about_equal( value, amplitude ) ) - { - if( number_of_points_in_one_period % 2 != 0 ) // odd, we need to add the 0 - { - x++; - if( is_real() ) - { - set_one_data_point( 0.0f, x, y, z, batch); - } - else - { - set_one_data_point( 0.0f, 0.0f, x, y, z, batch); - } - } - value = -1 * amplitude; - } - // . . . otherwise, keep going up - else value += per_point_delta; - } - } - } - } - } - - /*****************************************************/ - void set_all_to_random_data( size_t max_value, size_t seed ) { - // for all batches - - boost::mt19937 random_data_generator; - boost::uniform_int<> distribution(1, INT_MAX); - boost::variate_generator > - random_value(random_data_generator, distribution); - random_data_generator.seed( static_cast( seed ) ); - - for( size_t batch = 0; batch < batch_size(); batch++) { - for( size_t z = 0; z < length(dimz); z++) { - for( size_t y = 0; y < length(dimy); y++) { - for( size_t x = 0; x < length(dimx); x++) { - int val = random_value() % (max_value + 1); // pluck a random value - if( random_value() % 2 ) val *= -1; // make it negative about 50% of the time - - if( is_real() ) - { - set_one_data_point( static_cast(val), x, y, z, batch ); - } - - else - { - set_one_data_point( static_cast(val), static_cast(val), x, y, z, batch ); - } - } - } - } - } - } - - /*****************************************************/ - void set_all_to_impulse() - { - // for all batches - clear(); - - for( size_t batch = 0; batch < batch_size(); batch++ ) - { - if( is_real() ) - set_one_data_point( static_cast(number_of_data_points_single_batch()), 0, 0, 0, batch); - else - set_one_data_point( static_cast(number_of_data_points_single_batch()), 0.0f, 0, 0, 0, batch); - } - } - - - - /*****************************************************/ - void scale_data( T scale) { - // for all batches - - for( size_t batch = 0; batch < batch_size(); batch++ ) - { - for( size_t z = 0; z < length(dimz); z++ ) - { - for( size_t y = 0; y < length(dimy); y++ ) - { - for( size_t x = 0; x < length(dimx); x++ ) - { - if( is_real() ) - { - T this_value = real(x, y, z, batch); - T scaled_value = this_value * scale; - set_one_data_point( scaled_value, x, y, z, batch ); - } - else - { - T this_real = real(x, y, z, batch); - T this_imag = imag(x, y, z, batch); - - T scaled_real = this_real * scale; - T scaled_imag = this_imag * scale; - set_one_data_point( scaled_real, scaled_imag, x, y, z, batch ); - } - } - } - } - } - } - - /*****************************************************/ - void make_sure_padding_was_not_overwritten() - { - // check before and after memory first - for( size_t i = 0; i < _the_buffers.size(); i++ ) - { - _the_buffers[i].check_memory_boundaries(); - } - - if( _tightly_packed_strides && _tightly_packed_distance) return; // nothing worth checking - - size_t intervening_point_touched = 0; - - for( size_t batch = 0; batch < batch_size(); batch++) - { - for( size_t z = 0; z < length(dimz); z++) - { - for( size_t y = 0; y < length(dimy); y++) - { - for( size_t x = 0; x < length(dimx); x++) - { - size_t this_point = index(x, y, z, batch); - size_t next_point = next_index(x, y, z, batch); - - if( is_planar() ) - { - if( this_point < _the_buffers[re].size() && this_point + 1 != next_point) - { - for( size_t i = this_point+1; i < next_point; i++) - { - T this_real = _the_buffers[re][i]; - T this_imag = _the_buffers[im][i]; - - if( nan_as_hex(this_real) != float_as_hex(this_real) - || nan_as_hex(this_imag) != float_as_hex(this_imag) ) - { - ++intervening_point_touched; - } - } - } - } - else if( is_real() ) - { - if( this_point < _the_buffers[re].size() && this_point + 1 != next_point) - { - for( size_t i = this_point+1; i < next_point; i++) - { - T this_real = _the_buffers[re][i]; - - if( nan_as_hex(this_real) != float_as_hex(this_real) ) - { - ++intervening_point_touched; - } - } - } - } - else if( is_interleaved() ) - { - if( this_point < _the_buffers[re].size() && this_point + 1 != next_point) - { - // NOTE whereas real and planar initialize i = this_point+1, - // we want this_point+2 for interleaved so that we skip the - // imaginary value of the point - for( size_t i = this_point+2; i < next_point; i++) - { - T this_real = _the_buffers[interleaved][i]; - - if( nan_as_hex(this_real) != float_as_hex(this_real) ) - { - ++intervening_point_touched; - } - } - } - } - else - throw std::runtime_error( "invalid layout in make_sure_memory_between_data_points_was_not_touched()" ); - } - } - } - } - - EXPECT_EQ( 0, intervening_point_touched ); - } + /*****************************************************/ + bool operator==(buffer &other_buffer) { + // complexity of each dimension must be the same + if ((is_real() && !other_buffer.is_real()) || + (!is_real() && other_buffer.is_real()) || + (is_hermitian() && !other_buffer.is_hermitian()) || + (!is_hermitian() && other_buffer.is_hermitian()) || + (is_complex() && !other_buffer.is_complex()) || + (!is_complex() && other_buffer.is_complex())) { + return false; + } + + // batch_size of the data must be the same + if (batch_size() != other_buffer.batch_size()) { + return false; + } + + // dimensionality of the data must be the same + if (number_of_dimensions() != other_buffer.number_of_dimensions()) { + return false; + } + + // size of each dimension must be the same + for (size_t i = 0; i < number_of_dimensions(); ++i) { + if (length(i) != other_buffer.length(i)) + return false; + } + + size_t number_deaths = 0; + number_deaths += buffer_mismatches(other_buffer, comparison_type); + + if (number_deaths == 0) + return true; + else + return false; + } + + /*****************************************************/ + bool operator!=(buffer &other_buffer) { return !(*this == other_buffer); } + + void operator*=(buffer &other_buffer) { + size_t the_index; + T *base_ptr; + T *real_ptr; + T *imag_ptr; + + if (is_interleaved()) { + base_ptr = _the_buffers[interleaved].ptr(); + } else if (is_planar()) { + real_ptr = _the_buffers[re].ptr(); + imag_ptr = _the_buffers[im].ptr(); + } else if (is_real()) { + base_ptr = _the_buffers[re].ptr(); + } + + for (size_t batch = 0; batch < batch_size(); batch++) + for (size_t z = 0; z < length(dimz); z++) + for (size_t y = 0; y < length(dimy); y++) + for (size_t x = 0; x < length(dimx); x++) { + the_index = index(x, y, z, batch); + if (is_interleaved()) { + *(base_ptr + the_index) *= other_buffer.real(x, y, z, batch); + + the_index = + the_index + + 1; // the imaginary component immediately follows the real + if (other_buffer.is_real()) { + *(base_ptr + the_index) *= other_buffer.real(x, y, z, batch); + } else { + *(base_ptr + the_index) *= other_buffer.imag(x, y, z, batch); + } + } else if (is_planar()) { + *(real_ptr + the_index) *= other_buffer.real(x, y, z, batch); + + if (other_buffer.is_real()) { + *(imag_ptr + the_index) *= other_buffer.real(x, y, z, batch); + } else { + *(imag_ptr + the_index) *= other_buffer.imag(x, y, z, batch); + } + } else if (is_real()) { + *(base_ptr + the_index) *= other_buffer.real(x, y, z, batch); + } + } + } + + // Calculates a 3 point average of other_buffer and + // multiplies with buffer + // only real layout is supported for other_buffer currently + void multiply_3pt_average(buffer &other_buffer) { + if (!other_buffer.is_real()) { + throw std::runtime_error( + "only real layout is supported currently for other_buffer"); + } + + size_t the_index, o_the_index; + T *base_ptr, *o_base_ptr; + T *real_ptr; + T *imag_ptr; + T o_prev_val, o_next_val; + T average; + + if (is_interleaved()) { + base_ptr = _the_buffers[interleaved].ptr(); + } else if (is_planar()) { + real_ptr = _the_buffers[re].ptr(); + imag_ptr = _the_buffers[im].ptr(); + } else if (is_real()) { + base_ptr = _the_buffers[re].ptr(); + } + o_base_ptr = other_buffer.real_ptr(); + + for (size_t batch = 0; batch < batch_size(); batch++) + for (size_t z = 0; z < length(dimz); z++) + for (size_t y = 0; y < length(dimy); y++) + for (size_t x = 0; x < length(dimx); x++) { + the_index = index(x, y, z, batch); + o_the_index = other_buffer.index(x, y, z, batch); + o_prev_val = o_the_index <= 0 ? 0 : *(o_base_ptr + o_the_index - 1); + o_next_val = + o_the_index >= + (other_buffer + .total_number_of_points_including_data_and_intervening() - + 1) + ? 0 + : *(o_base_ptr + o_the_index + 1); + + average = + (o_prev_val + *(o_base_ptr + o_the_index) + o_next_val) / 3.0f; + + if (is_interleaved()) { + *(base_ptr + the_index) *= average; + + the_index = + the_index + + 1; // the imaginary component immediately follows the real + *(base_ptr + the_index) *= average; + } else if (is_planar()) { + *(real_ptr + the_index) *= average; + + *(imag_ptr + the_index) *= average; + } else if (is_real()) { + *(base_ptr + the_index) *= average; + } + } + } + + /*****************************************************/ + // strides and distance are those of the output (that is, the new hermitian + // buffer) + void change_real_to_hermitian(const size_t *strides_in, + const size_t distance_in) { + if (!is_real() || !is_in_place()) { + throw std::runtime_error("can only change a real buffer used in an " + "in-place transform to a hermitian one"); + } + + // we currently only support hermitian interleaved for in-place transforms + _layout = layout::hermitian_interleaved; + adjust_length_x_for_hermitian_buffers(); + initialize_strides(strides_in); + initialize_distance(distance_in); + } + + /*****************************************************/ + // strides and distance are those of the output (that is, the new real buffer) + void change_hermitian_to_real(const size_t *strides_in, + const size_t distance_in) { + // we currently only support hermitian interleaved for in-place transforms + if (_layout != layout::hermitian_interleaved || !is_in_place()) { + throw std::runtime_error("can only change a hermitian interleaved buffer " + "used in an in-place transform to a real one"); + } + + _layout = layout::real; + _lengths[dimx] = _requested_length_x; + initialize_strides(strides_in); + initialize_distance(distance_in); + } + + /*****************************************************/ + bool is_real() { return _layout == layout::real; } + + /*****************************************************/ + bool is_complex() { + return _layout == layout::complex_interleaved || + _layout == layout::complex_planar; + } + + /*****************************************************/ + bool is_hermitian() { + return _layout == layout::hermitian_interleaved || + _layout == layout::hermitian_planar; + } + + /*****************************************************/ + bool is_planar() { + return _layout == layout::complex_planar || + _layout == layout::hermitian_planar; + } + + /*****************************************************/ + bool is_interleaved() { + return _layout == layout::complex_interleaved || + _layout == layout::hermitian_interleaved; + } + + /*****************************************************/ + bool is_in_place() { + if (_placeness == CLFFT_INPLACE) + return true; + else if (_placeness == CLFFT_OUTOFPLACE) + return false; + else + throw std::runtime_error("invalid placeness value in is_in_place()"); + } + + /*****************************************************/ + T *interleaved_ptr() { + if (is_interleaved()) + return _the_buffers[interleaved].ptr(); + else + throw std::runtime_error( + "interleaved_ptr() is only available on interleaved buffers"); + } + + /*****************************************************/ + T *real_ptr() { + if (is_planar() || is_real()) + return _the_buffers[re].ptr(); + else + throw std::runtime_error( + "real() is only available on real and planar buffers"); + } + + /*****************************************************/ + T *imag_ptr() { + if (is_planar()) + return _the_buffers[im].ptr(); + else + throw std::runtime_error( + "imag_ptr() is only available on planar buffers"); + } + + /*****************************************************/ + T real(const size_t x, const size_t y = 0, const size_t z = 0, + const size_t batch = 0) { + size_t this_index = index(x, y, z, batch); + + // all layouts will have a real component + // using [re] will catch the real component for + // layout::interleaved as well + T this_value = _the_buffers[re][this_index]; + return this_value; + } + + /*****************************************************/ + T imag(const size_t x, const size_t y = 0, const size_t z = 0, + const size_t batch = 0) { + size_t this_index = index(x, y, z, batch); + + if (is_real()) + throw std::runtime_error("imag() is not available for this real buffer"); + else if (is_planar()) + return _the_buffers[im][this_index]; + else if (is_interleaved()) + // index always points to the real component of an interleaved number + // the following memory location is the imaginary component + return _the_buffers[interleaved][this_index + 1]; + else + throw std::runtime_error("invalid layout type in imag()"); + } + + /*****************************************************/ + std::complex complex(const size_t x, const size_t y = 0, + const size_t z = 0, const size_t batch = 0) { + if (is_real()) + throw std::runtime_error( + "complex() is not available for this real buffer"); + else if (is_complex() || is_hermitian()) { + std::complex this_complex(real(x, y, z, batch), imag(x, y, z, batch)); + return this_complex; + } else + throw std::runtime_error("invalid layout type in complex()"); + } + + /*****************************************************/ + size_t number_of_dimensions() { return _number_of_dimensions; } + + /*****************************************************/ + size_t number_of_data_points_single_batch() { + size_t number_of_points = 1; + for (size_t i = 0; i < _number_of_dimensions; ++i) { + number_of_points *= length(i); + } + return number_of_points; + } + + /*****************************************************/ + size_t number_of_data_points() { + return number_of_data_points_single_batch() * batch_size(); + } + + /*****************************************************/ + // note that this returns the size in number of points and + // does not take layout into consideration. this will yield + // the same number for real, interleaved, and planar layouts. + // whomever uses this information will need to know if they + // want 1x buffer of this size (real), 2x buffer of this + // size (planar), or 1x double-wide buffer (interleaved) + size_t total_number_of_points_including_data_and_intervening() { + return distance() * batch_size(); + } + + /*****************************************************/ + // note that this will return the size of ONE BUFFER in bytes + // for real and interleaved, that doesn't change anything + // for planar, you will get the size of the real _or_ the imaginary + // (which should always be the same) + size_t size_in_bytes() { return _the_buffers[0].size_in_bytes(); } + + /*****************************************************/ + size_t length(size_t dim) { return _lengths[dim]; } + + /*****************************************************/ + size_t stride(size_t dim) { return _strides[dim]; } + + /*****************************************************/ + size_t *lengths() { return &_lengths[0]; } + + /*****************************************************/ + size_t *strides() { return &_strides[0]; } + + /*****************************************************/ + size_t batch_size() { return _batch_size; } + + /*****************************************************/ + size_t distance() { return _distance; } + + /*****************************************************/ + void clear() { + // for all batches + + if (is_real()) + set_all_to_value(0.0f); + else + set_all_to_value(0.0f, 0.0f); + } + + /*****************************************************/ + void set_one_data_point(T real, const size_t x, const size_t y, + const size_t z, const size_t batch) { + if (is_real()) { + T *base_ptr = _the_buffers[re].ptr(); + size_t real_index = index(x, y, z, batch); + + *(base_ptr + real_index) = real; + } else + throw std::runtime_error("attempting to use real data point setter for " + "complex or hermitian buffer"); + } + + /*****************************************************/ + void set_one_data_point(T real, T imag, const size_t x, const size_t y, + const size_t z, const size_t batch) { + if (is_real()) + throw std::runtime_error( + "attempting to use complex data point setter for real buffer"); + else if (is_interleaved()) { + T *base_ptr = _the_buffers[interleaved].ptr(); + size_t real_index = index(x, y, z, batch); + size_t imag_index = + real_index + + 1; // the imaginary component immediately follows the real + + *(base_ptr + real_index) = real; + *(base_ptr + imag_index) = imag; + } else // planar + { + T *real_ptr = _the_buffers[re].ptr(); + T *imag_ptr = _the_buffers[im].ptr(); + size_t the_index = index(x, y, z, batch); + + *(real_ptr + the_index) = real; + *(imag_ptr + the_index) = imag; + } + } + + /*****************************************************/ + void set_all_to_value(T real) { + // for all batches + + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + set_one_data_point(real, x, y, z, batch); + } + } + } + } + } + + /*****************************************************/ + void set_all_to_value(T real, T imag) { + // for all batches + + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + set_one_data_point(real, imag, x, y, z, batch); + } + } + } + } + } + + /*****************************************************/ + void set_all_to_linear_increase() { + // for all batches + + size_t val = 1; + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + if (is_real()) { + set_one_data_point(static_cast(val), x, y, z, batch); + } + + else { + set_one_data_point(static_cast(val), + static_cast(val) + 0.5f, x, y, z, batch); + } + + ++val; + } + } + } + } + } + + /*****************************************************/ + void set_all_to_sawtooth(T amplitude) { + // for all batches + + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + // waveform will be 1 period of sawtooth + size_t number_of_points_in_one_period = length(dimx); + size_t number_of_points_on_one_line = + number_of_points_in_one_period / 2; + + // the sawtooth will start at 0 and increase to amplitude at T/2 + // at T/2, value will change to -amplitude and increase back up to 0 + // at T if there are an odd number of points in the whole period, + // we'll make a stop at 0 in the middle of the jump + T value = 0.0f; + T per_point_delta = amplitude / (number_of_points_on_one_line - 1); + + for (size_t x = 0; x < number_of_points_in_one_period; x++) { + if (is_real()) { + set_one_data_point(value, x, y, z, batch); + } else { + // for the real value, we want the sawtooth as described above + // for the imaginary value, we want the 2 times the inverse + // (so that real and imaginary don't match, + //possibly obscuring errors) + set_one_data_point(value, -2.0f * value, x, y, z, batch); + } + + // if we're at T/2, we want to saw on down to the negative amplitude + // . . . + if (floats_are_about_equal(value, amplitude)) { + if (number_of_points_in_one_period % 2 != + 0) // odd, we need to add the 0 + { + x++; + if (is_real()) { + set_one_data_point(0.0f, x, y, z, batch); + } else { + set_one_data_point(0.0f, 0.0f, x, y, z, batch); + } + } + value = -1 * amplitude; + } + // . . . otherwise, keep going up + else + value += per_point_delta; + } + } + } + } + } + + /*****************************************************/ + void set_all_to_random_data(size_t max_value, size_t seed) { + // for all batches + + boost::mt19937 random_data_generator; + boost::uniform_int<> distribution(1, INT_MAX); + boost::variate_generator> + random_value(random_data_generator, distribution); + random_data_generator.seed(static_cast(seed)); + + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + int val = random_value() % (max_value + 1); // pluck a random value + if (random_value() % 2) + val *= -1; // make it negative about 50% of the time + + if (is_real()) { + set_one_data_point(static_cast(val), x, y, z, batch); + } + + else { + set_one_data_point(static_cast(val), static_cast(val), x, y, + z, batch); + } + } + } + } + } + } + + /*****************************************************/ + void set_all_to_impulse() { + // for all batches + clear(); + + for (size_t batch = 0; batch < batch_size(); batch++) { + if (is_real()) + set_one_data_point(static_cast(number_of_data_points_single_batch()), + 0, 0, 0, batch); + else + set_one_data_point(static_cast(number_of_data_points_single_batch()), + 0.0f, 0, 0, 0, batch); + } + } + + /*****************************************************/ + void scale_data(T scale) { + // for all batches + + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + if (is_real()) { + T this_value = real(x, y, z, batch); + T scaled_value = this_value * scale; + set_one_data_point(scaled_value, x, y, z, batch); + } else { + T this_real = real(x, y, z, batch); + T this_imag = imag(x, y, z, batch); + + T scaled_real = this_real * scale; + T scaled_imag = this_imag * scale; + set_one_data_point(scaled_real, scaled_imag, x, y, z, batch); + } + } + } + } + } + } + + /*****************************************************/ + void make_sure_padding_was_not_overwritten() { + // check before and after memory first + for (size_t i = 0; i < _the_buffers.size(); i++) { + _the_buffers[i].check_memory_boundaries(); + } + + if (_tightly_packed_strides && _tightly_packed_distance) + return; // nothing worth checking + + size_t intervening_point_touched = 0; + + for (size_t batch = 0; batch < batch_size(); batch++) { + for (size_t z = 0; z < length(dimz); z++) { + for (size_t y = 0; y < length(dimy); y++) { + for (size_t x = 0; x < length(dimx); x++) { + size_t this_point = index(x, y, z, batch); + size_t next_point = next_index(x, y, z, batch); + + if (is_planar()) { + if (this_point < _the_buffers[re].size() && + this_point + 1 != next_point) { + for (size_t i = this_point + 1; i < next_point; i++) { + T this_real = _the_buffers[re][i]; + T this_imag = _the_buffers[im][i]; + + if (nan_as_hex(this_real) != float_as_hex(this_real) || + nan_as_hex(this_imag) != float_as_hex(this_imag)) { + ++intervening_point_touched; + } + } + } + } else if (is_real()) { + if (this_point < _the_buffers[re].size() && + this_point + 1 != next_point) { + for (size_t i = this_point + 1; i < next_point; i++) { + T this_real = _the_buffers[re][i]; + + if (nan_as_hex(this_real) != float_as_hex(this_real)) { + ++intervening_point_touched; + } + } + } + } else if (is_interleaved()) { + if (this_point < _the_buffers[re].size() && + this_point + 1 != next_point) { + // NOTE whereas real and planar initialize i = this_point+1, + // we want this_point+2 for interleaved so that we skip the + // imaginary value of the point + for (size_t i = this_point + 2; i < next_point; i++) { + T this_real = _the_buffers[interleaved][i]; + + if (nan_as_hex(this_real) != float_as_hex(this_real)) { + ++intervening_point_touched; + } + } + } + } else + throw std::runtime_error( + "invalid layout in " + "make_sure_memory_between_data_points_was_not_touched()"); + } + } + } + } + + EXPECT_EQ(0, intervening_point_touched); + } }; #endif diff --git a/src/tests/buffer_memory.cpp b/src/tests/buffer_memory.cpp index db0d949b..43b6beb2 100644 --- a/src/tests/buffer_memory.cpp +++ b/src/tests/buffer_memory.cpp @@ -14,31 +14,26 @@ * limitations under the License. * ************************************************************************/ - #include /*****************************************************/ /*****************************************************/ -uint32_t float_as_hex( float a ) { - return *(uint32_t*)&a; -} +uint32_t float_as_hex(float a) { return *(uint32_t *)&a; } /*****************************************************/ /*****************************************************/ -uint64_t float_as_hex( double a ) { - return *(uint64_t*)&a; -} +uint64_t float_as_hex(double a) { return *(uint64_t *)&a; } /*****************************************************/ /*****************************************************/ -uint32_t nan_as_hex( float a ) { - a; - return ~0x0; +uint32_t nan_as_hex(float a) { + a; + return ~0x0; } /*****************************************************/ /*****************************************************/ -uint64_t nan_as_hex( double a ) { - a; - return ~0x0ull; +uint64_t nan_as_hex(double a) { + a; + return ~0x0ull; } \ No newline at end of file diff --git a/src/tests/buffer_memory.h b/src/tests/buffer_memory.h index 7914ed10..383b6624 100644 --- a/src/tests/buffer_memory.h +++ b/src/tests/buffer_memory.h @@ -14,125 +14,114 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_BUFFER_MEMORY_H ) +#if !defined(CLFFT_BUFFER_MEMORY_H) #define CLFFT_BUFFER_MEMORY_H -#include #include #include +#include -uint32_t float_as_hex( float a ); -uint64_t float_as_hex( double a ); -uint32_t nan_as_hex( float a ); -uint64_t nan_as_hex( double a ); +uint32_t float_as_hex(float a); +uint64_t float_as_hex(double a); +uint32_t nan_as_hex(float a); +uint64_t nan_as_hex(double a); /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -template -class buffer_memory { +template class buffer_memory { private: - // Each array will have a cookie of this size placed before and after it. - // We will initialize the cookies to NaN. - // The user can confirm the cookies after operating on the data to confirm that - // his or her operations are respecting the boundaries of the memory. - size_t cookie_size; + // Each array will have a cookie of this size placed before and after it. + // We will initialize the cookies to NaN. + // The user can confirm the cookies after operating on the data to confirm + // that his or her operations are respecting the boundaries of the memory. + size_t cookie_size; - // requested_floats is the number of floats the user requested originally. - // This never changes, even if the memory size is increased. - size_t requested_floats; + // requested_floats is the number of floats the user requested originally. + // This never changes, even if the memory size is increased. + size_t requested_floats; - // With this and cookie_size, we can calculate the size of memory the user can access. - // Note that this will be in units of T (so 4 bytes or 8 bytes depending on float or double). - size_t memory_size_including_cookies; + // With this and cookie_size, we can calculate the size of memory the user can + // access. Note that this will be in units of T (so 4 bytes or 8 bytes + // depending on float or double). + size_t memory_size_including_cookies; - // Interesting stuff goes here. - std::vector memory; + // Interesting stuff goes here. + std::vector memory; public: - /*****************************************************/ - // requested_number_of_floats should already take into account any strides, - // batch size, data layout (real, complex, hermitian, interleaved, planar) - buffer_memory( size_t requested_number_of_floats ) - : cookie_size( 4 ) - , requested_floats( requested_number_of_floats ) - , memory_size_including_cookies( requested_number_of_floats + 2 * cookie_size ) - , memory( memory_size_including_cookies ) - { - clear(); - } - - /*****************************************************/ - ~buffer_memory() { - } - - /*****************************************************/ - buffer_memory & operator=( const buffer_memory & that ) - { - this->cookie_size = that.cookie_size; - this->requested_floats = that.requested_floats; - this->memory_size_including_cookies = that.memory_size_including_cookies; - this->memory = that.memory; - - return *this; - } - - /*****************************************************/ - void check_memory_boundaries() { - for( size_t i = 0; i < cookie_size; ++i) { - // we need to compare hex values instead of float values so that we don't get float ambiguities - if( float_as_hex(memory[i]) != nan_as_hex(memory[0]) || - float_as_hex( memory[ memory.size()-1-i ] ) != nan_as_hex(memory[0]) ) - throw std::runtime_error("some operation wrote beyond bounds of memory"); - } - } - - /*****************************************************/ - void clear() - { - memset(&memory[0], ~0x0, memory_size_including_cookies * sizeof(T)); - } - - /*****************************************************/ - // note that this is in units of T (float or double) - // also see: size_in_bytes() - size_t size() - { - return size_in_bytes() / sizeof(T); - } - - /*****************************************************/ - // returns the amount of memory currently allocated to the buffer in bytes - size_t size_in_bytes() - { - return (memory_size_including_cookies - 2 * cookie_size) * sizeof(T); - } - - /*****************************************************/ - // N.B. memory will be cleared after this - void increase_allocated_memory( size_t amount ) - { - size_t new_memory_size = memory_size_including_cookies + amount; - - memory.resize( new_memory_size ); - memory_size_including_cookies = new_memory_size; - - clear(); - } - - /*****************************************************/ - T* ptr() - { - return &memory[0] + cookie_size; - } - - /*****************************************************/ - T& operator[]( size_t index ) { - if( index >= size() ) - throw std::runtime_error( "operator[] write out of bounds" ); - return memory[0 + cookie_size + index]; - } + /*****************************************************/ + // requested_number_of_floats should already take into account any strides, + // batch size, data layout (real, complex, hermitian, interleaved, planar) + buffer_memory(size_t requested_number_of_floats) + : cookie_size(4), requested_floats(requested_number_of_floats), + memory_size_including_cookies(requested_number_of_floats + + 2 * cookie_size), + memory(memory_size_including_cookies) { + clear(); + } + + /*****************************************************/ + ~buffer_memory() {} + + /*****************************************************/ + buffer_memory &operator=(const buffer_memory &that) { + this->cookie_size = that.cookie_size; + this->requested_floats = that.requested_floats; + this->memory_size_including_cookies = that.memory_size_including_cookies; + this->memory = that.memory; + + return *this; + } + + /*****************************************************/ + void check_memory_boundaries() { + for (size_t i = 0; i < cookie_size; ++i) { + // we need to compare hex values instead of float values so that we don't + // get float ambiguities + if (float_as_hex(memory[i]) != nan_as_hex(memory[0]) || + float_as_hex(memory[memory.size() - 1 - i]) != nan_as_hex(memory[0])) + throw std::runtime_error( + "some operation wrote beyond bounds of memory"); + } + } + + /*****************************************************/ + void clear() { + memset(&memory[0], ~0x0, memory_size_including_cookies * sizeof(T)); + } + + /*****************************************************/ + // note that this is in units of T (float or double) + // also see: size_in_bytes() + size_t size() { return size_in_bytes() / sizeof(T); } + + /*****************************************************/ + // returns the amount of memory currently allocated to the buffer in bytes + size_t size_in_bytes() { + return (memory_size_including_cookies - 2 * cookie_size) * sizeof(T); + } + + /*****************************************************/ + // N.B. memory will be cleared after this + void increase_allocated_memory(size_t amount) { + size_t new_memory_size = memory_size_including_cookies + amount; + + memory.resize(new_memory_size); + memory_size_including_cookies = new_memory_size; + + clear(); + } + + /*****************************************************/ + T *ptr() { return &memory[0] + cookie_size; } + + /*****************************************************/ + T &operator[](size_t index) { + if (index >= size()) + throw std::runtime_error("operator[] write out of bounds"); + return memory[0 + cookie_size + index]; + } }; #endif diff --git a/src/tests/c-compliance.c b/src/tests/c-compliance.c index 04c0ff5e..781fc1f2 100644 --- a/src/tests/c-compliance.c +++ b/src/tests/c-compliance.c @@ -14,5 +14,4 @@ * limitations under the License. * ************************************************************************/ - #include "clFFT.h" diff --git a/src/tests/cl_transform.h b/src/tests/cl_transform.h index 0ef0d229..1d52063e 100644 --- a/src/tests/cl_transform.h +++ b/src/tests/cl_transform.h @@ -14,1171 +14,1109 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_CLTRANSFORM_H ) +#if !defined(CLFFT_CLTRANSFORM_H) #define CLFFT_CLTRANSFORM_H -#include -#include -#include "clFFT.h" -#include "../library/private.h" #include "../client/openCL.misc.h" +#include "../library/private.h" #include "buffer.h" +#include "clFFT.h" #include "test_constants.h" +#include +#include // Custom deleter functions for our unique_ptr smart pointer class -struct clMem_deleter -{ - template void operator()(T* clMemObj) - { - if( clMemObj != NULL ) - OPENCL_V_THROW( ::clReleaseMemObject( clMemObj ), "Error: In clReleaseMemObject\n" ); - }; +struct clMem_deleter { + template void operator()(T *clMemObj) { + if (clMemObj != NULL) + OPENCL_V_THROW(::clReleaseMemObject(clMemObj), + "Error: In clReleaseMemObject\n"); + }; }; -struct plan_handle_deleter -{ - template void operator()(T* handle) - { - if( *handle ) - { - clfftDestroyPlan( handle ); - } - clfftTeardown( ); // when multi-GPU tests are written, this will need to occur in the gtest cleanup - }; +struct plan_handle_deleter { + template void operator()(T *handle) { + if (*handle) { + clfftDestroyPlan(handle); + } + clfftTeardown(); // when multi-GPU tests are written, this will need to + // occur in the gtest cleanup + }; }; -struct clEvent_deleter -{ - template void operator()(T* clEventObj) - { - if( clEventObj != NULL ) - OPENCL_V_THROW( clReleaseEvent( clEventObj ), "Error: In clReleaseEvent\n" ); - }; +struct clEvent_deleter { + template void operator()(T *clEventObj) { + if (clEventObj != NULL) + OPENCL_V_THROW(clReleaseEvent(clEventObj), "Error: In clReleaseEvent\n"); + }; }; -struct clCommQueue_deleter -{ - template void operator()(T* clQueueObj) - { - if( clQueueObj != NULL ) - OPENCL_V_THROW( clReleaseCommandQueue( clQueueObj ), "Error: In clReleaseCommandQueue\n" ); - }; +struct clCommQueue_deleter { + template void operator()(T *clQueueObj) { + if (clQueueObj != NULL) + OPENCL_V_THROW(clReleaseCommandQueue(clQueueObj), + "Error: In clReleaseCommandQueue\n"); + }; }; -struct clContext_deleter -{ - template void operator()(T* clContextObj) - { - if( clContextObj != NULL ) - OPENCL_V_THROW( clReleaseContext( clContextObj ), "Error: In clReleaseContext\n" ); - }; +struct clContext_deleter { + template void operator()(T *clContextObj) { + if (clContextObj != NULL) + OPENCL_V_THROW(clReleaseContext(clContextObj), + "Error: In clReleaseContext\n"); + }; }; -template -class Precision_Setter -{ +template class Precision_Setter { public: - Precision_Setter(clfftPlanHandle plan_handle) - { - throw std::runtime_error("Precision_Setter: this code path should never be executed"); - } + Precision_Setter(clfftPlanHandle plan_handle) { + throw std::runtime_error( + "Precision_Setter: this code path should never be executed"); + } private: - Precision_Setter(){} + Precision_Setter() {} }; -template<> -class Precision_Setter -{ +template <> class Precision_Setter { public: - Precision_Setter(clfftPlanHandle plan_handle) - { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanPrecision( plan_handle, CLFFT_SINGLE )); - } + Precision_Setter(clfftPlanHandle plan_handle) { + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanPrecision(plan_handle, CLFFT_SINGLE)); + } private: - Precision_Setter(){} + Precision_Setter() {} }; -template<> -class Precision_Setter -{ +template <> class Precision_Setter { public: - Precision_Setter(clfftPlanHandle plan_handle) - { - clfftStatus ret = clfftSetPlanPrecision( plan_handle, CLFFT_DOUBLE ); + Precision_Setter(clfftPlanHandle plan_handle) { + clfftStatus ret = clfftSetPlanPrecision(plan_handle, CLFFT_DOUBLE); - // If device does not support double precision, skip this test, don't fail it - if( ret == CLFFT_DEVICE_NO_DOUBLE ) - throw std::runtime_error("CLFFT_DEVICE_NO_DOUBLE"); + // If device does not support double precision, skip this test, don't fail + //it + if (ret == CLFFT_DEVICE_NO_DOUBLE) + throw std::runtime_error("CLFFT_DEVICE_NO_DOUBLE"); - EXPECT_EQ( CLFFT_SUCCESS, ret ); - } + EXPECT_EQ(CLFFT_SUCCESS, ret); + } private: - Precision_Setter(){} + Precision_Setter() {} }; - /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -template -class clfft { +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ +template class clfft { private: - clfftLayout _input_layout, _output_layout; - clfftResultLocation _placeness; + clfftLayout _input_layout, _output_layout; + clfftResultLocation _placeness; + + buffer input; + buffer output; - buffer input; - buffer output; - - size_t number_of_data_points; - T _forward_scale, _backward_scale; - cl_uint commandQueueFlags; - bool init_failure; - bool dataset_too_large; + size_t number_of_data_points; + T _forward_scale, _backward_scale; + cl_uint commandQueueFlags; + bool init_failure; + bool dataset_too_large; - cl_device_type deviceType; - std::unique_ptr< clfftPlanHandle, plan_handle_deleter > plan_handle; + cl_device_type deviceType; + std::unique_ptr plan_handle; - clfftDirection _transformation_direction; - clfftDim dimension; + clfftDirection _transformation_direction; + clfftDim dimension; - std::vector lengths; + std::vector lengths; - static const bool printInfo = false; + static const bool printInfo = false; - std::unique_ptr< _cl_mem, clMem_deleter > userDataPreMem; - std::unique_ptr< _cl_mem, clMem_deleter > userDataPostMem; + std::unique_ptr<_cl_mem, clMem_deleter> userDataPreMem; + std::unique_ptr<_cl_mem, clMem_deleter> userDataPostMem; + + // OpenCL resources that need to be carefully managed + std::unique_ptr<_cl_context, clContext_deleter> context; + std::unique_ptr<_cl_command_queue, clCommQueue_deleter> queue; + std::vector> cl_mem_input; + std::vector> cl_mem_output; + std::vector device_id; - // OpenCL resources that need to be carefully managed - std::unique_ptr< _cl_context, clContext_deleter > context; - std::unique_ptr< _cl_command_queue, clCommQueue_deleter > queue; - std::vector< std::unique_ptr< _cl_mem, clMem_deleter > > cl_mem_input; - std::vector< std::unique_ptr< _cl_mem, clMem_deleter > > cl_mem_output; - std::vector< cl_device_id > device_id; public: - /*****************************************************/ - clfft( const clfftDim dimensions_in, const size_t* lengths_in, - const size_t* input_strides_in, const size_t* output_strides_in, - const size_t batch_size_in, - const size_t input_distance_in, const size_t output_distance_in, - const clfftLayout input_layout_in, const clfftLayout output_layout_in, - const clfftResultLocation placeness_in ) - try - : _input_layout( input_layout_in ) - , _output_layout( output_layout_in ) - , _placeness( placeness_in ) - , input( static_cast(dimensions_in), - lengths_in, - input_strides_in, - batch_size_in, - input_distance_in, - cl_layout_to_buffer_layout( _input_layout ), - _placeness - ) - , output( static_cast(dimensions_in), - lengths_in, - output_strides_in, - batch_size_in, - output_distance_in, - cl_layout_to_buffer_layout( _output_layout ), - _placeness - ) - , number_of_data_points( input.number_of_data_points()) - , _forward_scale( 1.0f ) - , _backward_scale( 1.0f/T(number_of_data_points) ) - , commandQueueFlags( 0 ) - , init_failure( false ) - , dataset_too_large( false ) - , deviceType( 0 ) - , plan_handle( new clfftPlanHandle ) - , _transformation_direction( ENDDIRECTION ) - , dimension( dimensions_in ) - - { - if( _placeness == CLFFT_INPLACE ) - { - if( ( is_real( _input_layout ) && is_planar( _output_layout ) ) || - ( is_planar( _input_layout ) && is_real( _output_layout ) ) ) - { - throw std::runtime_error( "in-place transforms may not be real<->planar" ); - } - } - - *plan_handle = 0; - clfftSetupData setupData; - clfftInitSetupData( &setupData ); - clfftSetup( &setupData ); - - for( int i = 0; i < max_dimension; i++ ) - { - if( i < dimension ) - lengths.push_back( lengths_in[i] ); - else - lengths.push_back( 1 ); - } - - initialize_openCL(); - initialize_plan(); - } - catch( const std::exception& ) { - throw; - } - - /*****************************************************/ - ~clfft() - {} - - /*****************************************************/ - bool is_real( const clfftLayout layout ) - { - return layout == CLFFT_REAL; - } - - /*****************************************************/ - bool is_planar( const clfftLayout layout ) - { - return (layout == CLFFT_COMPLEX_PLANAR || layout == CLFFT_HERMITIAN_PLANAR); - } - - /*****************************************************/ - bool is_interleaved( const clfftLayout layout ) - { - return (layout == CLFFT_COMPLEX_INTERLEAVED || layout == CLFFT_HERMITIAN_INTERLEAVED); - } - - /*****************************************************/ - bool is_complex( const clfftLayout layout ) - { - return (layout == CLFFT_COMPLEX_INTERLEAVED || layout == CLFFT_COMPLEX_PLANAR); - } - - /*****************************************************/ - bool is_hermitian( const clfftLayout layout ) - { - return (layout == CLFFT_HERMITIAN_INTERLEAVED || layout == CLFFT_HERMITIAN_PLANAR); - } - - /*****************************************************/ - void initialize_openCL() { - try - { - cl_context tempContext = NULL; - device_id = initializeCL( - g_device_type, - g_device_id, - g_platform_id, - tempContext, - printInfo - ); - context = std::unique_ptr< _cl_context, clContext_deleter >( tempContext ); - - if( input.size_in_bytes() > cl_device_max_memory_to_allocate(0) || - output.size_in_bytes() > cl_device_max_memory_to_allocate(0)) - { - throw std::runtime_error("problem too large for device"); - } - - cl_int status = 0; - queue = std::unique_ptr< _cl_command_queue, clCommQueue_deleter >( - ::clCreateCommandQueue( context.get( ), device_id[ 0 ], commandQueueFlags, &status ) ); - OPENCL_V_THROW( status, "Creating Command Queue ( ::clCreateCommandQueue() )" ); - - // make the new buffer - const size_t bufferSizeBytes = input.size_in_bytes( ); - - for( cl_int i = 0; i < CLFFT_COMPLEX_INTERLEAVED; ++i ) - { - cl_int status = 0; - std::unique_ptr< _cl_mem, clMem_deleter > inBuff( - ::clCreateBuffer( context.get( ), CL_MEM_READ_WRITE, bufferSizeBytes, NULL, &status) ); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - - cl_mem_input.push_back( std::move( inBuff ) ); - - std::unique_ptr< _cl_mem, clMem_deleter > outBuff( - ::clCreateBuffer( context.get( ), CL_MEM_READ_WRITE, bufferSizeBytes, NULL, &status) ); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - - cl_mem_output.push_back( std::move( outBuff ) ); - } - } - catch( const std::exception& ) - { - throw; - } - } - - /*****************************************************/ - void initialize_plan() - { - EXPECT_EQ( CLFFT_SUCCESS, clfftCreateDefaultPlan( plan_handle.get(), context.get( ), dimension, &lengths[0] ) ); - set_layouts( _input_layout, _output_layout ); - placeness( _placeness ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( *plan_handle, dimension, input.strides())); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( *plan_handle, dimension, output.strides())); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( *plan_handle, input.batch_size())); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( *plan_handle, input.distance(), output.distance())); - Precision_Setter setter(*plan_handle); - } - - /*****************************************************/ - std::string input_strides_plaintext() - { - size_t strides[3]; - clfftGetPlanInStride( *plan_handle, dimension, &strides[0] ); - - std::ostringstream my_strides_stream; - - for( int i = 0; i < dimension; i++ ) - my_strides_stream << strides[i] << " "; - - std::string my_strides( my_strides_stream.str() ); - my_strides.erase( my_strides.end() - 1 ); // chomp off trailing space - - return my_strides; - } - - /*****************************************************/ - std::string output_strides_plaintext() - { - size_t strides[3]; - clfftGetPlanOutStride( *plan_handle, dimension, &strides[0] ); - - std::ostringstream my_strides_stream; - - for( int i = 0; i < dimension; i++ ) - my_strides_stream << strides[i] << " "; - - std::string my_strides( my_strides_stream.str() ); - my_strides.erase( my_strides.end() - 1 ); // chomp off trailing space - - return my_strides; - } - - /*****************************************************/ - std::string lengths_plaintext() - { - size_t lengths[3]; - clfftGetPlanLength( *plan_handle, dimension, &lengths[0] ); - - std::ostringstream my_lengths_stream; - - for( int i = 0; i < dimension; i++ ) - my_lengths_stream << lengths[i] << " "; - - std::string my_lengths( my_lengths_stream.str() ); - my_lengths.erase( my_lengths.end() - 1 ); // chomp off trailing space - - return my_lengths; - } - - /*****************************************************/ - std::string layout_plaintext( clfftLayout layout ) - { - switch( layout ) - { - case CLFFT_REAL: - return "real"; - case CLFFT_HERMITIAN_INTERLEAVED: - return "hermitian interleaved"; - case CLFFT_HERMITIAN_PLANAR: - return "hermitian planar"; - case CLFFT_COMPLEX_INTERLEAVED: - return "complex interleaved"; - case CLFFT_COMPLEX_PLANAR: - return "complex planar"; - default: - throw std::runtime_error( "invalid layout in layout_plaintext()" ); - } - } - - /*****************************************************/ - void refresh_plan() - { - clfftDestroyPlan(plan_handle.get()); - initialize_plan(); - } - - /*****************************************************/ - layout::buffer_layout_t cl_layout_to_buffer_layout( clfftLayout cl_layout ) - { - if( cl_layout == CLFFT_REAL ) - return layout::real; - else if( cl_layout == CLFFT_HERMITIAN_PLANAR ) - return layout::hermitian_planar; - else if( cl_layout == CLFFT_COMPLEX_PLANAR ) - return layout::complex_planar; - else if( cl_layout == CLFFT_HERMITIAN_INTERLEAVED ) - return layout::hermitian_interleaved; - else if( cl_layout == CLFFT_COMPLEX_INTERLEAVED ) - return layout::complex_interleaved; - else - throw std::runtime_error( "invalid cl_layout" ); - } - - /*****************************************************/ - void verbose_output() - { - if(verbose) - { - std::cout << "transform parameters as seen by clfft:" << std::endl; - - clfftDim dim; - cl_uint dimensions; - clfftGetPlanDim( *plan_handle, &dim, &dimensions ); - - std::cout << dimensions << " dimension(s): " << lengths_plaintext() << std::endl; - - size_t batch; - clfftGetPlanBatchSize( *plan_handle, &batch ); - std::cout << "batch: " << batch << std::endl; - - clfftPrecision precision; - clfftGetPlanPrecision( *plan_handle, &precision ); - if( precision == CLFFT_SINGLE ) std::cout << "single precision" << std::endl; - else if( precision == CLFFT_DOUBLE ) std::cout << "double precision" << std::endl; - else throw std::runtime_error( "can't figure out the precision in verbose_output()" ); - - if( placeness() == CLFFT_INPLACE ) std::cout << "in-place" << std::endl; - else std::cout << "out-of-place" << std::endl; - - get_layouts(); - std::cout << layout_plaintext(_input_layout) << " -> " << layout_plaintext(_output_layout) << std::endl; - - std::cout << "input stride(s): " << input_strides_plaintext() << std::endl; - std::cout << "output stride(s): " << output_strides_plaintext() << std::endl; - - size_t input_distance, output_distance; - clfftGetPlanDistance( *plan_handle, &input_distance, &output_distance ); - std::cout << "input distance: " << input_distance << std::endl; - std::cout << "output distance: " << output_distance << std::endl; - } - } - - /*****************************************************/ - clfftResultLocation placeness() { - clfftResultLocation res; - EXPECT_EQ( CLFFT_SUCCESS, clfftGetResultLocation( *plan_handle, &res ) ); - return res; - } - - /*****************************************************/ - void set_forward_transform() { - _transformation_direction = CLFFT_FORWARD; - } - - /*****************************************************/ - void set_backward_transform() { - _transformation_direction = CLFFT_BACKWARD; - } - - /*****************************************************/ - void set_transposed() { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanTransposeResult( *plan_handle, CLFFT_TRANSPOSED ) ); - } - - /*****************************************************/ - void set_layouts( clfftLayout new_input_layout, clfftLayout new_output_layout ) - { - cl_mem_input.clear( ); - cl_mem_output.clear( ); - - // make the new input buffer - const size_t input_buffer_size_in_bytes = input.size_in_bytes(); - - size_t number_of_input_buffers; - - if( is_planar( new_input_layout ) ) - number_of_input_buffers = 2; - else if( is_real( new_input_layout ) || is_interleaved( new_input_layout ) ) - number_of_input_buffers = 1; - else - throw std::runtime_error( "we shouldn't make it here [set_layouts(), input]" ); - - for( size_t i = 0; i < number_of_input_buffers; ++i ) - { - cl_int status = 0; - std::unique_ptr< _cl_mem, clMem_deleter > buff( - ::clCreateBuffer( context.get( ), CL_MEM_READ_WRITE, input_buffer_size_in_bytes, NULL, &status) ); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - - cl_mem_input.push_back( std::move( buff ) ); - } - - // make the new output buffer - const size_t output_buffer_size_in_bytes = output.size_in_bytes(); - - size_t number_of_output_buffers; - - if( is_planar( new_output_layout ) ) - number_of_output_buffers = 2; - else if( is_real( new_output_layout ) || is_interleaved( new_output_layout ) ) - number_of_output_buffers = 1; - else - throw std::runtime_error( "we shouldn't make it here [set_layouts(), input]" ); - - for( size_t i = 0; i < number_of_output_buffers; ++i ) - { - cl_int status = 0; - std::unique_ptr< _cl_mem, clMem_deleter > buff( - ::clCreateBuffer( context.get( ), CL_MEM_READ_WRITE, output_buffer_size_in_bytes, NULL, &status) ); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - - cl_mem_output.push_back( std::move( buff ) ); - } - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( *plan_handle, new_input_layout, new_output_layout ) ); - get_layouts(); - } - - /*****************************************************/ - // swap_layouts should only be used with in-place real-to-complex or complex-to-real transforms - void swap_layouts() - { - get_layouts(); - clfftLayout new_input_layout = _output_layout; - clfftLayout new_output_layout = _input_layout; - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( *plan_handle, new_input_layout, new_output_layout ) ); - get_layouts(); - - refresh_plan(); - } - - /*****************************************************/ - clfftLayout input_layout() { - get_layouts(); - return _input_layout; - } - - /*****************************************************/ - clfftLayout output_layout() { - get_layouts(); - return _output_layout; - } - - /*****************************************************/ - void forward_scale( T in ) { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( *plan_handle, CLFFT_FORWARD, static_cast( in ) ) ); - _forward_scale = forward_scale(); - } - - /*****************************************************/ - void backward_scale( T in ) { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( *plan_handle, CLFFT_BACKWARD, static_cast( in ) ) ); - _backward_scale = backward_scale(); - } - - /*****************************************************/ - T forward_scale() { - cl_T scale; - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( *plan_handle, CLFFT_FORWARD, reinterpret_cast(&scale) )); - return scale; - } - - /*****************************************************/ - T backward_scale() { - cl_T scale; - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( *plan_handle, CLFFT_BACKWARD, reinterpret_cast(&scale) )); - return scale; - } - - /*****************************************************/ - void set_input_to_value( T real ) - { - input.set_all_to_value( real ); - } - - /*****************************************************/ - void set_input_to_value( T real, T imag ) - { - input.set_all_to_value( real, imag ); - } - - /*****************************************************/ - void set_input_to_sawtooth(T max) { - input.set_all_to_sawtooth(max); - } - - /*****************************************************/ - void set_input_to_impulse() { - input.set_all_to_impulse(); - } - - /*****************************************************/ - // yes, the "super duper global seed" is horrible - // alas, i'll have TODO it better later - void set_input_to_random() - { - input.set_all_to_random_data( 10, super_duper_global_seed ); - } - - /*****************************************************/ - void set_input_to_buffer( buffer other_buffer ) { - input = other_buffer; - } - - /*****************************************************/ - void set_input_precallback(unsigned int localMemSize = 0) { - cl_int status = 0; - clfftPrecision precision; - clfftGetPlanPrecision( *plan_handle, &precision ); - - const char* precallbackstr; - - if (localMemSize > 0) - { - //Test for LDS in precallback function - precallbackstr = STRINGIFY(PRE_MULVAL_LDS); - } - else - { - if (input.is_interleaved() ) - { - precallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(PRE_MULVAL) : STRINGIFY(PRE_MULVAL_DP); - } - else if (input.is_planar()) - { - precallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(PRE_MULVAL_PLANAR) : STRINGIFY(PRE_MULVAL_PLANAR_DP); - } - else if (input.is_real()) - { - precallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(PRE_MULVAL_REAL) : STRINGIFY(PRE_MULVAL_REAL_DP); - } - } - - //precallback user data - buffer userdata( static_cast(dimension), - input.lengths(), - input.strides(), - input.batch_size(), - input.distance(), - layout::real, - _placeness - ); - - userdata.set_all_to_random_data(lengths[0], 10); - - // make the new buffer - const size_t bufferSizeBytes = userdata.size_in_bytes( ); - - std::unique_ptr< _cl_mem, clMem_deleter > userdataBuff( clCreateBuffer( context.get( ), CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, - bufferSizeBytes, userdata.real_ptr(), &status) ); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - - userDataPreMem = std::move(userdataBuff); - cl_mem uptr = userDataPreMem.get(); - - //Register the callback - OPENCL_V_THROW (clfftSetPlanCallback(*plan_handle, "mulval_pre", precallbackstr, localMemSize, PRECALLBACK, &uptr, 1), "clFFTSetPlanCallback failed"); - } - - /*****************************************************/ - void set_input_precallback_userdatatype() { - cl_int status = 0; - - const char* precallbackstr = STRINGIFY(PRE_MULVAL_UDT); - - size_t totalPts = input.total_number_of_points_including_data_and_intervening(); - - buffer temp( static_cast(dimension), - input.lengths(), - input.strides(), - input.batch_size(), - input.distance(), - layout::real, - _placeness - ); - - temp.set_all_to_random_data(lengths[0], 10); - - std::vector userdata(totalPts); - size_t the_index; - for( size_t batch = 0; batch < input.batch_size(); batch++) - for( size_t z = 0; z < input.length(dimz); z++) - for( size_t y = 0; y < input.length(dimy); y++) - for( size_t x = 0; x < input.length(dimx); x++) - { - the_index = ( input.stride(dimx) * x + input.stride(dimy) * y + input.stride(dimz) * z + input.distance() * batch ); - - userdata[the_index].scalar1 = (float)temp.real(x, y, z, batch); - userdata[the_index].scalar2 = 1; - } - - std::unique_ptr< _cl_mem, clMem_deleter > userdataBuff( clCreateBuffer(context.get(), CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, - sizeof(USER_DATA) * totalPts, (void*)&userdata[0], &status) ); - OPENCL_V_THROW( status, "Creating Buffer ( ::clCreateBuffer() )" ); - - userDataPreMem = std::move(userdataBuff); - cl_mem uptr = userDataPreMem.get(); - - //Register the callback - OPENCL_V_THROW (clfftSetPlanCallback(*plan_handle, "mulval_pre", precallbackstr, 0, PRECALLBACK, &uptr, 1), "clFFTSetPlanCallback failed"); - } - - /*****************************************************/ - void set_output_postcallback(unsigned int localMemSize = 0) { - cl_int status = 0; - clfftPrecision precision; - clfftGetPlanPrecision( *plan_handle, &precision ); - - const char* postcallbackstr; - - if (localMemSize > 0) - { - //Test for LDS in postcallback function - postcallbackstr = STRINGIFY(POST_MULVAL_LDS); - } - else - { - if (output.is_interleaved() ) - { - postcallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(POST_MULVAL) : STRINGIFY(POST_MULVAL_DP); - } - else if (output.is_planar()) - { - postcallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(POST_MULVAL_PLANAR) : STRINGIFY(POST_MULVAL_PLANAR_DP); - } - else if (output.is_real()) - { - postcallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(POST_MULVAL_REAL) : STRINGIFY(POST_MULVAL_REAL_DP); - } - } - - //post-callback user data - buffer userdata( static_cast(dimension), - output.lengths(), - output.strides(), - output.batch_size(), - output.distance(), - layout::real, - _placeness - ); - - userdata.set_all_to_random_data(lengths[0], 10); - - // make the new buffer - const size_t bufferSizeBytes = userdata.size_in_bytes( ); - - std::unique_ptr< _cl_mem, clMem_deleter > userdataBuff(clCreateBuffer(context.get(), CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, - bufferSizeBytes, userdata.real_ptr(), &status)); - OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); - - userDataPostMem = std::move(userdataBuff); - cl_mem uptr = userDataPostMem.get(); - - //Register the post-callback - OPENCL_V_THROW (clfftSetPlanCallback(*plan_handle, "mulval_post", postcallbackstr, localMemSize, POSTCALLBACK, &uptr, 1), "clFFTSetPlanCallback failed"); - } - - /*****************************************************/ - bool device_list_has_devices() { - return !device_id.empty(); - } - - /*****************************************************/ - // returns true if the memory required for input + output (if applicable) + intermediate (if applicable) buffers - // is too large compared with the OpenCL device's memory size - bool total_memory_footprint_is_too_large_for_device() { - throw_if_device_list_is_empty(); - - // In order to call clfftEnqueueTransform, we need to pass naked pointers - cl_command_queue tempQueue = queue.get( ); - size_t buffer_size = 0; - - EXPECT_EQ( CLFFT_SUCCESS, clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL )); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetTmpBufSize(*plan_handle, &buffer_size )); - - cl_ulong total_memory_size = input.size_in_bytes() + buffer_size; - - // we are only going to include the result space if the transform is out of place - if( placeness() == CLFFT_OUTOFPLACE ) - { - total_memory_size += output.size_in_bytes(); - } - - cl_ulong global_memory_size = cl_device_max_global_memory(0); - - // we don't want to bog down the CPU with ginormous problem sizes - // so we chop the global memory way down to keep things manageable - if( g_device_type == CL_DEVICE_TYPE_CPU ) - { - global_memory_size /= 8; - } - - return total_memory_size > global_memory_size; - } - - /*****************************************************/ - void throw_if_total_memory_footprint_is_too_large_for_device() - { - if( total_memory_footprint_is_too_large_for_device() ) - { - throw std::runtime_error("problem too large for device"); - } - } - - /*****************************************************/ - void throw_if_device_list_is_empty() - { - if( !device_list_has_devices() ) { - throw std::runtime_error("device list is empty at transform"); - } - } - - /*****************************************************/ - void transform(bool explicit_intermediate_buffer = use_explicit_intermediate_buffer) { - verbose_output(); - - throw_if_device_list_is_empty(); - - cl_int status; - - // In order to call clfftEnqueueTransform, we need to pass naked pointers - cl_command_queue tempQueue = queue.get( ); - std::unique_ptr< _cl_event, clEvent_deleter > tempEvent; - std::unique_ptr< _cl_mem, clMem_deleter > intermediate_buffer; - - throw_if_total_memory_footprint_is_too_large_for_device(); - - write_local_input_buffer_to_gpu(); - if( placeness() == CLFFT_OUTOFPLACE ) - write_local_output_buffer_to_gpu(); - - try - { - size_t buffer_size = 0; - EXPECT_EQ( CLFFT_SUCCESS, clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL )); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetTmpBufSize(*plan_handle, &buffer_size )); - - if( explicit_intermediate_buffer ) - { - // the buffer size is already stashed above - // now we want to make the intermediate buffer to pass in (if necessary) - if (buffer_size) - { - // because unique_ptrs are funky, we have to create a temp_buffer - // and then std::move it to the intermediate_buffer - std::unique_ptr< _cl_mem, clMem_deleter > temp_buffer( - ::clCreateBuffer( context.get( ), - CL_MEM_READ_WRITE, - buffer_size, - NULL, - &status) ); - OPENCL_V_THROW( status, "Creating intermediate Buffer ( ::clCreateBuffer() )" ); - - intermediate_buffer = std::move( temp_buffer ); - } - } - - cl_mem tempInput[2]; - cl_mem tempOutput[2]; - for( cl_uint i = 0; i < cl_mem_input.size( ); ++i ) - tempInput[ i ] = cl_mem_input[ i ].get( ); - - for( cl_uint i = 0; i < cl_mem_output.size( ); ++i ) - tempOutput[ i ] = cl_mem_output[ i ].get( ); - - cl_event tevent = NULL; - if( buffer_size ) - { - status = clfftEnqueueTransform(*plan_handle, - _transformation_direction, - 1, - &tempQueue, - 0, - NULL, - &tevent, - &tempInput[ 0 ], - &tempOutput[ 0 ], - intermediate_buffer.get() ); - } - else - { - status = clfftEnqueueTransform(*plan_handle, - _transformation_direction, - 1, - &tempQueue, - 0, - NULL, - &tevent, - &tempInput[ 0 ], - &tempOutput[ 0 ], - NULL ); - } - clFinish(tempQueue); - tempEvent.reset(tevent); tevent = NULL; - - if( status != CLFFT_SUCCESS ) - { - throw std::runtime_error(prettyPrintclFFTStatus(status).c_str()); - } - - // wait for the kernel call to finish execution - const cl_event revent = tempEvent.get(); - cl_int wait_status = clWaitForEvents(1, &revent); - if( wait_status == CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST ) - { - cl_int error_code; - clGetEventInfo( revent, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(cl_int), &error_code, NULL ); - throw std::runtime_error(prettyPrintclFFTStatus(error_code).c_str()); - } - else if( wait_status != CL_SUCCESS ) - { - throw std::runtime_error(prettyPrintclFFTStatus(wait_status).c_str()); - } - } - catch (const std::exception& ) { - std::cout << "Exception occurred during clfftEnqueueTransform" - << __FILE__ << __LINE__ << std::endl; - throw; - } - - if( in_place() ) { - capture_input(); - } - else { - capture_output(); - } - - get_layouts(); - if( placeness() == CLFFT_INPLACE ) - { - if( is_real( _input_layout ) && is_hermitian( _output_layout ) ) - { - input.change_real_to_hermitian( output.strides(), output.distance() ); - } - else if( is_hermitian( _input_layout ) && is_real( _output_layout ) ) - { - input.change_hermitian_to_real( output.strides(), output.distance() ); - } - } - - // there's no way to know if in-place transforms have written in bad places, - // because depending on input and output strides, the state of the memory - // between points is not necessarily the NaN that we set it to - if( _placeness != CLFFT_INPLACE ) - { - input.make_sure_padding_was_not_overwritten(); - output.make_sure_padding_was_not_overwritten(); - } - } - - /*****************************************************/ - size_t maximum_problem_size() { - int device_index = 0; - //N.B. if this class ever needs to support more than one device at once - //(i.e., multiple GPUs or CPU+GPU), device index will need to be variable - //to choose the device of interest - return cl_device_max_memory_to_allocate(device_index)/(sizeof(T)*2); - //TODO *2 needs to be either *1 or *2, depending, once real numbers are implemented in clfft - } - - /*****************************************************/ - size_t number_of_opencl_devices() { - return device_id.size(); - } - - - /*****************************************************/ - bool initialize_failed() { - return init_failure; - } - - /*****************************************************/ - bool dataset_is_too_large_for_device() { - return dataset_too_large; - } - - /*****************************************************/ - buffer & input_buffer() - { - return input; - } - - /*****************************************************/ - buffer & output_buffer() - { - return output; - } - - /*****************************************************/ - buffer & result() - { - if( placeness() == CLFFT_INPLACE ) - return input; - else if( placeness() == CLFFT_OUTOFPLACE ) - return output; - else - throw std::runtime_error( "invalid placeness" ); - } + /*****************************************************/ + clfft(const clfftDim dimensions_in, const size_t *lengths_in, + const size_t *input_strides_in, const size_t *output_strides_in, + const size_t batch_size_in, const size_t input_distance_in, + const size_t output_distance_in, const clfftLayout input_layout_in, + const clfftLayout output_layout_in, + const clfftResultLocation placeness_in) try + : _input_layout(input_layout_in), _output_layout(output_layout_in), + _placeness(placeness_in), + input(static_cast(dimensions_in), lengths_in, input_strides_in, + batch_size_in, input_distance_in, + cl_layout_to_buffer_layout(_input_layout), _placeness), + output(static_cast(dimensions_in), lengths_in, + output_strides_in, batch_size_in, output_distance_in, + cl_layout_to_buffer_layout(_output_layout), _placeness), + number_of_data_points(input.number_of_data_points()), + _forward_scale(1.0f), _backward_scale(1.0f / T(number_of_data_points)), + commandQueueFlags(0), init_failure(false), dataset_too_large(false), + deviceType(0), plan_handle(new clfftPlanHandle), + _transformation_direction(ENDDIRECTION), dimension(dimensions_in) + + { + if (_placeness == CLFFT_INPLACE) { + if ((is_real(_input_layout) && is_planar(_output_layout)) || + (is_planar(_input_layout) && is_real(_output_layout))) { + throw std::runtime_error( + "in-place transforms may not be real<->planar"); + } + } + + *plan_handle = 0; + clfftSetupData setupData; + clfftInitSetupData(&setupData); + clfftSetup(&setupData); + + for (int i = 0; i < max_dimension; i++) { + if (i < dimension) + lengths.push_back(lengths_in[i]); + else + lengths.push_back(1); + } + + initialize_openCL(); + initialize_plan(); + } catch (const std::exception &) { + throw; + } + + /*****************************************************/ + ~clfft() {} + + /*****************************************************/ + bool is_real(const clfftLayout layout) { return layout == CLFFT_REAL; } + + /*****************************************************/ + bool is_planar(const clfftLayout layout) { + return (layout == CLFFT_COMPLEX_PLANAR || layout == CLFFT_HERMITIAN_PLANAR); + } + + /*****************************************************/ + bool is_interleaved(const clfftLayout layout) { + return (layout == CLFFT_COMPLEX_INTERLEAVED || + layout == CLFFT_HERMITIAN_INTERLEAVED); + } + + /*****************************************************/ + bool is_complex(const clfftLayout layout) { + return (layout == CLFFT_COMPLEX_INTERLEAVED || + layout == CLFFT_COMPLEX_PLANAR); + } + + /*****************************************************/ + bool is_hermitian(const clfftLayout layout) { + return (layout == CLFFT_HERMITIAN_INTERLEAVED || + layout == CLFFT_HERMITIAN_PLANAR); + } + + /*****************************************************/ + void initialize_openCL() { + try { + cl_context tempContext = NULL; + device_id = initializeCL(g_device_type, g_device_id, g_platform_id, + tempContext, printInfo); + context = std::unique_ptr<_cl_context, clContext_deleter>(tempContext); + + if (input.size_in_bytes() > cl_device_max_memory_to_allocate(0) || + output.size_in_bytes() > cl_device_max_memory_to_allocate(0)) { + throw std::runtime_error("problem too large for device"); + } + + cl_int status = 0; + queue = std::unique_ptr<_cl_command_queue, clCommQueue_deleter>( + ::clCreateCommandQueue(context.get(), device_id[0], commandQueueFlags, + &status)); + OPENCL_V_THROW(status, + "Creating Command Queue ( ::clCreateCommandQueue() )"); + + // make the new buffer + const size_t bufferSizeBytes = input.size_in_bytes(); + + for (cl_int i = 0; i < CLFFT_COMPLEX_INTERLEAVED; ++i) { + cl_int status = 0; + std::unique_ptr<_cl_mem, clMem_deleter> inBuff(::clCreateBuffer( + context.get(), CL_MEM_READ_WRITE, bufferSizeBytes, NULL, &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + cl_mem_input.push_back(std::move(inBuff)); + + std::unique_ptr<_cl_mem, clMem_deleter> outBuff(::clCreateBuffer( + context.get(), CL_MEM_READ_WRITE, bufferSizeBytes, NULL, &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + cl_mem_output.push_back(std::move(outBuff)); + } + } catch (const std::exception &) { + throw; + } + } + + /*****************************************************/ + void initialize_plan() { + EXPECT_EQ(CLFFT_SUCCESS, + clfftCreateDefaultPlan(plan_handle.get(), context.get(), + dimension, &lengths[0])); + set_layouts(_input_layout, _output_layout); + placeness(_placeness); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(*plan_handle, dimension, input.strides())); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(*plan_handle, dimension, output.strides())); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanBatchSize(*plan_handle, input.batch_size())); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanDistance(*plan_handle, input.distance(), + output.distance())); + Precision_Setter setter(*plan_handle); + } + + /*****************************************************/ + std::string input_strides_plaintext() { + size_t strides[3]; + clfftGetPlanInStride(*plan_handle, dimension, &strides[0]); + + std::ostringstream my_strides_stream; + + for (int i = 0; i < dimension; i++) + my_strides_stream << strides[i] << " "; + + std::string my_strides(my_strides_stream.str()); + my_strides.erase(my_strides.end() - 1); // chomp off trailing space + + return my_strides; + } + + /*****************************************************/ + std::string output_strides_plaintext() { + size_t strides[3]; + clfftGetPlanOutStride(*plan_handle, dimension, &strides[0]); + + std::ostringstream my_strides_stream; + + for (int i = 0; i < dimension; i++) + my_strides_stream << strides[i] << " "; + + std::string my_strides(my_strides_stream.str()); + my_strides.erase(my_strides.end() - 1); // chomp off trailing space + + return my_strides; + } + + /*****************************************************/ + std::string lengths_plaintext() { + size_t lengths[3]; + clfftGetPlanLength(*plan_handle, dimension, &lengths[0]); + + std::ostringstream my_lengths_stream; + + for (int i = 0; i < dimension; i++) + my_lengths_stream << lengths[i] << " "; + + std::string my_lengths(my_lengths_stream.str()); + my_lengths.erase(my_lengths.end() - 1); // chomp off trailing space + + return my_lengths; + } + + /*****************************************************/ + std::string layout_plaintext(clfftLayout layout) { + switch (layout) { + case CLFFT_REAL: + return "real"; + case CLFFT_HERMITIAN_INTERLEAVED: + return "hermitian interleaved"; + case CLFFT_HERMITIAN_PLANAR: + return "hermitian planar"; + case CLFFT_COMPLEX_INTERLEAVED: + return "complex interleaved"; + case CLFFT_COMPLEX_PLANAR: + return "complex planar"; + default: + throw std::runtime_error("invalid layout in layout_plaintext()"); + } + } + + /*****************************************************/ + void refresh_plan() { + clfftDestroyPlan(plan_handle.get()); + initialize_plan(); + } + + /*****************************************************/ + layout::buffer_layout_t cl_layout_to_buffer_layout(clfftLayout cl_layout) { + if (cl_layout == CLFFT_REAL) + return layout::real; + else if (cl_layout == CLFFT_HERMITIAN_PLANAR) + return layout::hermitian_planar; + else if (cl_layout == CLFFT_COMPLEX_PLANAR) + return layout::complex_planar; + else if (cl_layout == CLFFT_HERMITIAN_INTERLEAVED) + return layout::hermitian_interleaved; + else if (cl_layout == CLFFT_COMPLEX_INTERLEAVED) + return layout::complex_interleaved; + else + throw std::runtime_error("invalid cl_layout"); + } + + /*****************************************************/ + void verbose_output() { + if (verbose) { + std::cout << "transform parameters as seen by clfft:" << std::endl; + + clfftDim dim; + cl_uint dimensions; + clfftGetPlanDim(*plan_handle, &dim, &dimensions); + + std::cout << dimensions << " dimension(s): " << lengths_plaintext() + << std::endl; + + size_t batch; + clfftGetPlanBatchSize(*plan_handle, &batch); + std::cout << "batch: " << batch << std::endl; + + clfftPrecision precision; + clfftGetPlanPrecision(*plan_handle, &precision); + if (precision == CLFFT_SINGLE) + std::cout << "single precision" << std::endl; + else if (precision == CLFFT_DOUBLE) + std::cout << "double precision" << std::endl; + else + throw std::runtime_error( + "can't figure out the precision in verbose_output()"); + + if (placeness() == CLFFT_INPLACE) + std::cout << "in-place" << std::endl; + else + std::cout << "out-of-place" << std::endl; + + get_layouts(); + std::cout << layout_plaintext(_input_layout) << " -> " + << layout_plaintext(_output_layout) << std::endl; + + std::cout << "input stride(s): " << input_strides_plaintext() + << std::endl; + std::cout << "output stride(s): " << output_strides_plaintext() + << std::endl; + + size_t input_distance, output_distance; + clfftGetPlanDistance(*plan_handle, &input_distance, &output_distance); + std::cout << "input distance: " << input_distance << std::endl; + std::cout << "output distance: " << output_distance << std::endl; + } + } + + /*****************************************************/ + clfftResultLocation placeness() { + clfftResultLocation res; + EXPECT_EQ(CLFFT_SUCCESS, clfftGetResultLocation(*plan_handle, &res)); + return res; + } + + /*****************************************************/ + void set_forward_transform() { _transformation_direction = CLFFT_FORWARD; } + + /*****************************************************/ + void set_backward_transform() { _transformation_direction = CLFFT_BACKWARD; } + + /*****************************************************/ + void set_transposed() { + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanTransposeResult(*plan_handle, CLFFT_TRANSPOSED)); + } + + /*****************************************************/ + void set_layouts(clfftLayout new_input_layout, + clfftLayout new_output_layout) { + cl_mem_input.clear(); + cl_mem_output.clear(); + + // make the new input buffer + const size_t input_buffer_size_in_bytes = input.size_in_bytes(); + + size_t number_of_input_buffers; + + if (is_planar(new_input_layout)) + number_of_input_buffers = 2; + else if (is_real(new_input_layout) || is_interleaved(new_input_layout)) + number_of_input_buffers = 1; + else + throw std::runtime_error( + "we shouldn't make it here [set_layouts(), input]"); + + for (size_t i = 0; i < number_of_input_buffers; ++i) { + cl_int status = 0; + std::unique_ptr<_cl_mem, clMem_deleter> buff( + ::clCreateBuffer(context.get(), CL_MEM_READ_WRITE, + input_buffer_size_in_bytes, NULL, &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + cl_mem_input.push_back(std::move(buff)); + } + + // make the new output buffer + const size_t output_buffer_size_in_bytes = output.size_in_bytes(); + + size_t number_of_output_buffers; + + if (is_planar(new_output_layout)) + number_of_output_buffers = 2; + else if (is_real(new_output_layout) || is_interleaved(new_output_layout)) + number_of_output_buffers = 1; + else + throw std::runtime_error( + "we shouldn't make it here [set_layouts(), input]"); + + for (size_t i = 0; i < number_of_output_buffers; ++i) { + cl_int status = 0; + std::unique_ptr<_cl_mem, clMem_deleter> buff( + ::clCreateBuffer(context.get(), CL_MEM_READ_WRITE, + output_buffer_size_in_bytes, NULL, &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + cl_mem_output.push_back(std::move(buff)); + } + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetLayout(*plan_handle, new_input_layout, + new_output_layout)); + get_layouts(); + } + + /*****************************************************/ + // swap_layouts should only be used with in-place real-to-complex or + // complex-to-real transforms + void swap_layouts() { + get_layouts(); + clfftLayout new_input_layout = _output_layout; + clfftLayout new_output_layout = _input_layout; + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetLayout(*plan_handle, new_input_layout, + new_output_layout)); + get_layouts(); + + refresh_plan(); + } + + /*****************************************************/ + clfftLayout input_layout() { + get_layouts(); + return _input_layout; + } + + /*****************************************************/ + clfftLayout output_layout() { + get_layouts(); + return _output_layout; + } + + /*****************************************************/ + void forward_scale(T in) { + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(*plan_handle, CLFFT_FORWARD, + static_cast(in))); + _forward_scale = forward_scale(); + } + + /*****************************************************/ + void backward_scale(T in) { + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(*plan_handle, CLFFT_BACKWARD, + static_cast(in))); + _backward_scale = backward_scale(); + } + + /*****************************************************/ + T forward_scale() { + cl_T scale; + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanScale(*plan_handle, CLFFT_FORWARD, + reinterpret_cast(&scale))); + return scale; + } + + /*****************************************************/ + T backward_scale() { + cl_T scale; + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanScale(*plan_handle, CLFFT_BACKWARD, + reinterpret_cast(&scale))); + return scale; + } + + /*****************************************************/ + void set_input_to_value(T real) { input.set_all_to_value(real); } + + /*****************************************************/ + void set_input_to_value(T real, T imag) { + input.set_all_to_value(real, imag); + } + + /*****************************************************/ + void set_input_to_sawtooth(T max) { input.set_all_to_sawtooth(max); } + + /*****************************************************/ + void set_input_to_impulse() { input.set_all_to_impulse(); } + + /*****************************************************/ + // yes, the "super duper global seed" is horrible + // alas, i'll have TODO it better later + void set_input_to_random() { + input.set_all_to_random_data(10, super_duper_global_seed); + } + + /*****************************************************/ + void set_input_to_buffer(buffer other_buffer) { input = other_buffer; } + + /*****************************************************/ + void set_input_precallback(unsigned int localMemSize = 0) { + cl_int status = 0; + clfftPrecision precision; + clfftGetPlanPrecision(*plan_handle, &precision); + + const char *precallbackstr; + + if (localMemSize > 0) { + // Test for LDS in precallback function + precallbackstr = STRINGIFY(PRE_MULVAL_LDS); + } else { + if (input.is_interleaved()) { + precallbackstr = (precision == CLFFT_SINGLE) ? STRINGIFY(PRE_MULVAL) + : STRINGIFY(PRE_MULVAL_DP); + } else if (input.is_planar()) { + precallbackstr = (precision == CLFFT_SINGLE) + ? STRINGIFY(PRE_MULVAL_PLANAR) + : STRINGIFY(PRE_MULVAL_PLANAR_DP); + } else if (input.is_real()) { + precallbackstr = (precision == CLFFT_SINGLE) + ? STRINGIFY(PRE_MULVAL_REAL) + : STRINGIFY(PRE_MULVAL_REAL_DP); + } + } + + // precallback user data + buffer userdata(static_cast(dimension), input.lengths(), + input.strides(), input.batch_size(), input.distance(), + layout::real, _placeness); + + userdata.set_all_to_random_data(lengths[0], 10); + + // make the new buffer + const size_t bufferSizeBytes = userdata.size_in_bytes(); + + std::unique_ptr<_cl_mem, clMem_deleter> userdataBuff( + clCreateBuffer(context.get(), CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + bufferSizeBytes, userdata.real_ptr(), &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + userDataPreMem = std::move(userdataBuff); + cl_mem uptr = userDataPreMem.get(); + + // Register the callback + OPENCL_V_THROW(clfftSetPlanCallback(*plan_handle, "mulval_pre", + precallbackstr, localMemSize, + PRECALLBACK, &uptr, 1), + "clFFTSetPlanCallback failed"); + } + + /*****************************************************/ + void set_input_precallback_userdatatype() { + cl_int status = 0; + + const char *precallbackstr = STRINGIFY(PRE_MULVAL_UDT); + + size_t totalPts = + input.total_number_of_points_including_data_and_intervening(); + + buffer temp(static_cast(dimension), input.lengths(), + input.strides(), input.batch_size(), input.distance(), + layout::real, _placeness); + + temp.set_all_to_random_data(lengths[0], 10); + + std::vector userdata(totalPts); + size_t the_index; + for (size_t batch = 0; batch < input.batch_size(); batch++) + for (size_t z = 0; z < input.length(dimz); z++) + for (size_t y = 0; y < input.length(dimy); y++) + for (size_t x = 0; x < input.length(dimx); x++) { + the_index = (input.stride(dimx) * x + input.stride(dimy) * y + + input.stride(dimz) * z + input.distance() * batch); + + userdata[the_index].scalar1 = (float)temp.real(x, y, z, batch); + userdata[the_index].scalar2 = 1; + } + + std::unique_ptr<_cl_mem, clMem_deleter> userdataBuff(clCreateBuffer( + context.get(), CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + sizeof(USER_DATA) * totalPts, (void *)&userdata[0], &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + userDataPreMem = std::move(userdataBuff); + cl_mem uptr = userDataPreMem.get(); + + // Register the callback + OPENCL_V_THROW(clfftSetPlanCallback(*plan_handle, "mulval_pre", + precallbackstr, 0, PRECALLBACK, &uptr, + 1), + "clFFTSetPlanCallback failed"); + } + + /*****************************************************/ + void set_output_postcallback(unsigned int localMemSize = 0) { + cl_int status = 0; + clfftPrecision precision; + clfftGetPlanPrecision(*plan_handle, &precision); + + const char *postcallbackstr; + + if (localMemSize > 0) { + // Test for LDS in postcallback function + postcallbackstr = STRINGIFY(POST_MULVAL_LDS); + } else { + if (output.is_interleaved()) { + postcallbackstr = (precision == CLFFT_SINGLE) + ? STRINGIFY(POST_MULVAL) + : STRINGIFY(POST_MULVAL_DP); + } else if (output.is_planar()) { + postcallbackstr = (precision == CLFFT_SINGLE) + ? STRINGIFY(POST_MULVAL_PLANAR) + : STRINGIFY(POST_MULVAL_PLANAR_DP); + } else if (output.is_real()) { + postcallbackstr = (precision == CLFFT_SINGLE) + ? STRINGIFY(POST_MULVAL_REAL) + : STRINGIFY(POST_MULVAL_REAL_DP); + } + } + + // post-callback user data + buffer userdata(static_cast(dimension), output.lengths(), + output.strides(), output.batch_size(), output.distance(), + layout::real, _placeness); + + userdata.set_all_to_random_data(lengths[0], 10); + + // make the new buffer + const size_t bufferSizeBytes = userdata.size_in_bytes(); + + std::unique_ptr<_cl_mem, clMem_deleter> userdataBuff( + clCreateBuffer(context.get(), CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + bufferSizeBytes, userdata.real_ptr(), &status)); + OPENCL_V_THROW(status, "Creating Buffer ( ::clCreateBuffer() )"); + + userDataPostMem = std::move(userdataBuff); + cl_mem uptr = userDataPostMem.get(); + + // Register the post-callback + OPENCL_V_THROW(clfftSetPlanCallback(*plan_handle, "mulval_post", + postcallbackstr, localMemSize, + POSTCALLBACK, &uptr, 1), + "clFFTSetPlanCallback failed"); + } + + /*****************************************************/ + bool device_list_has_devices() { return !device_id.empty(); } + + /*****************************************************/ + // returns true if the memory required for input + output (if applicable) + + // intermediate (if applicable) buffers is too large compared with the OpenCL + // device's memory size + bool total_memory_footprint_is_too_large_for_device() { + throw_if_device_list_is_empty(); + + // In order to call clfftEnqueueTransform, we need to pass naked pointers + cl_command_queue tempQueue = queue.get(); + size_t buffer_size = 0; + + EXPECT_EQ(CLFFT_SUCCESS, + clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetTmpBufSize(*plan_handle, &buffer_size)); + + cl_ulong total_memory_size = input.size_in_bytes() + buffer_size; + + // we are only going to include the result space if the transform is out of + // place + if (placeness() == CLFFT_OUTOFPLACE) { + total_memory_size += output.size_in_bytes(); + } + + cl_ulong global_memory_size = cl_device_max_global_memory(0); + + // we don't want to bog down the CPU with ginormous problem sizes + // so we chop the global memory way down to keep things manageable + if (g_device_type == CL_DEVICE_TYPE_CPU) { + global_memory_size /= 8; + } + + return total_memory_size > global_memory_size; + } + + /*****************************************************/ + void throw_if_total_memory_footprint_is_too_large_for_device() { + if (total_memory_footprint_is_too_large_for_device()) { + throw std::runtime_error("problem too large for device"); + } + } + + /*****************************************************/ + void throw_if_device_list_is_empty() { + if (!device_list_has_devices()) { + throw std::runtime_error("device list is empty at transform"); + } + } + + /*****************************************************/ + void transform( + bool explicit_intermediate_buffer = use_explicit_intermediate_buffer) { + verbose_output(); + + throw_if_device_list_is_empty(); + + cl_int status; + + // In order to call clfftEnqueueTransform, we need to pass naked pointers + cl_command_queue tempQueue = queue.get(); + std::unique_ptr<_cl_event, clEvent_deleter> tempEvent; + std::unique_ptr<_cl_mem, clMem_deleter> intermediate_buffer; + + throw_if_total_memory_footprint_is_too_large_for_device(); + + write_local_input_buffer_to_gpu(); + if (placeness() == CLFFT_OUTOFPLACE) + write_local_output_buffer_to_gpu(); + + try { + size_t buffer_size = 0; + EXPECT_EQ(CLFFT_SUCCESS, + clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetTmpBufSize(*plan_handle, &buffer_size)); + + if (explicit_intermediate_buffer) { + // the buffer size is already stashed above + // now we want to make the intermediate buffer to pass in (if necessary) + if (buffer_size) { + // because unique_ptrs are funky, we have to create a temp_buffer + // and then std::move it to the intermediate_buffer + std::unique_ptr<_cl_mem, clMem_deleter> temp_buffer(::clCreateBuffer( + context.get(), CL_MEM_READ_WRITE, buffer_size, NULL, &status)); + OPENCL_V_THROW(status, + "Creating intermediate Buffer ( ::clCreateBuffer() )"); + + intermediate_buffer = std::move(temp_buffer); + } + } + + cl_mem tempInput[2]; + cl_mem tempOutput[2]; + for (cl_uint i = 0; i < cl_mem_input.size(); ++i) + tempInput[i] = cl_mem_input[i].get(); + + for (cl_uint i = 0; i < cl_mem_output.size(); ++i) + tempOutput[i] = cl_mem_output[i].get(); + + cl_event tevent = NULL; + if (buffer_size) { + status = clfftEnqueueTransform( + *plan_handle, _transformation_direction, 1, &tempQueue, 0, NULL, + &tevent, &tempInput[0], &tempOutput[0], intermediate_buffer.get()); + } else { + status = clfftEnqueueTransform(*plan_handle, _transformation_direction, + 1, &tempQueue, 0, NULL, &tevent, + &tempInput[0], &tempOutput[0], NULL); + } + clFinish(tempQueue); + tempEvent.reset(tevent); + tevent = NULL; + + if (status != CLFFT_SUCCESS) { + throw std::runtime_error(prettyPrintclFFTStatus(status).c_str()); + } + + // wait for the kernel call to finish execution + const cl_event revent = tempEvent.get(); + cl_int wait_status = clWaitForEvents(1, &revent); + if (wait_status == CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST) { + cl_int error_code; + clGetEventInfo(revent, CL_EVENT_COMMAND_EXECUTION_STATUS, + sizeof(cl_int), &error_code, NULL); + throw std::runtime_error(prettyPrintclFFTStatus(error_code).c_str()); + } else if (wait_status != CL_SUCCESS) { + throw std::runtime_error(prettyPrintclFFTStatus(wait_status).c_str()); + } + } catch (const std::exception &) { + std::cout << "Exception occurred during clfftEnqueueTransform" << __FILE__ + << __LINE__ << std::endl; + throw; + } + + if (in_place()) { + capture_input(); + } else { + capture_output(); + } + + get_layouts(); + if (placeness() == CLFFT_INPLACE) { + if (is_real(_input_layout) && is_hermitian(_output_layout)) { + input.change_real_to_hermitian(output.strides(), output.distance()); + } else if (is_hermitian(_input_layout) && is_real(_output_layout)) { + input.change_hermitian_to_real(output.strides(), output.distance()); + } + } + + // there's no way to know if in-place transforms have written in bad places, + // because depending on input and output strides, the state of the memory + // between points is not necessarily the NaN that we set it to + if (_placeness != CLFFT_INPLACE) { + input.make_sure_padding_was_not_overwritten(); + output.make_sure_padding_was_not_overwritten(); + } + } + + /*****************************************************/ + size_t maximum_problem_size() { + int device_index = 0; + // N.B. if this class ever needs to support more than one device at once + //(i.e., multiple GPUs or CPU+GPU), device index will need to be variable + // to choose the device of interest + return cl_device_max_memory_to_allocate(device_index) / (sizeof(T) * 2); + // TODO *2 needs to be either *1 or *2, depending, once real numbers are + // implemented in clfft + } + + /*****************************************************/ + size_t number_of_opencl_devices() { return device_id.size(); } + + /*****************************************************/ + bool initialize_failed() { return init_failure; } + + /*****************************************************/ + bool dataset_is_too_large_for_device() { return dataset_too_large; } + + /*****************************************************/ + buffer &input_buffer() { return input; } + + /*****************************************************/ + buffer &output_buffer() { return output; } + + /*****************************************************/ + buffer &result() { + if (placeness() == CLFFT_INPLACE) + return input; + else if (placeness() == CLFFT_OUTOFPLACE) + return output; + else + throw std::runtime_error("invalid placeness"); + } private: - /*****************************************************/ - void get_layouts() { - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( *plan_handle, &_input_layout, &_output_layout ) ); - } - - /*****************************************************/ - // after transform() is run: - // if in-place transformation -- the results will be in the input buffer - // otherwise -- the results will be in the output buffer - void placeness( clfftResultLocation placeness ) - { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( *plan_handle, placeness ) ); - } - - /*****************************************************/ - bool in_place() { - clfftResultLocation placeness; - clfftGetResultLocation( *plan_handle, &placeness ); - return (placeness == CLFFT_INPLACE) ? true : false; - } - - /*****************************************************/ - void capture_output() { - if( is_planar( output_layout() ) ) { - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_output[REAL].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.real_ptr(), 0, NULL, NULL), "reading output buffer - planar real ( ::clEnqueueReadBuffer() )" ); - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_output[IMAG].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.imag_ptr(), 0, NULL, NULL), "reading output buffer - planar imaginary ( ::clEnqueueReadBuffer() )" ); - } - else if( is_interleaved( output_layout() ) ) { - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_output[0].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.interleaved_ptr(), 0, NULL, NULL), "reading output buffer - interleaved ( ::clEnqueueReadBuffer() )" ); - } - else if( is_real( output_layout() ) ) { - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_output[REAL].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.real_ptr(), 0, NULL, NULL), "reading output buffer - planar real ( ::clEnqueueReadBuffer() )" ); - } - else - { - throw std::runtime_error( "we shouldn't make it here [capture_output()]" ); - } - } - - /*****************************************************/ - void capture_input() { - if( is_planar( input_layout() ) ) { - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_input[REAL].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.real_ptr(), 0, NULL, NULL), "reading input buffer - planar real ( ::clEnqueueReadBuffer() )" ); - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_input[IMAG].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.imag_ptr(), 0, NULL, NULL), "reading input buffer - planar imaginary ( ::clEnqueueReadBuffer() )" ); - } - else if( is_interleaved ( input_layout() ) ) { - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_input[0].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.interleaved_ptr(), 0, NULL, NULL), "reading input buffer - interleaved ( ::clEnqueueReadBuffer() )" ); - } - else if( is_real( input_layout() ) ) { - OPENCL_V_THROW( clEnqueueReadBuffer( queue.get( ), cl_mem_input[REAL].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.real_ptr(), 0, NULL, NULL), "reading input buffer - planar real ( ::clEnqueueReadBuffer() )" ); - } - else - { - throw std::runtime_error( "we shouldn't make it here [capture_input()]" ); - } - } - - /*****************************************************/ - void write_local_output_buffer_to_gpu() { - if( is_planar( output_layout() ) ) { - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_output[REAL].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.real_ptr(), 0, NULL, NULL), "writing output buffer - planar real ( ::clEnqueueWriteBuffer() )" ); - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_output[IMAG].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.imag_ptr(), 0, NULL, NULL), "writing output buffer - planar imaginary ( ::clEnqueueWriteBuffer() )" ); - } - else if( is_interleaved ( output_layout() ) ) { - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_output[0].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.interleaved_ptr(), 0, NULL, NULL), "writing output buffer - interleaved ( ::clEnqueueWriteBuffer() )" ); - } - else if( is_real( output_layout() ) ) { - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_output[REAL].get( ), CL_TRUE, 0, - output.size_in_bytes(), output.real_ptr(), 0, NULL, NULL), "writing output buffer - planar real ( ::clEnqueueWriteBuffer() )" ); - } - else - { - throw std::runtime_error( "we shouldn't make it here [write_local_output_buffer_to_gpu()]" ); - } - } - - /*****************************************************/ - void write_local_input_buffer_to_gpu() { - if( is_planar( input_layout() ) ) { - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_input[REAL].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.real_ptr(), 0, NULL, NULL), "writing input buffer - planar real ( ::clEnqueueWriteBuffer() )" ); - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_input[IMAG].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.imag_ptr(), 0, NULL, NULL), "writing input buffer - planar imaginary ( ::clEnqueueWriteBuffer() )" ); - } - else if( is_interleaved( input_layout() ) ) { - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_input[0].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.interleaved_ptr(), 0, NULL, NULL), "writing input buffer - interleaved ( ::clEnqueueWriteBuffer() )" ); - } - else if( is_real( input_layout() ) ) { - OPENCL_V_THROW( clEnqueueWriteBuffer( queue.get( ), cl_mem_input[REAL].get( ), CL_TRUE, 0, - input.size_in_bytes(), input.real_ptr(), 0, NULL, NULL), "writing input buffer - planar real ( ::clEnqueueWriteBuffer() )" ); - } - else - { - throw std::runtime_error( "we shouldn't make it here [write_local_input_buffer_to_gpu()]" ); - } - } - - - /*****************************************************/ - cl_ulong cl_device_max_memory_to_allocate(size_t device_index) { - if( number_of_opencl_devices() == 0 || device_index > number_of_opencl_devices() ) - { - return 0; - } - else - { - cl_ulong device_max_to_allocate = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( device_id[device_index], CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( cl_ulong ), &device_max_to_allocate, NULL ), - "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( ::clGetDeviceInfo() )" ); - - return device_max_to_allocate; - } - } - - - /*****************************************************/ - cl_ulong cl_device_max_global_memory(size_t device_index) { - if( number_of_opencl_devices() == 0 || device_index > number_of_opencl_devices() ) - { - return 0; - } - else - { - cl_ulong global_mem_size = 0; - OPENCL_V_THROW( ::clGetDeviceInfo( device_id[device_index], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( cl_ulong ), &global_mem_size, NULL ), - "Getting CL_DEVICE_GLOBAL_MEM_SIZE device info ( ::clGetDeviceInfo() )" ); - - return global_mem_size; - } - } - - #if defined(PERSISTENT_PLANS_FEATURE_HAS_BEEN_DEFEATURED_WHICH_MEANS_IT_IS_NO_LONGER_A_FEATURE) - /*****************************************************/ - void write_plan_to_file(std::string filename) - { - cl_command_queue tempQueue = queue.get( ); - EXPECT_EQ( CLFFT_SUCCESS, clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL )); - // we need to make sure the plan is baked before we write it out, or we won't get any juicy binaries along with it - - clfftWritePlanToDisk(*plan_handle, filename.c_str()); - } - - /*****************************************************/ - void read_plan_from_file(std::string filename) - { - clfftReadPlanFromDisk( *plan_handle, filename.c_str() ); - - // if we've changed from the default for input and output layouts, we need to re-set the layouts to make sure buffers get set up completely - set_layouts( input_layout(), output_layout() ); - } - #endif + /*****************************************************/ + void get_layouts() { + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetLayout(*plan_handle, &_input_layout, &_output_layout)); + } + + /*****************************************************/ + // after transform() is run: + // if in-place transformation -- the results will be in the input buffer + // otherwise -- the results will be in the output buffer + void placeness(clfftResultLocation placeness) { + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(*plan_handle, placeness)); + } + + /*****************************************************/ + bool in_place() { + clfftResultLocation placeness; + clfftGetResultLocation(*plan_handle, &placeness); + return (placeness == CLFFT_INPLACE) ? true : false; + } + + /*****************************************************/ + void capture_output() { + if (is_planar(output_layout())) { + OPENCL_V_THROW( + clEnqueueReadBuffer(queue.get(), cl_mem_output[REAL].get(), CL_TRUE, + 0, output.size_in_bytes(), output.real_ptr(), 0, + NULL, NULL), + "reading output buffer - planar real ( ::clEnqueueReadBuffer() )"); + OPENCL_V_THROW(clEnqueueReadBuffer(queue.get(), cl_mem_output[IMAG].get(), + CL_TRUE, 0, output.size_in_bytes(), + output.imag_ptr(), 0, NULL, NULL), + "reading output buffer - planar imaginary ( " + "::clEnqueueReadBuffer() )"); + } else if (is_interleaved(output_layout())) { + OPENCL_V_THROW( + clEnqueueReadBuffer(queue.get(), cl_mem_output[0].get(), CL_TRUE, 0, + output.size_in_bytes(), output.interleaved_ptr(), + 0, NULL, NULL), + "reading output buffer - interleaved ( ::clEnqueueReadBuffer() )"); + } else if (is_real(output_layout())) { + OPENCL_V_THROW( + clEnqueueReadBuffer(queue.get(), cl_mem_output[REAL].get(), CL_TRUE, + 0, output.size_in_bytes(), output.real_ptr(), 0, + NULL, NULL), + "reading output buffer - planar real ( ::clEnqueueReadBuffer() )"); + } else { + throw std::runtime_error("we shouldn't make it here [capture_output()]"); + } + } + + /*****************************************************/ + void capture_input() { + if (is_planar(input_layout())) { + OPENCL_V_THROW( + clEnqueueReadBuffer(queue.get(), cl_mem_input[REAL].get(), CL_TRUE, 0, + input.size_in_bytes(), input.real_ptr(), 0, NULL, + NULL), + "reading input buffer - planar real ( ::clEnqueueReadBuffer() )"); + OPENCL_V_THROW(clEnqueueReadBuffer(queue.get(), cl_mem_input[IMAG].get(), + CL_TRUE, 0, input.size_in_bytes(), + input.imag_ptr(), 0, NULL, NULL), + "reading input buffer - planar imaginary ( " + "::clEnqueueReadBuffer() )"); + } else if (is_interleaved(input_layout())) { + OPENCL_V_THROW( + clEnqueueReadBuffer(queue.get(), cl_mem_input[0].get(), CL_TRUE, 0, + input.size_in_bytes(), input.interleaved_ptr(), 0, + NULL, NULL), + "reading input buffer - interleaved ( ::clEnqueueReadBuffer() )"); + } else if (is_real(input_layout())) { + OPENCL_V_THROW( + clEnqueueReadBuffer(queue.get(), cl_mem_input[REAL].get(), CL_TRUE, 0, + input.size_in_bytes(), input.real_ptr(), 0, NULL, + NULL), + "reading input buffer - planar real ( ::clEnqueueReadBuffer() )"); + } else { + throw std::runtime_error("we shouldn't make it here [capture_input()]"); + } + } + + /*****************************************************/ + void write_local_output_buffer_to_gpu() { + if (is_planar(output_layout())) { + OPENCL_V_THROW( + clEnqueueWriteBuffer(queue.get(), cl_mem_output[REAL].get(), CL_TRUE, + 0, output.size_in_bytes(), output.real_ptr(), 0, + NULL, NULL), + "writing output buffer - planar real ( ::clEnqueueWriteBuffer() )"); + OPENCL_V_THROW(clEnqueueWriteBuffer(queue.get(), + cl_mem_output[IMAG].get(), CL_TRUE, 0, + output.size_in_bytes(), + output.imag_ptr(), 0, NULL, NULL), + "writing output buffer - planar imaginary ( " + "::clEnqueueWriteBuffer() )"); + } else if (is_interleaved(output_layout())) { + OPENCL_V_THROW( + clEnqueueWriteBuffer(queue.get(), cl_mem_output[0].get(), CL_TRUE, 0, + output.size_in_bytes(), output.interleaved_ptr(), + 0, NULL, NULL), + "writing output buffer - interleaved ( ::clEnqueueWriteBuffer() )"); + } else if (is_real(output_layout())) { + OPENCL_V_THROW( + clEnqueueWriteBuffer(queue.get(), cl_mem_output[REAL].get(), CL_TRUE, + 0, output.size_in_bytes(), output.real_ptr(), 0, + NULL, NULL), + "writing output buffer - planar real ( ::clEnqueueWriteBuffer() )"); + } else { + throw std::runtime_error( + "we shouldn't make it here [write_local_output_buffer_to_gpu()]"); + } + } + + /*****************************************************/ + void write_local_input_buffer_to_gpu() { + if (is_planar(input_layout())) { + OPENCL_V_THROW( + clEnqueueWriteBuffer(queue.get(), cl_mem_input[REAL].get(), CL_TRUE, + 0, input.size_in_bytes(), input.real_ptr(), 0, + NULL, NULL), + "writing input buffer - planar real ( ::clEnqueueWriteBuffer() )"); + OPENCL_V_THROW(clEnqueueWriteBuffer(queue.get(), cl_mem_input[IMAG].get(), + CL_TRUE, 0, input.size_in_bytes(), + input.imag_ptr(), 0, NULL, NULL), + "writing input buffer - planar imaginary ( " + "::clEnqueueWriteBuffer() )"); + } else if (is_interleaved(input_layout())) { + OPENCL_V_THROW( + clEnqueueWriteBuffer(queue.get(), cl_mem_input[0].get(), CL_TRUE, 0, + input.size_in_bytes(), input.interleaved_ptr(), + 0, NULL, NULL), + "writing input buffer - interleaved ( ::clEnqueueWriteBuffer() )"); + } else if (is_real(input_layout())) { + OPENCL_V_THROW( + clEnqueueWriteBuffer(queue.get(), cl_mem_input[REAL].get(), CL_TRUE, + 0, input.size_in_bytes(), input.real_ptr(), 0, + NULL, NULL), + "writing input buffer - planar real ( ::clEnqueueWriteBuffer() )"); + } else { + throw std::runtime_error( + "we shouldn't make it here [write_local_input_buffer_to_gpu()]"); + } + } + + /*****************************************************/ + cl_ulong cl_device_max_memory_to_allocate(size_t device_index) { + if (number_of_opencl_devices() == 0 || + device_index > number_of_opencl_devices()) { + return 0; + } else { + cl_ulong device_max_to_allocate = 0; + OPENCL_V_THROW(::clGetDeviceInfo( + device_id[device_index], CL_DEVICE_MAX_MEM_ALLOC_SIZE, + sizeof(cl_ulong), &device_max_to_allocate, NULL), + "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( " + "::clGetDeviceInfo() )"); + + return device_max_to_allocate; + } + } + + /*****************************************************/ + cl_ulong cl_device_max_global_memory(size_t device_index) { + if (number_of_opencl_devices() == 0 || + device_index > number_of_opencl_devices()) { + return 0; + } else { + cl_ulong global_mem_size = 0; + OPENCL_V_THROW( + ::clGetDeviceInfo(device_id[device_index], CL_DEVICE_GLOBAL_MEM_SIZE, + sizeof(cl_ulong), &global_mem_size, NULL), + "Getting CL_DEVICE_GLOBAL_MEM_SIZE device info ( ::clGetDeviceInfo() " + ")"); + + return global_mem_size; + } + } + +#if defined( \ + PERSISTENT_PLANS_FEATURE_HAS_BEEN_DEFEATURED_WHICH_MEANS_IT_IS_NO_LONGER_A_FEATURE) + /*****************************************************/ + void write_plan_to_file(std::string filename) { + cl_command_queue tempQueue = queue.get(); + EXPECT_EQ(CLFFT_SUCCESS, + clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL)); + // we need to make sure the plan is baked before we write it out, or we + // won't get any juicy binaries along with it + + clfftWritePlanToDisk(*plan_handle, filename.c_str()); + } + + /*****************************************************/ + void read_plan_from_file(std::string filename) { + clfftReadPlanFromDisk(*plan_handle, filename.c_str()); + + // if we've changed from the default for input and output layouts, we need + // to re-set the layouts to make sure buffers get set up completely + set_layouts(input_layout(), output_layout()); + } +#endif }; #endif diff --git a/src/tests/fftw_transform.h b/src/tests/fftw_transform.h index 2a80f86b..dc02186a 100644 --- a/src/tests/fftw_transform.h +++ b/src/tests/fftw_transform.h @@ -14,550 +14,426 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_FFTWTRANSFORM_H ) +#if !defined(CLFFT_FFTWTRANSFORM_H) #define CLFFT_FFTWTRANSFORM_H -#include -#include "fftw3.h" -#include "buffer.h" #include "../client/openCL.misc.h" // we need this to leverage the CLFFT_INPLACE and _OUTOFPLACE enums +#include "buffer.h" +#include "fftw3.h" +#include -enum fftw_direction {forward=-1, backward=+1}; +enum fftw_direction { forward = -1, backward = +1 }; -enum fftw_transform_type {c2c, r2c, c2r}; +enum fftw_transform_type { c2c, r2c, c2r }; -template -class fftw_wrapper -{}; +template class fftw_wrapper {}; -template <> -class fftw_wrapper -{ +template <> class fftw_wrapper { public: - fftwf_plan plan; - - void make_plan( int x, int y, int z, int num_dimensions, int batch_size, fftwf_complex* input_ptr, fftwf_complex* output_ptr, int num_points_in_single_batch, fftw_direction direction, fftw_transform_type type ) - { - // we need to swap x,y,z dimensions because of a row-column discrepancy between clfft and fftw - int lengths[max_dimension] = {z, y, x}; - - if( type == c2c ) - { - plan = fftwf_plan_many_dft( num_dimensions, - // because we swapped dimensions up above, we need to start - // at the end of the array and count backwards to get the - // correct dimensions passed in to fftw - // e.g. if max_dimension is 3 and number_of_dimensions is 2: - // lengths = {dimz, dimy, dimx} - // lengths + 3 - 2 = lengths + 1 - // so we will skip dimz and pass in a pointer to {dimy, dimx} - lengths+max_dimension-num_dimensions, - batch_size, - input_ptr, NULL, - 1, num_points_in_single_batch, - output_ptr, NULL, - 1, num_points_in_single_batch, - direction, FFTW_ESTIMATE); - } - else if( type == r2c ) - { - plan = fftwf_plan_many_dft_r2c( num_dimensions, - // because we swapped dimensions up above, we need to start - // at the end of the array and count backwards to get the - // correct dimensions passed in to fftw - // e.g. if max_dimension is 3 and number_of_dimensions is 2: - // lengths = {dimz, dimy, dimx} - // lengths + 3 - 2 = lengths + 1 - // so we will skip dimz and pass in a pointer to {dimy, dimx} - lengths+max_dimension-num_dimensions, - batch_size, - reinterpret_cast(input_ptr), NULL, - 1, num_points_in_single_batch, - output_ptr, NULL, - 1, (x/2 + 1) * y * z, - FFTW_ESTIMATE); - } - else if( type == c2r ) - { - plan = fftwf_plan_many_dft_c2r( num_dimensions, - // because we swapped dimensions up above, we need to start - // at the end of the array and count backwards to get the - // correct dimensions passed in to fftw - // e.g. if max_dimension is 3 and number_of_dimensions is 2: - // lengths = {dimz, dimy, dimx} - // lengths + 3 - 2 = lengths + 1 - // so we will skip dimz and pass in a pointer to {dimy, dimx} - lengths+max_dimension-num_dimensions, - batch_size, - input_ptr, NULL, - 1, (x/2 + 1) * y * z, - reinterpret_cast(output_ptr), NULL, - 1, num_points_in_single_batch, - FFTW_ESTIMATE); - } - else - throw std::runtime_error( "invalid transform type in make_plan" ); - } - - fftw_wrapper( int x, int y, int z, int num_dimensions, int batch_size, fftwf_complex* input_ptr, fftwf_complex* output_ptr, int num_points_in_single_batch, fftw_direction direction, fftw_transform_type type ) - { - make_plan( x, y, z, num_dimensions, batch_size, input_ptr, output_ptr, num_points_in_single_batch, direction, type ); - } - - void destroy_plan() - { - fftwf_destroy_plan(plan); - } - - ~fftw_wrapper() - { - destroy_plan(); - } - - void execute() - { - fftwf_execute(plan); - } + fftwf_plan plan; + + void make_plan(int x, int y, int z, int num_dimensions, int batch_size, + fftwf_complex *input_ptr, fftwf_complex *output_ptr, + int num_points_in_single_batch, fftw_direction direction, + fftw_transform_type type) { + // we need to swap x,y,z dimensions because of a row-column discrepancy + // between clfft and fftw + int lengths[max_dimension] = {z, y, x}; + + if (type == c2c) { + plan = fftwf_plan_many_dft( + num_dimensions, + // because we swapped dimensions up above, we need to start + // at the end of the array and count backwards to get the + // correct dimensions passed in to fftw + // e.g. if max_dimension is 3 and number_of_dimensions is 2: + // lengths = {dimz, dimy, dimx} + // lengths + 3 - 2 = lengths + 1 + // so we will skip dimz and pass in a pointer to {dimy, dimx} + lengths + max_dimension - num_dimensions, batch_size, input_ptr, NULL, + 1, num_points_in_single_batch, output_ptr, NULL, 1, + num_points_in_single_batch, direction, FFTW_ESTIMATE); + } else if (type == r2c) { + plan = fftwf_plan_many_dft_r2c( + num_dimensions, + // because we swapped dimensions up above, we need to start + // at the end of the array and count backwards to get the + // correct dimensions passed in to fftw + // e.g. if max_dimension is 3 and number_of_dimensions is 2: + // lengths = {dimz, dimy, dimx} + // lengths + 3 - 2 = lengths + 1 + // so we will skip dimz and pass in a pointer to {dimy, dimx} + lengths + max_dimension - num_dimensions, batch_size, + reinterpret_cast(input_ptr), NULL, 1, + num_points_in_single_batch, output_ptr, NULL, 1, (x / 2 + 1) * y * z, + FFTW_ESTIMATE); + } else if (type == c2r) { + plan = fftwf_plan_many_dft_c2r( + num_dimensions, + // because we swapped dimensions up above, we need to start + // at the end of the array and count backwards to get the + // correct dimensions passed in to fftw + // e.g. if max_dimension is 3 and number_of_dimensions is 2: + // lengths = {dimz, dimy, dimx} + // lengths + 3 - 2 = lengths + 1 + // so we will skip dimz and pass in a pointer to {dimy, dimx} + lengths + max_dimension - num_dimensions, batch_size, input_ptr, NULL, + 1, (x / 2 + 1) * y * z, reinterpret_cast(output_ptr), NULL, + 1, num_points_in_single_batch, FFTW_ESTIMATE); + } else + throw std::runtime_error("invalid transform type in make_plan"); + } + + fftw_wrapper(int x, int y, int z, int num_dimensions, int batch_size, + fftwf_complex *input_ptr, fftwf_complex *output_ptr, + int num_points_in_single_batch, fftw_direction direction, + fftw_transform_type type) { + make_plan(x, y, z, num_dimensions, batch_size, input_ptr, output_ptr, + num_points_in_single_batch, direction, type); + } + + void destroy_plan() { fftwf_destroy_plan(plan); } + + ~fftw_wrapper() { destroy_plan(); } + + void execute() { fftwf_execute(plan); } }; -template <> -class fftw_wrapper -{ +template <> class fftw_wrapper { public: - fftw_plan plan; - - void make_plan( int x, int y, int z, int num_dimensions, int batch_size, fftw_complex* input_ptr, fftw_complex* output_ptr, int num_points_in_single_batch, fftw_direction direction, fftw_transform_type type ) - { - // we need to swap x,y,z dimensions because of a row-column discrepancy between clfft and fftw - int lengths[max_dimension] = {z, y, x}; - - if( type == c2c ) - { - plan = fftw_plan_many_dft( num_dimensions, - // because we swapped dimensions up above, we need to start - // at the end of the array and count backwards to get the - // correct dimensions passed in to fftw - // e.g. if max_dimension is 3 and number_of_dimensions is 2: - // lengths = {dimz, dimy, dimx} - // lengths + 3 - 2 = lengths + 1 - // so we will skip dimz and pass in a pointer to {dimy, dimx} - lengths+max_dimension-num_dimensions, - batch_size, - input_ptr, NULL, - 1, num_points_in_single_batch, - output_ptr, NULL, - 1, num_points_in_single_batch, - direction, FFTW_ESTIMATE); - } - else if( type == r2c ) - { - plan = fftw_plan_many_dft_r2c( num_dimensions, - // because we swapped dimensions up above, we need to start - // at the end of the array and count backwards to get the - // correct dimensions passed in to fftw - // e.g. if max_dimension is 3 and number_of_dimensions is 2: - // lengths = {dimz, dimy, dimx} - // lengths + 3 - 2 = lengths + 1 - // so we will skip dimz and pass in a pointer to {dimy, dimx} - lengths+max_dimension-num_dimensions, - batch_size, - reinterpret_cast(input_ptr), NULL, - 1, num_points_in_single_batch, - output_ptr, NULL, - 1, (x/2 + 1) * y * z, - FFTW_ESTIMATE); - } - else if( type == c2r ) - { - plan = fftw_plan_many_dft_c2r( num_dimensions, - // because we swapped dimensions up above, we need to start - // at the end of the array and count backwards to get the - // correct dimensions passed in to fftw - // e.g. if max_dimension is 3 and number_of_dimensions is 2: - // lengths = {dimz, dimy, dimx} - // lengths + 3 - 2 = lengths + 1 - // so we will skip dimz and pass in a pointer to {dimy, dimx} - lengths+max_dimension-num_dimensions, - batch_size, - input_ptr, NULL, - 1, (x/2 + 1) * y * z, - reinterpret_cast(output_ptr), NULL, - 1, num_points_in_single_batch, - FFTW_ESTIMATE); - } - else - throw std::runtime_error( "invalid transform type in make_plan" ); - } - - fftw_wrapper( int x, int y, int z, int num_dimensions, int batch_size, fftw_complex* input_ptr, fftw_complex* output_ptr, int num_points_in_single_batch, fftw_direction direction, fftw_transform_type type ) - { - make_plan( x, y, z, num_dimensions, batch_size, input_ptr, output_ptr, num_points_in_single_batch, direction, type ); - } - - void destroy_plan() - { - fftw_destroy_plan(plan); - } - - ~fftw_wrapper() - { - destroy_plan(); - } - - void execute() - { - fftw_execute(plan); - } + fftw_plan plan; + + void make_plan(int x, int y, int z, int num_dimensions, int batch_size, + fftw_complex *input_ptr, fftw_complex *output_ptr, + int num_points_in_single_batch, fftw_direction direction, + fftw_transform_type type) { + // we need to swap x,y,z dimensions because of a row-column discrepancy + // between clfft and fftw + int lengths[max_dimension] = {z, y, x}; + + if (type == c2c) { + plan = fftw_plan_many_dft( + num_dimensions, + // because we swapped dimensions up above, we need to start + // at the end of the array and count backwards to get the + // correct dimensions passed in to fftw + // e.g. if max_dimension is 3 and number_of_dimensions is 2: + // lengths = {dimz, dimy, dimx} + // lengths + 3 - 2 = lengths + 1 + // so we will skip dimz and pass in a pointer to {dimy, dimx} + lengths + max_dimension - num_dimensions, batch_size, input_ptr, NULL, + 1, num_points_in_single_batch, output_ptr, NULL, 1, + num_points_in_single_batch, direction, FFTW_ESTIMATE); + } else if (type == r2c) { + plan = fftw_plan_many_dft_r2c( + num_dimensions, + // because we swapped dimensions up above, we need to start + // at the end of the array and count backwards to get the + // correct dimensions passed in to fftw + // e.g. if max_dimension is 3 and number_of_dimensions is 2: + // lengths = {dimz, dimy, dimx} + // lengths + 3 - 2 = lengths + 1 + // so we will skip dimz and pass in a pointer to {dimy, dimx} + lengths + max_dimension - num_dimensions, batch_size, + reinterpret_cast(input_ptr), NULL, 1, + num_points_in_single_batch, output_ptr, NULL, 1, (x / 2 + 1) * y * z, + FFTW_ESTIMATE); + } else if (type == c2r) { + plan = fftw_plan_many_dft_c2r( + num_dimensions, + // because we swapped dimensions up above, we need to start + // at the end of the array and count backwards to get the + // correct dimensions passed in to fftw + // e.g. if max_dimension is 3 and number_of_dimensions is 2: + // lengths = {dimz, dimy, dimx} + // lengths + 3 - 2 = lengths + 1 + // so we will skip dimz and pass in a pointer to {dimy, dimx} + lengths + max_dimension - num_dimensions, batch_size, input_ptr, NULL, + 1, (x / 2 + 1) * y * z, reinterpret_cast(output_ptr), NULL, + 1, num_points_in_single_batch, FFTW_ESTIMATE); + } else + throw std::runtime_error("invalid transform type in make_plan"); + } + + fftw_wrapper(int x, int y, int z, int num_dimensions, int batch_size, + fftw_complex *input_ptr, fftw_complex *output_ptr, + int num_points_in_single_batch, fftw_direction direction, + fftw_transform_type type) { + make_plan(x, y, z, num_dimensions, batch_size, input_ptr, output_ptr, + num_points_in_single_batch, direction, type); + } + + void destroy_plan() { fftw_destroy_plan(plan); } + + ~fftw_wrapper() { destroy_plan(); } + + void execute() { fftw_execute(plan); } }; /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -template -class fftw { +template class fftw { private: - static const size_t tightly_packed_distance = 0; - - std::vector _lengths; - fftw_direction _direction; - fftw_transform_type _type; - layout::buffer_layout_t _input_layout, _output_layout; - size_t _batch_size; - buffer input; - buffer output; - fftw_wrapper fftw_guts; - - T _forward_scale, _backward_scale; + static const size_t tightly_packed_distance = 0; + + std::vector _lengths; + fftw_direction _direction; + fftw_transform_type _type; + layout::buffer_layout_t _input_layout, _output_layout; + size_t _batch_size; + buffer input; + buffer output; + fftw_wrapper fftw_guts; + + T _forward_scale, _backward_scale; + public: - /*****************************************************/ - fftw( const size_t number_of_dimensions_in, const size_t* lengths_in, const size_t batch_size_in, fftw_transform_type type_in ) - : _lengths( initialized_lengths( number_of_dimensions_in, lengths_in ) ) - , _direction( forward ) - , _type( type_in ) - , _input_layout( initialized_input_layout() ) - , _output_layout( initialized_output_layout() ) - , _batch_size( batch_size_in ) - , input( number_of_dimensions_in, - lengths_in, - NULL, - batch_size_in, - tightly_packed_distance, - _input_layout, - CLFFT_OUTOFPLACE ) - , output( number_of_dimensions_in, - lengths_in, - NULL, - batch_size_in, - tightly_packed_distance, - _output_layout, - CLFFT_OUTOFPLACE ) - , _forward_scale( 1.0f ) - , _backward_scale( 1.0f/T(input.number_of_data_points_single_batch()) ) - , fftw_guts( (int)_lengths[dimx], (int)_lengths[dimy], (int)_lengths[dimz], - (int)number_of_dimensions_in, (int)batch_size_in, - reinterpret_cast(input_ptr()), - reinterpret_cast(output_ptr()), - (int)(_lengths[dimx]*_lengths[dimy]*_lengths[dimz]), _direction, _type) - { - clear_data_buffer(); - } - - /*****************************************************/ - ~fftw() {} - - /*****************************************************/ - layout::buffer_layout_t initialized_input_layout() - { - if( _type == c2c ) - return layout::complex_interleaved; - else if( _type == r2c ) - return layout::real; - else if( _type == c2r ) - return layout::hermitian_interleaved; - else - throw std::runtime_error( "invalid transform type in initialized_input_layout" ); - } - - /*****************************************************/ - layout::buffer_layout_t initialized_output_layout() - { - if( _type == c2c ) - return layout::complex_interleaved; - else if( _type == r2c ) - return layout::hermitian_interleaved; - else if( _type == c2r ) - return layout::real; - else - throw std::runtime_error( "invalid transform type in initialized_input_layout" ); - } - - /*****************************************************/ - std::vector initialized_lengths( const size_t number_of_dimensions, const size_t* lengths_in ) - { - std::vector lengths( 3, 1 ); // start with 1, 1, 1 - - for( size_t i = 0; i < number_of_dimensions; i++ ) - { - lengths[i] = lengths_in[i]; - } - - return lengths; - } - - /*****************************************************/ - T* input_ptr() - { - if( _input_layout == layout::real ) - return input.real_ptr(); - else if( _input_layout == layout::complex_interleaved ) - return input.interleaved_ptr(); - else if( _input_layout == layout::hermitian_interleaved ) - return input.interleaved_ptr(); - else - throw std::runtime_error( "invalid layout in fftw::input_ptr" ); - } - - /*****************************************************/ - T* output_ptr() - { - if( _output_layout == layout::real ) - return output.real_ptr(); - else if( _output_layout == layout::complex_interleaved ) - return output.interleaved_ptr(); - else if( _output_layout == layout::hermitian_interleaved ) - return output.interleaved_ptr(); - else - throw std::runtime_error( "invalid layout in fftw::output_ptr" ); - } - - // you must call either set_forward_transform() or - // set_backward_transform() before setting the input buffer - /*****************************************************/ - void set_forward_transform() - { - if( _type != c2c ) - throw std::runtime_error( "do not use set_forward_transform() except with c2c transforms" ); - - if( _direction != forward ) - { - _direction = forward; - fftw_guts.destroy_plan(); - fftw_guts.make_plan((int)_lengths[dimx], (int)_lengths[dimy], (int)_lengths[dimz], - (int)input.number_of_dimensions(), (int)input.batch_size(), - reinterpret_cast(input.interleaved_ptr()), reinterpret_cast(output.interleaved_ptr()), - (int)(_lengths[dimx]*_lengths[dimy]*_lengths[dimz]), _direction, _type); - } - } - - /*****************************************************/ - void set_backward_transform() - { - if( _type != c2c ) - throw std::runtime_error( "do not use set_backward_transform() except with c2c transforms" ); - - if( _direction != backward ) - { - _direction = backward; - fftw_guts.destroy_plan(); - fftw_guts.make_plan((int)_lengths[dimx], (int)_lengths[dimy], (int)_lengths[dimz], - (int)input.number_of_dimensions(), (int)input.batch_size(), - reinterpret_cast(input.interleaved_ptr()), reinterpret_cast(output.interleaved_ptr()), - (int)(_lengths[dimx]*_lengths[dimy]*_lengths[dimz]), _direction, _type); - } - } - - /*****************************************************/ - size_t size_of_data_in_bytes() - { - return input.size_in_bytes(); - } - - /*****************************************************/ - void forward_scale( T in ) - { - _forward_scale = in; - } - - /*****************************************************/ - void backward_scale( T in ) - { - _backward_scale = in; - } - - /*****************************************************/ - T forward_scale() - { - return _forward_scale; - } - - /*****************************************************/ - T backward_scale() - { - return _backward_scale; - } - - /*****************************************************/ - void set_all_data_to_value( T value ) - { - input.set_all_to_value( value ); - } - - /*****************************************************/ - void set_all_data_to_value( T real_value, T imag_value ) - { - input.set_all_to_value( real_value, imag_value ); - } - - /*****************************************************/ - void set_data_to_sawtooth(T max) - { - input.set_all_to_sawtooth( max ); - } - - /*****************************************************/ - void set_data_to_increase_linearly() - { - input.set_all_to_linear_increase(); - } - - /*****************************************************/ - void set_data_to_impulse() - { - input.set_all_to_impulse(); - } - - /*****************************************************/ - // yes, the "super duper global seed" is horrible - // alas, i'll have TODO it better later - void set_data_to_random() - { - input.set_all_to_random_data( 10, super_duper_global_seed ); - } - - /*****************************************************/ - void set_input_to_buffer( buffer other_buffer ) { - input = other_buffer; - } - - void set_output_postcallback() - { - //postcallback user data - buffer userdata( output.number_of_dimensions(), - output.lengths(), - output.strides(), - output.batch_size(), - output.distance(), - layout::real , - CLFFT_INPLACE - ); - - userdata.set_all_to_random_data(_lengths[0], 10); - - output *= userdata; - } - - void set_input_precallback() - { - //precallback user data - buffer userdata( input.number_of_dimensions(), - input.lengths(), - input.strides(), - input.batch_size(), - input.distance(), - layout::real , - CLFFT_INPLACE - ); - - userdata.set_all_to_random_data(_lengths[0], 10); - - input *= userdata; - } - - void set_input_precallback_special() - { - //precallback user data - buffer userdata( input.number_of_dimensions(), - input.lengths(), - input.strides(), - input.batch_size(), - input.distance(), - layout::real , - CLFFT_INPLACE - ); - - userdata.set_all_to_random_data(_lengths[0], 10); - - input.multiply_3pt_average(userdata); - } - - void set_output_postcallback_special() - { - //postcallback user data - buffer userdata( output.number_of_dimensions(), - output.lengths(), - output.strides(), - output.batch_size(), - output.distance(), - layout::real , - CLFFT_INPLACE - ); - - userdata.set_all_to_random_data(_lengths[0], 10); - - output.multiply_3pt_average(userdata); - } - - /*****************************************************/ - void clear_data_buffer() - { - if( _input_layout == layout::real ) - { - set_all_data_to_value( 0.0f ); - } - else - { - set_all_data_to_value( 0.0f, 0.0f ); - } - } - - /*****************************************************/ - void transform() - { - fftw_guts.execute(); - - if( _type == c2c ) - { - if( _direction == forward ) { - output.scale_data( static_cast( forward_scale( ) ) ); - } - else if( _direction == backward ) { - output.scale_data( static_cast( backward_scale( ) ) ); - } - } - else if( _type == r2c ) - { - output.scale_data( static_cast( forward_scale( ) ) ); - } - else if( _type == c2r ) - { - output.scale_data( static_cast( backward_scale( ) ) ); - } - else - throw std::runtime_error( "invalid transform type in fftw::transform()" ); - } - - /*****************************************************/ - buffer & result() - { - return output; - } - - /*****************************************************/ - buffer & input_buffer() - { - return input; - } + /*****************************************************/ + fftw(const size_t number_of_dimensions_in, const size_t *lengths_in, + const size_t batch_size_in, fftw_transform_type type_in) + : _lengths(initialized_lengths(number_of_dimensions_in, lengths_in)), + _direction(forward), _type(type_in), + _input_layout(initialized_input_layout()), + _output_layout(initialized_output_layout()), _batch_size(batch_size_in), + input(number_of_dimensions_in, lengths_in, NULL, batch_size_in, + tightly_packed_distance, _input_layout, CLFFT_OUTOFPLACE), + output(number_of_dimensions_in, lengths_in, NULL, batch_size_in, + tightly_packed_distance, _output_layout, CLFFT_OUTOFPLACE), + _forward_scale(1.0f), + _backward_scale(1.0f / T(input.number_of_data_points_single_batch())), + fftw_guts((int)_lengths[dimx], (int)_lengths[dimy], (int)_lengths[dimz], + (int)number_of_dimensions_in, (int)batch_size_in, + reinterpret_cast(input_ptr()), + reinterpret_cast(output_ptr()), + (int)(_lengths[dimx] * _lengths[dimy] * _lengths[dimz]), + _direction, _type) { + clear_data_buffer(); + } + + /*****************************************************/ + ~fftw() {} + + /*****************************************************/ + layout::buffer_layout_t initialized_input_layout() { + if (_type == c2c) + return layout::complex_interleaved; + else if (_type == r2c) + return layout::real; + else if (_type == c2r) + return layout::hermitian_interleaved; + else + throw std::runtime_error( + "invalid transform type in initialized_input_layout"); + } + + /*****************************************************/ + layout::buffer_layout_t initialized_output_layout() { + if (_type == c2c) + return layout::complex_interleaved; + else if (_type == r2c) + return layout::hermitian_interleaved; + else if (_type == c2r) + return layout::real; + else + throw std::runtime_error( + "invalid transform type in initialized_input_layout"); + } + + /*****************************************************/ + std::vector initialized_lengths(const size_t number_of_dimensions, + const size_t *lengths_in) { + std::vector lengths(3, 1); // start with 1, 1, 1 + + for (size_t i = 0; i < number_of_dimensions; i++) { + lengths[i] = lengths_in[i]; + } + + return lengths; + } + + /*****************************************************/ + T *input_ptr() { + if (_input_layout == layout::real) + return input.real_ptr(); + else if (_input_layout == layout::complex_interleaved) + return input.interleaved_ptr(); + else if (_input_layout == layout::hermitian_interleaved) + return input.interleaved_ptr(); + else + throw std::runtime_error("invalid layout in fftw::input_ptr"); + } + + /*****************************************************/ + T *output_ptr() { + if (_output_layout == layout::real) + return output.real_ptr(); + else if (_output_layout == layout::complex_interleaved) + return output.interleaved_ptr(); + else if (_output_layout == layout::hermitian_interleaved) + return output.interleaved_ptr(); + else + throw std::runtime_error("invalid layout in fftw::output_ptr"); + } + + // you must call either set_forward_transform() or + // set_backward_transform() before setting the input buffer + /*****************************************************/ + void set_forward_transform() { + if (_type != c2c) + throw std::runtime_error( + "do not use set_forward_transform() except with c2c transforms"); + + if (_direction != forward) { + _direction = forward; + fftw_guts.destroy_plan(); + fftw_guts.make_plan( + (int)_lengths[dimx], (int)_lengths[dimy], (int)_lengths[dimz], + (int)input.number_of_dimensions(), (int)input.batch_size(), + reinterpret_cast(input.interleaved_ptr()), + reinterpret_cast(output.interleaved_ptr()), + (int)(_lengths[dimx] * _lengths[dimy] * _lengths[dimz]), _direction, + _type); + } + } + + /*****************************************************/ + void set_backward_transform() { + if (_type != c2c) + throw std::runtime_error( + "do not use set_backward_transform() except with c2c transforms"); + + if (_direction != backward) { + _direction = backward; + fftw_guts.destroy_plan(); + fftw_guts.make_plan( + (int)_lengths[dimx], (int)_lengths[dimy], (int)_lengths[dimz], + (int)input.number_of_dimensions(), (int)input.batch_size(), + reinterpret_cast(input.interleaved_ptr()), + reinterpret_cast(output.interleaved_ptr()), + (int)(_lengths[dimx] * _lengths[dimy] * _lengths[dimz]), _direction, + _type); + } + } + + /*****************************************************/ + size_t size_of_data_in_bytes() { return input.size_in_bytes(); } + + /*****************************************************/ + void forward_scale(T in) { _forward_scale = in; } + + /*****************************************************/ + void backward_scale(T in) { _backward_scale = in; } + + /*****************************************************/ + T forward_scale() { return _forward_scale; } + + /*****************************************************/ + T backward_scale() { return _backward_scale; } + + /*****************************************************/ + void set_all_data_to_value(T value) { input.set_all_to_value(value); } + + /*****************************************************/ + void set_all_data_to_value(T real_value, T imag_value) { + input.set_all_to_value(real_value, imag_value); + } + + /*****************************************************/ + void set_data_to_sawtooth(T max) { input.set_all_to_sawtooth(max); } + + /*****************************************************/ + void set_data_to_increase_linearly() { input.set_all_to_linear_increase(); } + + /*****************************************************/ + void set_data_to_impulse() { input.set_all_to_impulse(); } + + /*****************************************************/ + // yes, the "super duper global seed" is horrible + // alas, i'll have TODO it better later + void set_data_to_random() { + input.set_all_to_random_data(10, super_duper_global_seed); + } + + /*****************************************************/ + void set_input_to_buffer(buffer other_buffer) { input = other_buffer; } + + void set_output_postcallback() { + // postcallback user data + buffer userdata(output.number_of_dimensions(), output.lengths(), + output.strides(), output.batch_size(), output.distance(), + layout::real, CLFFT_INPLACE); + + userdata.set_all_to_random_data(_lengths[0], 10); + + output *= userdata; + } + + void set_input_precallback() { + // precallback user data + buffer userdata(input.number_of_dimensions(), input.lengths(), + input.strides(), input.batch_size(), input.distance(), + layout::real, CLFFT_INPLACE); + + userdata.set_all_to_random_data(_lengths[0], 10); + + input *= userdata; + } + + void set_input_precallback_special() { + // precallback user data + buffer userdata(input.number_of_dimensions(), input.lengths(), + input.strides(), input.batch_size(), input.distance(), + layout::real, CLFFT_INPLACE); + + userdata.set_all_to_random_data(_lengths[0], 10); + + input.multiply_3pt_average(userdata); + } + + void set_output_postcallback_special() { + // postcallback user data + buffer userdata(output.number_of_dimensions(), output.lengths(), + output.strides(), output.batch_size(), output.distance(), + layout::real, CLFFT_INPLACE); + + userdata.set_all_to_random_data(_lengths[0], 10); + + output.multiply_3pt_average(userdata); + } + + /*****************************************************/ + void clear_data_buffer() { + if (_input_layout == layout::real) { + set_all_data_to_value(0.0f); + } else { + set_all_data_to_value(0.0f, 0.0f); + } + } + + /*****************************************************/ + void transform() { + fftw_guts.execute(); + + if (_type == c2c) { + if (_direction == forward) { + output.scale_data(static_cast(forward_scale())); + } else if (_direction == backward) { + output.scale_data(static_cast(backward_scale())); + } + } else if (_type == r2c) { + output.scale_data(static_cast(forward_scale())); + } else if (_type == c2r) { + output.scale_data(static_cast(backward_scale())); + } else + throw std::runtime_error("invalid transform type in fftw::transform()"); + } + + /*****************************************************/ + buffer &result() { return output; } + + /*****************************************************/ + buffer &input_buffer() { return input; } }; #endif diff --git a/src/tests/gtest_main.cpp b/src/tests/gtest_main.cpp index 7bda8808..35ae3a96 100644 --- a/src/tests/gtest_main.cpp +++ b/src/tests/gtest_main.cpp @@ -14,14 +14,14 @@ * limitations under the License. * ************************************************************************/ -#include -#include -#include +#include "../client/openCL.misc.h" #include "clFFT.h" #include "clFFT.version.h" #include "test_constants.h" -#include "../client/openCL.misc.h" #include "unicode.compatibility.h" +#include +#include +#include namespace po = boost::program_options; size_t number_of_random_tests; @@ -30,259 +30,261 @@ float tolerance; double rmse_tolerance; bool verbose; -#if defined( MSVC_VER ) -#if !defined( NOMINMAX ) - #define NOMINMAX +#if defined(MSVC_VER) +#if !defined(NOMINMAX) +#define NOMINMAX #endif -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include -#if defined( _WIN64 ) -void inline BSF( unsigned long* index, size_t& mask ) -{ - _BitScanForward64( index, mask ); +#if defined(_WIN64) +void inline BSF(unsigned long *index, size_t &mask) { + _BitScanForward64(index, mask); } #else -void inline BSF( unsigned long* index, size_t& mask ) -{ - _BitScanForward( index, mask ); +void inline BSF(unsigned long *index, size_t &mask) { + _BitScanForward(index, mask); } #endif -#elif defined( __GNUC__ ) -void inline BSF (unsigned long * index, size_t & mask) { - *index = __builtin_ctz (mask); +#elif defined(__GNUC__) +void inline BSF(unsigned long *index, size_t &mask) { + *index = __builtin_ctz(mask); } #endif // global for test use bool suppress_output = false; -// Globals that user can set on the command line, that need to be passed down to unit tests +// Globals that user can set on the command line, that need to be passed +//down to unit tests cl_device_type g_device_type = CL_DEVICE_TYPE_ALL; cl_int g_device_id = 0; cl_int g_platform_id = 0; bool comparison_type = root_mean_square; -int main( int argc, char **argv ) -{ - // Define MEMORYREPORT on windows platfroms to enable debug memory heap checking -#if defined( MEMORYREPORT ) && defined( _WIN32 ) - TCHAR logPath[ MAX_PATH ]; - ::GetCurrentDirectory( MAX_PATH, logPath ); - ::_tcscat_s( logPath, _T( "\\MemoryReport.txt") ); - - // We leak the handle to this file, on purpose, so that the ::_CrtSetReportFile() can output it's memory - // statistics on app shutdown - HANDLE hLogFile; - hLogFile = ::CreateFile( logPath, GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); - - ::_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG ); - ::_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | _CRTDBG_MODE_DEBUG ); - ::_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG ); - - ::_CrtSetReportFile( _CRT_ASSERT, hLogFile ); - ::_CrtSetReportFile( _CRT_ERROR, hLogFile ); - ::_CrtSetReportFile( _CRT_WARN, hLogFile ); - - int tmp = ::_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF; - ::_CrtSetDbgFlag( tmp ); - - // By looking at the memory leak report that is generated by this debug heap, there is a number with - // {} brackets that indicates the incremental allocation number of that block. If you wish to set - // a breakpoint on that allocation number, put it in the _CrtSetBreakAlloc() call below, and the heap - // will issue a bp on the request, allowing you to look at the call stack - // ::_CrtSetBreakAlloc( 997 ); +int main(int argc, char **argv) { + // Define MEMORYREPORT on windows platfroms to enable debug memory heap + //checking +#if defined(MEMORYREPORT) && defined(_WIN32) + TCHAR logPath[MAX_PATH]; + ::GetCurrentDirectory(MAX_PATH, logPath); + ::_tcscat_s(logPath, _T( "\\MemoryReport.txt")); + + // We leak the handle to this file, on purpose, so that the + //::_CrtSetReportFile() can output it's memory statistics on app shutdown + HANDLE hLogFile; + hLogFile = + ::CreateFile(logPath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + ::_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | + _CRTDBG_MODE_DEBUG); + ::_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | + _CRTDBG_MODE_DEBUG); + ::_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + + ::_CrtSetReportFile(_CRT_ASSERT, hLogFile); + ::_CrtSetReportFile(_CRT_ERROR, hLogFile); + ::_CrtSetReportFile(_CRT_WARN, hLogFile); + + int tmp = ::_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + tmp |= _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF; + ::_CrtSetDbgFlag(tmp); + + // By looking at the memory leak report that is generated by this debug + //heap, there is a number with + // {} brackets that indicates the incremental allocation number of that + //block. If you wish to set a breakpoint on that allocation number, put it in + //the _CrtSetBreakAlloc() call below, and the heap will issue a bp on the + //request, allowing you to look at the call stack + // ::_CrtSetBreakAlloc( 997 ); #endif /* MEMORYREPORT */ - // Declare the supported options. - po::options_description desc( "clFFT Runtime Test command line options" ); - desc.add_options() - ( "help,h", "produces this help message" ) - ( "verbose,v", "print out detailed information for the tests" ) - ( "noVersion", "Don't print version information from the clFFT library" ) - ( "noInfoCL", "Don't print information from the OpenCL runtime" ) - ( "cpu,c", "Run tests on a CPU device" ) - ( "gpu,g", "Run tests on a GPU device" ) - ( "all,a", "Run tests on any device type (default)" ) - ( "platform", po::value< cl_int >( &g_platform_id )->default_value( 0 ), "Select a specific OpenCL platform id as it is reported by clinfo" ) - ( "device", po::value< cl_int >( &g_device_id )->default_value( 0 ), "Select a specific OpenCL device id as it is reported by clinfo" ) - ( "pointwise,p", "Do a pointwise comparison to determine test correctness (default: use root mean square)" ) - ( "tolerance,t", po::value< float >( &tolerance )->default_value( 0.001f ), "tolerance level to use when determining test pass/fail" ) - ( "numRandom,r", po::value< size_t >( &number_of_random_tests )->default_value( 2000 ), "number of random tests to run" ) - ( "seed", po::value< time_t >( &random_test_parameter_seed )->default_value( time(NULL)%1308000000 ), - "seed to use for the random test. defaults to time(NULL)" ) - // modulo lops off the first few digits of the time value to make the seed easier to type - // even without these digits, the seed value won't wrap around until 2036 or later - ( "short,s", "Run radix 2 tests; no random testing" ) - ( "medium,m", "Run all radices; no random testing" ) - ; - - // this rmse_tolerance is not absolute; it is for a 4096-point single precision transform - // the actual rmse tolerance is this value times sqrt(problem-size/4096) - rmse_tolerance = 0.00002; - - - // Parse the command line options, ignore unrecognized options and collect them into a vector of strings - po::variables_map vm; - po::parsed_options parsed = po::command_line_parser( argc, argv ).options( desc ).allow_unregistered( ).run( ); - po::store( parsed, vm ); - po::notify( vm ); - std::vector< std::string > to_pass_further = po::collect_unrecognized( parsed.options, po::include_positional ); - - std::cout << std::endl; - - size_t mutex = ((vm.count( "gpu" ) > 0) ? 1 : 0) - | ((vm.count( "cpu" ) > 0) ? 2 : 0) - | ((vm.count( "all" ) > 0) ? 4 : 0); - if ((mutex & (mutex-1)) != 0) { - terr << _T("You have selected mutually-exclusive OpenCL device options:") << std::endl; - if (vm.count ( "gpu" ) > 0) terr << _T(" gpu,g Force selection of OpenCL GPU devices only" ) << std::endl; - if (vm.count ( "cpu" ) > 0) terr << _T(" cpu,c Force selection of OpenCL CPU devices only" ) << std::endl; - if (vm.count ( "all" ) > 0) terr << _T(" all,a Force selection of all OpenCL devices (default)" ) << std::endl; - return 1; - } - - if( vm.count( "gpu" ) ) - { - g_device_type = CL_DEVICE_TYPE_GPU; - } - - if( vm.count( "cpu" ) ) - { - g_device_type = CL_DEVICE_TYPE_CPU; - } - - if( vm.count( "all" ) ) - { - g_device_type = CL_DEVICE_TYPE_ALL; - } - - - // Print version by default - if( !vm.count( "noVersion" ) ) - { - const int indent = countOf( "clFFT client API version: " ); - tout << std::left << std::setw( indent ) << _T( "clFFT client API version: " ) - << clfftVersionMajor << _T( "." ) - << clfftVersionMinor << _T( "." ) - << clfftVersionPatch << std::endl; - - cl_uint libMajor, libMinor, libPatch; - clfftGetVersion( &libMajor, &libMinor, &libPatch ); - - tout << std::left << std::setw( indent ) << _T( "clFFT runtime version: " ) - << libMajor << _T( "." ) - << libMinor << _T( "." ) - << libPatch << std::endl << std::endl; - } - - // Print clInfo by default - if( !vm.count( "noInfoCL" ) ) - { - cl_context tempContext = NULL; - cl_command_queue tempQueue = NULL; - cl_event tempEvent = NULL; - ::initializeCL(g_device_type, g_device_id, g_platform_id, tempContext, true); - ::cleanupCL( &tempContext, &tempQueue, 0, NULL, 0, NULL, &tempEvent ); - } - - if( vm.count( "help" ) ) - { - std::cout << desc << std::endl; - return 0; - } - - if( vm.count( "verbose" ) ) - { - verbose = true; - } - else - { - verbose = false; - } - - if( vm.count( "short" ) && vm.count( "medium" ) ) - { - terr << _T("Options 'short' and 'medium' are mutually-exclusive. Please select only one.") << std::endl; - return 1; - } - - // Create a new argc,argv to pass to InitGoogleTest - // First parameter of course is the name of this program - std::vector< const char* > myArgv; - - // Push back a pointer to the executable name - if( argc > 0 ) - myArgv.push_back( *argv ); - - // Push into our new argv vector any parameter the user passed, except to filter their gtest_filter expressions - std::string userFilter; - for( int i = 1; i < argc; ++i ) - { - if( vm.count( "short" ) || vm.count( "medium" ) ) - { - std::string tmpStr( argv[ i ] ); - std::string::size_type pos = tmpStr.find( "gtest_filter" ); - if( pos == std::string::npos ) - { - myArgv.push_back( argv[ i ] ); - } - else - { - // Capture the users filter, but only the regexp portion - userFilter = argv[ i ]; - userFilter.erase( 0, 15 ); - } - } - else - { - myArgv.push_back( argv[ i ] ); - } - } - - std::string newFilter; - if( vm.count( "short" ) ) - { - newFilter += "--gtest_filter=*accuracy_test_pow2*"; - if( userFilter.size( ) ) - { - newFilter += ":"; - newFilter += userFilter; - } - myArgv.push_back( newFilter.c_str( ) ); - } - - if( vm.count( "medium" ) ) - { - newFilter += "--gtest_filter="; - if( userFilter.size( ) ) - { - newFilter += userFilter; - newFilter += ":"; - } - newFilter += "-*Random*"; - myArgv.push_back( newFilter.c_str( ) ); - } - - if( vm.count( "pointwise" ) ) - { - comparison_type = pointwise_compare; - } - else - { - comparison_type = root_mean_square; - } - - int myArgc = static_cast< int >( myArgv.size( ) ); - - std::cout << "Result comparison tolerance is " << tolerance << std::endl; - std::cout << "Result comparison RMSE relative tolerance is " << rmse_tolerance << std::endl; - - ::testing::InitGoogleTest( &myArgc, const_cast< char** >( &myArgv[ 0 ] ) ); - - return RUN_ALL_TESTS(); + // Declare the supported options. + po::options_description desc("clFFT Runtime Test command line options"); + desc.add_options()("help,h", "produces this help message")( + "verbose,v", "print out detailed information for the tests")( + "noVersion", "Don't print version information from the clFFT library")( + "noInfoCL", "Don't print information from the OpenCL runtime")( + "cpu,c", "Run tests on a CPU device")("gpu,g", + "Run tests on a GPU device")( + "all,a", "Run tests on any device type (default)")( + "platform", po::value(&g_platform_id)->default_value(0), + "Select a specific OpenCL platform id as it is reported by clinfo")( + "device", po::value(&g_device_id)->default_value(0), + "Select a specific OpenCL device id as it is reported by clinfo")( + "pointwise,p", "Do a pointwise comparison to determine test correctness " + "(default: use root mean square)")( + "tolerance,t", po::value(&tolerance)->default_value(0.001f), + "tolerance level to use when determining test pass/fail")( + "numRandom,r", + po::value(&number_of_random_tests)->default_value(2000), + "number of random tests to run")( + "seed", + po::value(&random_test_parameter_seed) + ->default_value(time(NULL) % 1308000000), + "seed to use for the random test. defaults to time(NULL)") + // modulo lops off the first few digits of the time value to make the seed + // easier to type even without these digits, the seed value won't wrap + // around until 2036 or later + ("short,s", "Run radix 2 tests; no random testing")( + "medium,m", "Run all radices; no random testing"); + + // this rmse_tolerance is not absolute; it is for a 4096-point single + // precision transform the actual rmse tolerance is this value times + // sqrt(problem-size/4096) + rmse_tolerance = 0.00002; + + // Parse the command line options, ignore unrecognized options and collect + //them into a vector of strings + po::variables_map vm; + po::parsed_options parsed = po::command_line_parser(argc, argv) + .options(desc) + .allow_unregistered() + .run(); + po::store(parsed, vm); + po::notify(vm); + std::vector to_pass_further = + po::collect_unrecognized(parsed.options, po::include_positional); + + std::cout << std::endl; + + size_t mutex = ((vm.count("gpu") > 0) ? 1 : 0) | + ((vm.count("cpu") > 0) ? 2 : 0) | + ((vm.count("all") > 0) ? 4 : 0); + if ((mutex & (mutex - 1)) != 0) { + terr << _T("You have selected mutually-exclusive OpenCL device options:") + << std::endl; + if (vm.count("gpu") > 0) + terr << _T(" gpu,g Force selection of OpenCL GPU devices only" ) + << std::endl; + if (vm.count("cpu") > 0) + terr << _T(" cpu,c Force selection of OpenCL CPU devices only" ) + << std::endl; + if (vm.count("all") > 0) + terr << _T(" all,a Force selection of all OpenCL devices (default)" ) + << std::endl; + return 1; + } + + if (vm.count("gpu")) { + g_device_type = CL_DEVICE_TYPE_GPU; + } + + if (vm.count("cpu")) { + g_device_type = CL_DEVICE_TYPE_CPU; + } + + if (vm.count("all")) { + g_device_type = CL_DEVICE_TYPE_ALL; + } + + // Print version by default + if (!vm.count("noVersion")) { + const int indent = countOf("clFFT client API version: "); + tout << std::left << std::setw(indent) << _T( "clFFT client API version: " ) + << clfftVersionMajor << _T( "." ) << clfftVersionMinor << _T( "." ) + << clfftVersionPatch << std::endl; + + cl_uint libMajor, libMinor, libPatch; + clfftGetVersion(&libMajor, &libMinor, &libPatch); + + tout << std::left << std::setw(indent) << _T( "clFFT runtime version: " ) + << libMajor << _T( "." ) << libMinor << _T( "." ) << libPatch + << std::endl + << std::endl; + } + + // Print clInfo by default + if (!vm.count("noInfoCL")) { + cl_context tempContext = NULL; + cl_command_queue tempQueue = NULL; + cl_event tempEvent = NULL; + ::initializeCL(g_device_type, g_device_id, g_platform_id, tempContext, + true); + ::cleanupCL(&tempContext, &tempQueue, 0, NULL, 0, NULL, &tempEvent); + } + + if (vm.count("help")) { + std::cout << desc << std::endl; + return 0; + } + + if (vm.count("verbose")) { + verbose = true; + } else { + verbose = false; + } + + if (vm.count("short") && vm.count("medium")) { + terr << _T("Options 'short' and 'medium' are mutually-exclusive. Please ") + _T("select only one.") + << std::endl; + return 1; + } + + // Create a new argc,argv to pass to InitGoogleTest + // First parameter of course is the name of this program + std::vector myArgv; + + // Push back a pointer to the executable name + if (argc > 0) + myArgv.push_back(*argv); + + // Push into our new argv vector any parameter the user passed, except to + //filter their gtest_filter expressions + std::string userFilter; + for (int i = 1; i < argc; ++i) { + if (vm.count("short") || vm.count("medium")) { + std::string tmpStr(argv[i]); + std::string::size_type pos = tmpStr.find("gtest_filter"); + if (pos == std::string::npos) { + myArgv.push_back(argv[i]); + } else { + // Capture the users filter, but only the regexp portion + userFilter = argv[i]; + userFilter.erase(0, 15); + } + } else { + myArgv.push_back(argv[i]); + } + } + + std::string newFilter; + if (vm.count("short")) { + newFilter += "--gtest_filter=*accuracy_test_pow2*"; + if (userFilter.size()) { + newFilter += ":"; + newFilter += userFilter; + } + myArgv.push_back(newFilter.c_str()); + } + + if (vm.count("medium")) { + newFilter += "--gtest_filter="; + if (userFilter.size()) { + newFilter += userFilter; + newFilter += ":"; + } + newFilter += "-*Random*"; + myArgv.push_back(newFilter.c_str()); + } + + if (vm.count("pointwise")) { + comparison_type = pointwise_compare; + } else { + comparison_type = root_mean_square; + } + + int myArgc = static_cast(myArgv.size()); + + std::cout << "Result comparison tolerance is " << tolerance << std::endl; + std::cout << "Result comparison RMSE relative tolerance is " << rmse_tolerance + << std::endl; + + ::testing::InitGoogleTest(&myArgc, const_cast(&myArgv[0])); + + return RUN_ALL_TESTS(); } diff --git a/src/tests/test_constants.cpp b/src/tests/test_constants.cpp index 1a69d1f2..dbfc35e5 100644 --- a/src/tests/test_constants.cpp +++ b/src/tests/test_constants.cpp @@ -15,106 +15,97 @@ * ************************************************************************/ #include "test_constants.h" +#include "../client/openCL.misc.h" #include +#include +#include #include #include -#include -#include -#include "../client/openCL.misc.h" -#if defined( _WIN32 ) && defined( _DEBUG ) +#if defined(_WIN32) && defined(_DEBUG) #include #endif -void handle_exception( const std::exception& except ) -{ - std::string error_message(except.what()); +void handle_exception(const std::exception &except) { + std::string error_message(except.what()); - std::cout << "--- Exception caught ---" << std::endl; + std::cout << "--- Exception caught ---" << std::endl; - if( error_message.find("problem too large for device") != std::string::npos || - error_message.find("CLFFT_INVALID_BUFFER_SIZE" ) != std::string::npos || - error_message.find("CLFFT_MEM_OBJECT_ALLOCATION_FAILURE" ) != std::string::npos || - error_message.find("CLFFT_OUT_OF_HOST_MEMORY" ) != std::string::npos || - error_message.find("CLFFT_OUT_OF_RESOURCES" ) != std::string::npos ) - { - std::cout << "Data set is too large for this device -- skipping test" << std::endl; - //TODO put in (this problem size[data + stride]/max problem size/gpu or cpu) specifics - } - else if( error_message.find("system memory allocation failure") != std::string::npos ) - { - std::cout << "Framework was denied enough system memory to support the data set" - << " -- skipping test" << std::endl; - } - else if( error_message.find("CLFFT_DEVICE_NO_DOUBLE") != std::string::npos ) - { - std::cout << "Device in context does not support double precision" - << " -- skipping test" << std::endl; - } - else if( error_message.find("dereference null pointer") != std::string::npos ) - { - std::cout << error_message << std::endl; - FAIL(); - } - else if( error_message.find("in-place transform, unmatched in/out layouts") - != std::string::npos ) - { - std::cout << "Invalid arguments: for an in-place transform, " - << "in/output layouts must be the same" << std::endl; - FAIL(); - } - else if( error_message.find("device list is empty at transform") != std::string::npos ) - { - std::cout << "A clfft transform is requested, but the device list is empty" << std::endl; - FAIL(); - } - else - { - std::cout << "Unrecognized exception: " << std::endl; - std::cout << error_message << std::endl; - /* + if (error_message.find("problem too large for device") != std::string::npos || + error_message.find("CLFFT_INVALID_BUFFER_SIZE") != std::string::npos || + error_message.find("CLFFT_MEM_OBJECT_ALLOCATION_FAILURE") != + std::string::npos || + error_message.find("CLFFT_OUT_OF_HOST_MEMORY") != std::string::npos || + error_message.find("CLFFT_OUT_OF_RESOURCES") != std::string::npos) { + std::cout << "Data set is too large for this device -- skipping test" + << std::endl; + // TODO put in (this problem size[data + stride]/max problem size/gpu or + // cpu) specifics + } else if (error_message.find("system memory allocation failure") != + std::string::npos) { + std::cout + << "Framework was denied enough system memory to support the data set" + << " -- skipping test" << std::endl; + } else if (error_message.find("CLFFT_DEVICE_NO_DOUBLE") != + std::string::npos) { + std::cout << "Device in context does not support double precision" + << " -- skipping test" << std::endl; + } else if (error_message.find("dereference null pointer") != + std::string::npos) { + std::cout << error_message << std::endl; + FAIL(); + } else if (error_message.find( + "in-place transform, unmatched in/out layouts") != + std::string::npos) { + std::cout << "Invalid arguments: for an in-place transform, " + << "in/output layouts must be the same" << std::endl; + FAIL(); + } else if (error_message.find("device list is empty at transform") != + std::string::npos) { + std::cout << "A clfft transform is requested, but the device list is empty" + << std::endl; + FAIL(); + } else { + std::cout << "Unrecognized exception: " << std::endl; + std::cout << error_message << std::endl; + /* #if defined( _WIN32 ) && defined( _DEBUG ) - ::DebugBreak( ); + ::DebugBreak( ); #endif - */ - FAIL(); - } + */ + FAIL(); + } } /*****************************************************/ size_t max_mem_available_on_cl_device(size_t device_index) { - static size_t g_device_max_mem_size = 0; + static size_t g_device_max_mem_size = 0; - // this is not thread-safe using globals, it is just quick fix for now, todo proper fix - if (g_device_max_mem_size == 0) - { - std::vector< cl_device_id > device_id; - cl_context tempContext = NULL; - device_id = initializeCL( - g_device_type, - (cl_int)device_index, - g_platform_id, - tempContext, - false - ); + // this is not thread-safe using globals, it is just quick fix for now, todo + // proper fix + if (g_device_max_mem_size == 0) { + std::vector device_id; + cl_context tempContext = NULL; + device_id = initializeCL(g_device_type, (cl_int)device_index, g_platform_id, + tempContext, false); - cl_ulong device_max_to_allocate = 0; - if (device_id.size() == 0 || device_index > device_id.size()) - { - } - else - { - OPENCL_V_THROW(::clGetDeviceInfo(device_id[device_index], CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(cl_ulong), &device_max_to_allocate, NULL), - "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( ::clGetDeviceInfo() )"); - } + cl_ulong device_max_to_allocate = 0; + if (device_id.size() == 0 || device_index > device_id.size()) { + } else { + OPENCL_V_THROW(::clGetDeviceInfo( + device_id[device_index], CL_DEVICE_MAX_MEM_ALLOC_SIZE, + sizeof(cl_ulong), &device_max_to_allocate, NULL), + "Getting CL_DEVICE_MAX_MEM_ALLOC_SIZE device info ( " + "::clGetDeviceInfo() )"); + } - cl_command_queue tempQueue = NULL; - cl_event tempEvent = NULL; - ::cleanupCL(&tempContext, &tempQueue, 0, NULL, 0, NULL, &tempEvent); + cl_command_queue tempQueue = NULL; + cl_event tempEvent = NULL; + ::cleanupCL(&tempContext, &tempQueue, 0, NULL, 0, NULL, &tempEvent); - g_device_max_mem_size = static_cast(device_max_to_allocate); - } + g_device_max_mem_size = static_cast(device_max_to_allocate); + } - return g_device_max_mem_size; + return g_device_max_mem_size; } diff --git a/src/tests/test_constants.h b/src/tests/test_constants.h index b882ead4..2ec3b1f0 100644 --- a/src/tests/test_constants.h +++ b/src/tests/test_constants.h @@ -14,163 +14,193 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_TESTCONSTANTS_H ) +#if !defined(CLFFT_TESTCONSTANTS_H) #define CLFFT_TESTCONSTANTS_H #include "clFFT.h" -#include #include +#include -//Pre-callback function strings -#define PRE_MULVAL float2 mulval_pre(__global void* in, uint offset, __global void* userdata)\n \ - { \n \ - float scalar = *((__global float*)userdata + offset); \n \ - float2 ret = *((__global float2*)in + offset) * scalar; \n \ - return ret; \n \ - } - -#define PRE_MULVAL_UDT typedef struct USER_DATA \ - { \ - float scalar1; \ - float scalar2; \ - } USER_DATA; \n \ - float2 mulval_pre(__global void* in, uint offset, __global void* userdata)\n \ - { \n \ - __global USER_DATA *data = ((__global USER_DATA *)userdata + offset); \n \ - float scalar = data->scalar1 * data->scalar2; \n \ - float2 ret = *((__global float2*)in + offset) * scalar; \n \ - return ret; \n \ - } - -#define PRE_MULVAL_DP double2 mulval_pre(__global void* in, uint offset, __global void* userdata)\n \ - { \n \ - double scalar = *((__global double*)userdata + offset); \n \ - double2 ret = *((__global double2*)in + offset) * scalar; \n \ - return ret; \n \ - } - -#define PRE_MULVAL_PLANAR float2 mulval_pre(__global void* inRe, __global void* inIm, uint offset, __global void* userdata)\n \ - { \n \ - float scalar = *((__global float*)userdata + offset); \n \ - float2 ret; \n \ - ret.x = *((__global float*)inRe + offset) * scalar; \n \ - ret.y = *((__global float*)inIm + offset) * scalar; \n \ - return ret; \n \ - } - -#define PRE_MULVAL_PLANAR_DP double2 mulval_pre(__global void* inRe, __global void* inIm, uint offset, __global void* userdata)\n \ - { \n \ - double scalar = *((__global double*)userdata + offset); \n \ - double2 ret; \n \ - ret.x = *((__global double*)inRe + offset) * scalar; \n \ - ret.y = *((__global double*)inIm + offset) * scalar; \n \ - return ret; \n \ - } - -#define PRE_MULVAL_REAL float mulval_pre(__global void* in, uint offset, __global void* userdata)\n \ - { \n \ - float scalar = *((__global float*)userdata + offset); \n \ - float ret = *((__global float*)in + offset) * scalar; \n \ - return ret; \n \ - } - -#define PRE_MULVAL_REAL_DP double mulval_pre(__global void* in, uint offset, __global void* userdata)\n \ - { \n \ - double scalar = *((__global double*)userdata + offset); \n \ - double ret = *((__global double*)in + offset) * scalar; \n \ - return ret; \n \ - } - -//Precallback test for LDS - works when 1 WI works on one input element -#define PRE_MULVAL_LDS float2 mulval_pre(__global void* in, uint offset, __global void* userdata, __local void* localmem)\n \ - { \n \ - uint lid = get_local_id(0); \n \ - __local float* lds = (__local float*)localmem + lid; \n \ - lds[0] = *((__global float*)userdata + offset); \n \ - barrier(CLK_LOCAL_MEM_FENCE); \n \ - float prev = offset <= 0 ? 0 : *(lds - 1); \n \ - float next = offset >= get_global_size(0) ? 0 : *(lds + 1); \n \ - float avg = (prev + *lds + next)/3.0f;\n \ - float2 ret = *((__global float2*)in + offset) * avg; \n \ - return ret; \n \ - } - -//Post-callback function strings -#define POST_MULVAL void mulval_post(__global void *output, uint outoffset, __global void *userdata, float2 fftoutput )\n \ - { \n \ - float scalar = *((__global float*)userdata + outoffset); \n \ - *((__global float2*)output + outoffset) = fftoutput * scalar; \n \ - } - -#define POST_MULVAL_DP void mulval_post(__global void *output, uint outoffset, __global void *userdata, double2 fftoutput )\n \ - { \n \ - double scalar = *((__global double*)userdata + outoffset); \n \ - *((__global double2*)output + outoffset) = fftoutput * scalar; \n \ - } - -#define POST_MULVAL_PLANAR void mulval_post(__global void *outputRe, __global void *outputIm, size_t outoffset, __global void *userdata, float fftoutputRe, float fftoutputIm )\n \ - { \n \ - float scalar = *((__global float*)userdata + outoffset); \n \ - *((__global float*)outputRe + outoffset) = fftoutputRe * scalar; \n \ - *((__global float*)outputIm + outoffset) = fftoutputIm * scalar; \n \ - } - -#define POST_MULVAL_PLANAR_DP void mulval_post(__global void *outputRe, __global void *outputIm, size_t outoffset, __global void *userdata, double fftoutputRe, double fftoutputIm )\n \ - { \n \ - double scalar = *((__global double*)userdata + outoffset); \n \ - *((__global double*)outputRe + outoffset) = fftoutputRe * scalar; \n \ - *((__global double*)outputIm + outoffset) = fftoutputIm * scalar; \n \ - } - -//Postcallback test for LDS - works when 1 WI works on one element. -//Assumes 1D FFT of length 64. -#define POST_MULVAL_LDS void mulval_post(__global void *output, uint outoffset, __global void *userdata, float2 fftoutput, __local void* localmem)\n \ - { \n \ - uint lid = get_local_id(0); \n \ - __local float* lds; \n \ - if (outoffset < 16) \n \ - { \n \ - lds = (__local float*)localmem + lid*4; \n \ - lds[0] = *((__global float*)userdata + lid*4); \n \ - lds[1] = *((__global float*)userdata + lid*4 + 1); \n \ - lds[2] = *((__global float*)userdata + lid*4 + 2); \n \ - lds[3] = *((__global float*)userdata + lid*4 + 3); \n \ - } \n \ - barrier(CLK_LOCAL_MEM_FENCE); \n \ - lds = (__local float*)localmem + outoffset; \n \ - float prev = outoffset <= 0 ? 0 : *(lds - 1); \n \ - float next = outoffset >= (get_global_size(0) - 1) ? 0 : *(lds + 1); \n \ - float avg = (prev + *lds + next)/3.0f; \n \ - *((__global float2*)output + outoffset) = fftoutput * avg; \n \ - } - -#define POST_MULVAL_REAL void mulval_post(__global void *output, uint outoffset, __global void *userdata, float fftoutput )\n \ - { \n \ - float scalar = *((__global float*)userdata + outoffset); \n \ - *((__global float*)output + outoffset) = fftoutput * scalar; \n \ - } - -#define POST_MULVAL_REAL_DP void mulval_post(__global void *output, uint outoffset, __global void *userdata, double fftoutput )\n \ - { \n \ - double scalar = *((__global double*)userdata + outoffset); \n \ - *((__global double*)output + outoffset) = fftoutput * scalar; \n \ - } - -typedef struct USER_DATA - { - float scalar1; - float scalar2; - } USER_DATA; +// Pre-callback function strings +#define PRE_MULVAL \ + float2 mulval_pre(__global void *in, uint offset, \ + __global void *userdata)\n { \ + \n float scalar = *((__global float *)userdata + offset); \ + \n float2 ret = *((__global float2 *)in + offset) * scalar; \ + \n return ret; \ + \n \ + } + +#define PRE_MULVAL_UDT \ + typedef struct USER_DATA { \ + float scalar1; \ + float scalar2; \ + } USER_DATA; \ + \n float2 mulval_pre(__global void *in, uint offset, \ + __global void *userdata)\n { \ + \n __global USER_DATA *data = ((__global USER_DATA *)userdata + offset); \ + \n float scalar = data->scalar1 * data->scalar2; \ + \n float2 ret = *((__global float2 *)in + offset) * scalar; \ + \n return ret; \ + \n \ + } + +#define PRE_MULVAL_DP \ + double2 mulval_pre(__global void *in, uint offset, \ + __global void *userdata)\n { \ + \n double scalar = *((__global double *)userdata + offset); \ + \n double2 ret = *((__global double2 *)in + offset) * scalar; \ + \n return ret; \ + \n \ + } + +#define PRE_MULVAL_PLANAR \ + float2 mulval_pre(__global void *inRe, __global void *inIm, uint offset, \ + __global void *userdata)\n { \ + \n float scalar = *((__global float *)userdata + offset); \ + \n float2 ret; \ + \n ret.x = *((__global float *)inRe + offset) * scalar; \ + \n ret.y = *((__global float *)inIm + offset) * scalar; \ + \n return ret; \ + \n \ + } + +#define PRE_MULVAL_PLANAR_DP \ + double2 mulval_pre(__global void *inRe, __global void *inIm, uint offset, \ + __global void *userdata)\n { \ + \n double scalar = *((__global double *)userdata + offset); \ + \n double2 ret; \ + \n ret.x = *((__global double *)inRe + offset) * scalar; \ + \n ret.y = *((__global double *)inIm + offset) * scalar; \ + \n return ret; \ + \n \ + } + +#define PRE_MULVAL_REAL \ + float mulval_pre(__global void *in, uint offset, \ + __global void *userdata)\n { \ + \n float scalar = *((__global float *)userdata + offset); \ + \n float ret = *((__global float *)in + offset) * scalar; \ + \n return ret; \ + \n \ + } + +#define PRE_MULVAL_REAL_DP \ + double mulval_pre(__global void *in, uint offset, \ + __global void *userdata)\n { \ + \n double scalar = *((__global double *)userdata + offset); \ + \n double ret = *((__global double *)in + offset) * scalar; \ + \n return ret; \ + \n \ + } + +// Precallback test for LDS - works when 1 WI works on one input element +#define PRE_MULVAL_LDS \ + float2 mulval_pre(__global void *in, uint offset, __global void *userdata, \ + __local void *localmem)\n { \ + \n uint lid = get_local_id(0); \ + \n __local float *lds = (__local float *)localmem + lid; \ + \n lds[0] = *((__global float *)userdata + offset); \ + \n barrier(CLK_LOCAL_MEM_FENCE); \ + \n float prev = offset <= 0 ? 0 : *(lds - 1); \ + \n float next = offset >= get_global_size(0) ? 0 : *(lds + 1); \ + \n float avg = (prev + *lds + next) / 3.0f; \ + \n float2 ret = *((__global float2 *)in + offset) * avg; \ + \n return ret; \ + \n \ + } + +// Post-callback function strings +#define POST_MULVAL \ + void mulval_post(__global void *output, uint outoffset, \ + __global void *userdata, float2 fftoutput)\n { \ + \n float scalar = *((__global float *)userdata + outoffset); \ + \n *((__global float2 *)output + outoffset) = fftoutput * scalar; \ + \n \ + } + +#define POST_MULVAL_DP \ + void mulval_post(__global void *output, uint outoffset, \ + __global void *userdata, double2 fftoutput)\n { \ + \n double scalar = *((__global double *)userdata + outoffset); \ + \n *((__global double2 *)output + outoffset) = fftoutput * scalar; \ + \n \ + } + +#define POST_MULVAL_PLANAR \ + void mulval_post(__global void *outputRe, __global void *outputIm, \ + size_t outoffset, __global void *userdata, \ + float fftoutputRe, float fftoutputIm)\n { \ + \n float scalar = *((__global float *)userdata + outoffset); \ + \n *((__global float *)outputRe + outoffset) = fftoutputRe * scalar; \ + \n *((__global float *)outputIm + outoffset) = fftoutputIm * scalar; \ + \n \ + } + +#define POST_MULVAL_PLANAR_DP \ + void mulval_post(__global void *outputRe, __global void *outputIm, \ + size_t outoffset, __global void *userdata, \ + double fftoutputRe, double fftoutputIm)\n { \ + \n double scalar = *((__global double *)userdata + outoffset); \ + \n *((__global double *)outputRe + outoffset) = fftoutputRe * scalar; \ + \n *((__global double *)outputIm + outoffset) = fftoutputIm * scalar; \ + \n \ + } + +// Postcallback test for LDS - works when 1 WI works on one element. +// Assumes 1D FFT of length 64. +#define POST_MULVAL_LDS \ + void mulval_post(__global void *output, uint outoffset, \ + __global void *userdata, float2 fftoutput, \ + __local void *localmem)\n { \ + \n uint lid = get_local_id(0); \ + \n __local float *lds; \ + \n if (outoffset < 16) \n { \ + \n lds = (__local float *)localmem + lid * 4; \ + \n lds[0] = *((__global float *)userdata + lid * 4); \ + \n lds[1] = *((__global float *)userdata + lid * 4 + 1); \ + \n lds[2] = *((__global float *)userdata + lid * 4 + 2); \ + \n lds[3] = *((__global float *)userdata + lid * 4 + 3); \ + \n \ + } \ + \n barrier(CLK_LOCAL_MEM_FENCE); \ + \n lds = (__local float *)localmem + outoffset; \ + \n float prev = outoffset <= 0 ? 0 : *(lds - 1); \ + \n float next = outoffset >= (get_global_size(0) - 1) ? 0 : *(lds + 1); \ + \n float avg = (prev + *lds + next) / 3.0f; \ + \n *((__global float2 *)output + outoffset) = fftoutput * avg; \ + \n \ + } + +#define POST_MULVAL_REAL \ + void mulval_post(__global void *output, uint outoffset, \ + __global void *userdata, float fftoutput)\n { \ + \n float scalar = *((__global float *)userdata + outoffset); \ + \n *((__global float *)output + outoffset) = fftoutput * scalar; \ + \n \ + } + +#define POST_MULVAL_REAL_DP \ + void mulval_post(__global void *output, uint outoffset, \ + __global void *userdata, double fftoutput)\n { \ + \n double scalar = *((__global double *)userdata + outoffset); \ + \n *((__global double *)output + outoffset) = fftoutput * scalar; \ + \n \ + } + +typedef struct USER_DATA { + float scalar1; + float scalar2; +} USER_DATA; #define CALLBCKSTR(...) #__VA_ARGS__ -#define STRINGIFY(...) CALLBCKSTR(__VA_ARGS__) +#define STRINGIFY(...) CALLBCKSTR(__VA_ARGS__) -enum { REAL=0, IMAG=1 }; -enum { dimx=0, dimy=1, dimz=2 }; -enum fftw_dim { one_d=1, two_d=2, three_d=3 }; -enum { one_interleaved_buffer=1, separate_real_and_imaginary_buffers=2 }; +enum { REAL = 0, IMAG = 1 }; +enum { dimx = 0, dimy = 1, dimz = 2 }; +enum fftw_dim { one_d = 1, two_d = 2, three_d = 3 }; +enum { one_interleaved_buffer = 1, separate_real_and_imaginary_buffers = 2 }; const bool use_explicit_intermediate_buffer = true; const bool autogenerate_intermediate_buffer = false; const bool pointwise_compare = true; @@ -219,44 +249,44 @@ extern size_t number_of_random_tests; extern time_t random_test_parameter_seed; extern bool verbose; -void handle_exception( const std::exception& except ); +void handle_exception(const std::exception &except); size_t max_mem_available_on_cl_device(size_t device_index); -// Creating this template function and specializations to control the length inputs to the tests; -// these should be removed once the size restriction on transfrom lengths (SP 2^24 and DP 2^22) -// is removed; the dlarge* constants can then be removed - -template -inline size_t MaxLength2D(size_t rad) -{ - return 0; +// Creating this template function and specializations to control the length +// inputs to the tests; these should be removed once the size restriction on +// transfrom lengths (SP 2^24 and DP 2^22) is removed; the dlarge* constants can +// then be removed + +template inline size_t MaxLength2D(size_t rad) { return 0; } + +template <> inline size_t MaxLength2D(size_t rad) { + switch (rad) { + case 2: + return large2; + case 3: + return large3; + case 5: + return large5; + case 7: + return large7; + default: + return 0; + } } -template <> -inline size_t MaxLength2D(size_t rad) -{ - switch(rad) - { - case 2: return large2; - case 3: return large3; - case 5: return large5; - case 7: return large7; - default: return 0; - } +template <> inline size_t MaxLength2D(size_t rad) { + switch (rad) { + case 2: + return dlarge2; + case 3: + return dlarge3; + case 5: + return dlarge5; + case 7: + return dlarge7; + default: + return 0; + } } -template <> -inline size_t MaxLength2D(size_t rad) -{ - switch(rad) - { - case 2: return dlarge2; - case 3: return dlarge3; - case 5: return dlarge5; - case 7: return dlarge7; - default: return 0; - } -} - - #endif diff --git a/src/tests/typedefs.h b/src/tests/typedefs.h index fb0af1df..86cbc5cc 100644 --- a/src/tests/typedefs.h +++ b/src/tests/typedefs.h @@ -14,14 +14,13 @@ * limitations under the License. * ************************************************************************/ - #pragma once -#if !defined( CLFFT_TYPEDEFS_H ) +#if !defined(CLFFT_TYPEDEFS_H) #define CLFFT_TYPEDEFS_H -#include "test_constants.h" -#include "fftw_transform.h" #include "cl_transform.h" +#include "fftw_transform.h" +#include "test_constants.h" typedef clfft clfft_single; typedef clfft clfft_double; diff --git a/src/tests/unit_test.cpp b/src/tests/unit_test.cpp index 5f0b8b81..601516cf 100644 --- a/src/tests/unit_test.cpp +++ b/src/tests/unit_test.cpp @@ -14,1019 +14,1188 @@ * limitations under the License. * ************************************************************************/ - -#include -#include -#include "clFFT.h" #include "../client/openCL.misc.h" +#include "clFFT.h" #include "test_constants.h" +#include +#include class clfft_UnitTest : public ::testing::Test { protected: - clfft_UnitTest(){} - virtual ~clfft_UnitTest(){} - virtual void SetUp() - { - lengths[ 0 ] = 32; - lengths[ 1 ] = 32; - lengths[ 2 ] = 32; - - commandQueueFlags = 0; - - size_t memSizeBytes = lengths[ 0 ] * lengths[ 1 ] * lengths[ 2 ] * sizeof( std::complex< float > ); - - device_id = initializeCL( g_device_type, g_device_id, g_platform_id, context, printInfo ); - createOpenCLCommandQueue( context, - commandQueueFlags, - queue, - device_id, - memSizeBytes, 1, &cl_mem_input, - memSizeBytes, 1, &cl_mem_output - ); - - outEvent = NULL; - - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - } - - virtual void TearDown() - { - if( test_plan != 0 ) - { - clfftDestroyPlan( &test_plan ); - clfftTeardown(); - } - - cleanupCL( &context, &queue, 1, &cl_mem_input, 1, &cl_mem_output, &outEvent ); - } - - clfftPlanHandle test_plan; - size_t lengths[3]; - - // We need a valid context for clfftCreateDefaultPlan to work - cl_context context; - cl_command_queue queue; - std::vector< cl_device_id > device_id; - cl_event outEvent; - static const bool printInfo = false; - cl_uint commandQueueFlags; - - // These are not used, they are only placeholders for initializeCL - cl_mem cl_mem_input; - cl_mem cl_mem_output; + clfft_UnitTest() {} + virtual ~clfft_UnitTest() {} + virtual void SetUp() { + lengths[0] = 32; + lengths[1] = 32; + lengths[2] = 32; + + commandQueueFlags = 0; + + size_t memSizeBytes = + lengths[0] * lengths[1] * lengths[2] * sizeof(std::complex); + + device_id = initializeCL(g_device_type, g_device_id, g_platform_id, context, + printInfo); + createOpenCLCommandQueue(context, commandQueueFlags, queue, device_id, + memSizeBytes, 1, &cl_mem_input, memSizeBytes, 1, + &cl_mem_output); + + outEvent = NULL; + + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + } + + virtual void TearDown() { + if (test_plan != 0) { + clfftDestroyPlan(&test_plan); + clfftTeardown(); + } + + cleanupCL(&context, &queue, 1, &cl_mem_input, 1, &cl_mem_output, &outEvent); + } + + clfftPlanHandle test_plan; + size_t lengths[3]; + + // We need a valid context for clfftCreateDefaultPlan to work + cl_context context; + cl_command_queue queue; + std::vector device_id; + cl_event outEvent; + static const bool printInfo = false; + cl_uint commandQueueFlags; + + // These are not used, they are only placeholders for initializeCL + cl_mem cl_mem_input; + cl_mem cl_mem_output; }; TEST_F(clfft_UnitTest, get_plan_context_should_get_a_context) { - cl_context the_context = NULL; + cl_context the_context = NULL; - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanContext( test_plan, &the_context ) ); - if( the_context == NULL ) - EXPECT_EQ( "context is null :(", "context should not be null"); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanContext(test_plan, &the_context)); + if (the_context == NULL) + EXPECT_EQ("context is null :(", "context should not be null"); } TEST_F(clfft_UnitTest, copyPlan_should_copy_plan) { - clfftPlanHandle copied_plan; - cl_context new_context = NULL; - - lengths[0] = 8; - lengths[1] = 16; - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanPrecision( test_plan, CLFFT_SINGLE ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_FORWARD, 42.0f ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_BACKWARD, 0.24f ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 8*16, 8*16 ) ); - - size_t clStrides[ ] = { 1, 8 }; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_2D, clStrides ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_2D, clStrides ) ); - - // TODO need to have created context by now; clfftPlanHandle is no longer a pointer - clfftCopyPlan( &copied_plan, context, test_plan ); - - //EXPECT_EQ( false, copied_plan.baked ); - //EXPECT_EQ( CLFFT_2D, copied_plan.dim ); - //EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, copied_plan.inputLayout ); - //EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, copied_plan.outputLayout ); - //EXPECT_EQ( CLFFT_OUTOFPLACE, copied_plan.placeness ); - //EXPECT_EQ( CLFFT_SINGLE, copied_plan.precision ); - ////TODO check context here - //EXPECT_FLOAT_EQ( 42.0f, copied_plan.forwardScale ); - //EXPECT_FLOAT_EQ( 0.24f, copied_plan.backwardScale ); - //EXPECT_EQ( 8*16, copied_plan.pitch ); - //EXPECT_EQ( 2, copied_plan.length.size() ); - //EXPECT_EQ( 8, copied_plan.length[0] ); - //EXPECT_EQ( 16, copied_plan.length[1] ); - //EXPECT_EQ( 2, copied_plan.inStride.size() ); - //EXPECT_EQ( 1, copied_plan.inStride[0] ); - //EXPECT_EQ( 8, copied_plan.inStride[1] ); - //EXPECT_EQ( 2, copied_plan.outStride.size() ); - //EXPECT_EQ( 1, copied_plan.outStride[0] ); - //EXPECT_EQ( 8, copied_plan.outStride[1] ); - - clfftDestroyPlan( &copied_plan ); + clfftPlanHandle copied_plan; + cl_context new_context = NULL; + + lengths[0] = 8; + lengths[1] = 16; + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetLayout(test_plan, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanPrecision(test_plan, CLFFT_SINGLE)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_FORWARD, 42.0f)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_BACKWARD, 0.24f)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 8 * 16, 8 * 16)); + + size_t clStrides[] = {1, 8}; + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_2D, clStrides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_2D, clStrides)); + + // TODO need to have created context by now; clfftPlanHandle is no longer a + // pointer + clfftCopyPlan(&copied_plan, context, test_plan); + + // EXPECT_EQ( false, copied_plan.baked ); + // EXPECT_EQ( CLFFT_2D, copied_plan.dim ); + // EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, copied_plan.inputLayout ); + // EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, copied_plan.outputLayout ); + // EXPECT_EQ( CLFFT_OUTOFPLACE, copied_plan.placeness ); + // EXPECT_EQ( CLFFT_SINGLE, copied_plan.precision ); + ////TODO check context here + // EXPECT_FLOAT_EQ( 42.0f, copied_plan.forwardScale ); + // EXPECT_FLOAT_EQ( 0.24f, copied_plan.backwardScale ); + // EXPECT_EQ( 8*16, copied_plan.pitch ); + // EXPECT_EQ( 2, copied_plan.length.size() ); + // EXPECT_EQ( 8, copied_plan.length[0] ); + // EXPECT_EQ( 16, copied_plan.length[1] ); + // EXPECT_EQ( 2, copied_plan.inStride.size() ); + // EXPECT_EQ( 1, copied_plan.inStride[0] ); + // EXPECT_EQ( 8, copied_plan.inStride[1] ); + // EXPECT_EQ( 2, copied_plan.outStride.size() ); + // EXPECT_EQ( 1, copied_plan.outStride[0] ); + // EXPECT_EQ( 8, copied_plan.outStride[1] ); + + clfftDestroyPlan(&copied_plan); } TEST_F(clfft_UnitTest, copyPlan_should_increase_context_reference_count) { - //TODO me + // TODO me } -//TODO need to promote some things in client.cpp to a library to write this -//TEST_F(clfft_UnitTest, getPlanContext_should_yield_appropriate_values) { +// TODO need to promote some things in client.cpp to a library to write this +// TEST_F(clfft_UnitTest, getPlanContext_should_yield_appropriate_values) { //} TEST_F(clfft_UnitTest, getPlanBatchSize_should_yield_appropriate_values) { - size_t batch_size; - - lengths[0] = 2; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( test_plan, 1 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanBatchSize( test_plan, &batch_size ) ); - EXPECT_EQ( 1, batch_size ); - - lengths[0] = 4; - lengths[1] = 2; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( test_plan, 8 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanBatchSize( test_plan, &batch_size ) ); - EXPECT_EQ( 8, batch_size ); - - lengths[0] = 4; - lengths[1] = 2; - lengths[2] = 8; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( test_plan, 16 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanBatchSize( test_plan, &batch_size ) ); - EXPECT_EQ( 16, batch_size ); + size_t batch_size; + + lengths[0] = 2; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanBatchSize(test_plan, 1)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanBatchSize(test_plan, &batch_size)); + EXPECT_EQ(1, batch_size); + + lengths[0] = 4; + lengths[1] = 2; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanBatchSize(test_plan, 8)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanBatchSize(test_plan, &batch_size)); + EXPECT_EQ(8, batch_size); + + lengths[0] = 4; + lengths[1] = 2; + lengths[2] = 8; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanBatchSize(test_plan, 16)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanBatchSize(test_plan, &batch_size)); + EXPECT_EQ(16, batch_size); } TEST_F(clfft_UnitTest, setPlanBatchSize_should_set_batch_size_correctly) { - size_t batch_size; - lengths[0] = 1; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( test_plan, 1 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanBatchSize( test_plan, &batch_size ) ); - EXPECT_EQ( 1, batch_size ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( test_plan, 2 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanBatchSize( test_plan, &batch_size ) ); - EXPECT_EQ( 2, batch_size ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanBatchSize( test_plan, 16 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanBatchSize( test_plan, &batch_size ) ); - EXPECT_EQ( 16, batch_size ); + size_t batch_size; + lengths[0] = 1; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanBatchSize(test_plan, 1)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanBatchSize(test_plan, &batch_size)); + EXPECT_EQ(1, batch_size); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanBatchSize(test_plan, 2)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanBatchSize(test_plan, &batch_size)); + EXPECT_EQ(2, batch_size); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanBatchSize(test_plan, 16)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanBatchSize(test_plan, &batch_size)); + EXPECT_EQ(16, batch_size); } TEST_F(clfft_UnitTest, getPlanPrecision_should_yield_appropriate_values) { - clfftPrecision precision; + clfftPrecision precision; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanPrecision( test_plan, CLFFT_SINGLE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanPrecision( test_plan, &precision ) ); - EXPECT_EQ( CLFFT_SINGLE, precision ); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanPrecision(test_plan, CLFFT_SINGLE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanPrecision(test_plan, &precision)); + EXPECT_EQ(CLFFT_SINGLE, precision); } -TEST_F(clfft_UnitTest, setPlanPrecision_should_set_precision_to_supported_values) { +TEST_F(clfft_UnitTest, + setPlanPrecision_should_set_precision_to_supported_values) { - clfftPrecision precision; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanPrecision( test_plan, CLFFT_SINGLE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanPrecision( test_plan, &precision ) ); - EXPECT_EQ( CLFFT_SINGLE, precision ); + clfftPrecision precision; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanPrecision(test_plan, CLFFT_SINGLE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanPrecision(test_plan, &precision)); + EXPECT_EQ(CLFFT_SINGLE, precision); } TEST_F(clfft_UnitTest, setPlanPrecision_should_fail_to_set_unsupported_values) { - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanPrecision( test_plan, CLFFT_SINGLE_FAST ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanPrecision( test_plan, CLFFT_DOUBLE_FAST ) ); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanPrecision(test_plan, CLFFT_SINGLE_FAST)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanPrecision(test_plan, CLFFT_DOUBLE_FAST)); } TEST_F(clfft_UnitTest, getPlanScale_should_yield_appropriate_values) { - cl_float scale; - - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_FORWARD, 1.414f ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_BACKWARD, 2.718f ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_FORWARD, &scale ) ); - EXPECT_FLOAT_EQ( 1.414f, scale ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_BACKWARD, &scale ) ); - EXPECT_FLOAT_EQ( 2.718f, scale ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_MINUS, &scale ) ); - EXPECT_FLOAT_EQ( 1.414f, scale ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_PLUS, &scale ) ); - EXPECT_FLOAT_EQ( 2.718f, scale ); + cl_float scale; + + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_FORWARD, 1.414f)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanScale(test_plan, CLFFT_BACKWARD, 2.718f)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanScale(test_plan, CLFFT_FORWARD, &scale)); + EXPECT_FLOAT_EQ(1.414f, scale); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanScale(test_plan, CLFFT_BACKWARD, &scale)); + EXPECT_FLOAT_EQ(2.718f, scale); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanScale(test_plan, CLFFT_MINUS, &scale)); + EXPECT_FLOAT_EQ(1.414f, scale); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanScale(test_plan, CLFFT_PLUS, &scale)); + EXPECT_FLOAT_EQ(2.718f, scale); } TEST_F(clfft_UnitTest, getPlanScale_should_fail_on_invalid_direction) { - cl_float scale; + cl_float scale; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftGetPlanScale( test_plan, ENDDIRECTION, &scale ) ); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftGetPlanScale(test_plan, ENDDIRECTION, &scale)); } TEST_F(clfft_UnitTest, setPlanScale_should_set_scale_correctly) { - cl_float scale; - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_FORWARD, 1.57f ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_FORWARD, &scale ) ); - EXPECT_FLOAT_EQ( 1.57f, scale ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_BACKWARD, 3.14f ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_BACKWARD, &scale ) ); - EXPECT_FLOAT_EQ( 3.14f, scale ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_MINUS, 4.71f ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_MINUS, &scale ) ); - EXPECT_FLOAT_EQ( 4.71f, scale ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanScale( test_plan, CLFFT_PLUS, 6.28f ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanScale( test_plan, CLFFT_PLUS, &scale ) ); - EXPECT_FLOAT_EQ( 6.28f, scale ); + cl_float scale; + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_FORWARD, 1.57f)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanScale(test_plan, CLFFT_FORWARD, &scale)); + EXPECT_FLOAT_EQ(1.57f, scale); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_BACKWARD, 3.14f)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanScale(test_plan, CLFFT_BACKWARD, &scale)); + EXPECT_FLOAT_EQ(3.14f, scale); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_MINUS, 4.71f)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanScale(test_plan, CLFFT_MINUS, &scale)); + EXPECT_FLOAT_EQ(4.71f, scale); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanScale(test_plan, CLFFT_PLUS, 6.28f)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanScale(test_plan, CLFFT_PLUS, &scale)); + EXPECT_FLOAT_EQ(6.28f, scale); } TEST_F(clfft_UnitTest, setPlanScale_should_fail_on_invalid_direction) { - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanScale( test_plan, ENDDIRECTION, 42.0 ) ); -} - -TEST_F(clfft_UnitTest, setPlanDimLength_should_set_dimensions_to_supported_values) { - cl_uint lengthSize = 0; - clfftDim dim; - size_t testLengths[ 3 ]; - - lengths[0] = 1; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_1D ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( 1, lengthSize ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_1D, testLengths ) ); - EXPECT_EQ( CLFFT_1D, dim ); - EXPECT_EQ( 1, testLengths[0] ); - - - lengths[0] = 2; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_1D, testLengths ) ); - EXPECT_EQ( 2, testLengths[0] ); - - lengths[0] = 4; - lengths[1] = 8; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_2D, dim ); - EXPECT_EQ( 2, lengthSize ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_2D, testLengths ) ); - EXPECT_EQ( 4, testLengths[0] ); - EXPECT_EQ( 8, testLengths[1] ); - - lengths[0] = 32; - lengths[1] = 64; - lengths[2] = 128; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_3D, dim ); - EXPECT_EQ( 3, lengthSize ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_3D, testLengths ) ); - EXPECT_EQ( 32, testLengths[0] ); - EXPECT_EQ( 64, testLengths[1] ); - EXPECT_EQ( 128, testLengths[2] ); - - lengths[0] = 2; - lengths[1] = 3; - lengths[2] = 5; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_3D, dim ); - EXPECT_EQ( 3, lengthSize ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_3D, testLengths ) ); - EXPECT_EQ( 2, testLengths[0] ); - EXPECT_EQ( 3, testLengths[1] ); - EXPECT_EQ( 5, testLengths[2] ); - - lengths[0] = 4; - lengths[1] = 9; - lengths[2] = 25; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_3D, dim ); - EXPECT_EQ( 3, lengthSize ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_3D, testLengths ) ); - EXPECT_EQ( 4, testLengths[0] ); - EXPECT_EQ( 9, testLengths[1] ); - EXPECT_EQ( 25, testLengths[2] ); - - lengths[0] = 10; - lengths[1] = 144; - lengths[2] = 2700; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_3D, dim ); - EXPECT_EQ( 3, lengthSize ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_3D, testLengths ) ); - EXPECT_EQ( 10, testLengths[0] ); - EXPECT_EQ( 144, testLengths[1] ); - EXPECT_EQ( 2700, testLengths[2] ); -} - -TEST_F(clfft_UnitTest, setPlanDimLength_should_fail_if_a_length_is_set_to_zero) { - lengths[0] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - - lengths[0] = 4; - lengths[1] = 0; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - - lengths[0] = 0; - lengths[1] = 4; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - - lengths[0] = 0; - lengths[1] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - - lengths[0] = 0; - lengths[1] = 4; - lengths[2] = 4; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - - lengths[0] = 4; - lengths[1] = 0; - lengths[2] = 4; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - - lengths[0] = 4; - lengths[1] = 4; - lengths[2] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - - lengths[0] = 0; - lengths[1] = 0; - lengths[2] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); -} - -TEST_F(clfft_UnitTest, setPlanDimLength_should_fail_on_radices_that_have_non_supported_factors) { - // currently only factors of 2, 3, 5, 7, 11, and 13 are supported - lengths[0] = 2*3*5*7*11*13*19; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - - lengths[0] = 2*2*3*3*5*5*5*5*13; - lengths[1] = 17; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - - lengths[0] = 5*23; - lengths[1] = 2*2*3; - lengths[2] = 5*3*2*2*2*2*2*2*2*7*29; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); -} - -TEST_F(clfft_UnitTest, setPlanDimLength_should_set_values_to_second_set_when_called_twice) { - cl_uint lengthSize = 0; - clfftDim dim; - size_t testLengths[ 1 ]; - - lengths[0] = 2; - lengths[1] = 4; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_1D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_1D, testLengths ) ); - EXPECT_EQ( CLFFT_1D, dim ); - EXPECT_EQ( 1, lengthSize ); - EXPECT_EQ( 2, testLengths[ 0 ] ); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanScale(test_plan, ENDDIRECTION, 42.0)); +} + +TEST_F(clfft_UnitTest, + setPlanDimLength_should_set_dimensions_to_supported_values) { + cl_uint lengthSize = 0; + clfftDim dim; + size_t testLengths[3]; + + lengths[0] = 1; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_1D)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(1, lengthSize); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_1D, testLengths)); + EXPECT_EQ(CLFFT_1D, dim); + EXPECT_EQ(1, testLengths[0]); + + lengths[0] = 2; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_1D, testLengths)); + EXPECT_EQ(2, testLengths[0]); + + lengths[0] = 4; + lengths[1] = 8; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_2D, dim); + EXPECT_EQ(2, lengthSize); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_2D, testLengths)); + EXPECT_EQ(4, testLengths[0]); + EXPECT_EQ(8, testLengths[1]); + + lengths[0] = 32; + lengths[1] = 64; + lengths[2] = 128; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_3D, dim); + EXPECT_EQ(3, lengthSize); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_3D, testLengths)); + EXPECT_EQ(32, testLengths[0]); + EXPECT_EQ(64, testLengths[1]); + EXPECT_EQ(128, testLengths[2]); + + lengths[0] = 2; + lengths[1] = 3; + lengths[2] = 5; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_3D, dim); + EXPECT_EQ(3, lengthSize); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_3D, testLengths)); + EXPECT_EQ(2, testLengths[0]); + EXPECT_EQ(3, testLengths[1]); + EXPECT_EQ(5, testLengths[2]); + + lengths[0] = 4; + lengths[1] = 9; + lengths[2] = 25; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_3D, dim); + EXPECT_EQ(3, lengthSize); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_3D, testLengths)); + EXPECT_EQ(4, testLengths[0]); + EXPECT_EQ(9, testLengths[1]); + EXPECT_EQ(25, testLengths[2]); + + lengths[0] = 10; + lengths[1] = 144; + lengths[2] = 2700; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_3D, dim); + EXPECT_EQ(3, lengthSize); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_3D, testLengths)); + EXPECT_EQ(10, testLengths[0]); + EXPECT_EQ(144, testLengths[1]); + EXPECT_EQ(2700, testLengths[2]); +} + +TEST_F(clfft_UnitTest, + setPlanDimLength_should_fail_if_a_length_is_set_to_zero) { + lengths[0] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + + lengths[0] = 4; + lengths[1] = 0; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + + lengths[0] = 0; + lengths[1] = 4; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + + lengths[0] = 0; + lengths[1] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + + lengths[0] = 0; + lengths[1] = 4; + lengths[2] = 4; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + + lengths[0] = 4; + lengths[1] = 0; + lengths[2] = 4; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + + lengths[0] = 4; + lengths[1] = 4; + lengths[2] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + + lengths[0] = 0; + lengths[1] = 0; + lengths[2] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); +} + +TEST_F( + clfft_UnitTest, + setPlanDimLength_should_fail_on_radices_that_have_non_supported_factors) { + // currently only factors of 2, 3, 5, 7, 11, and 13 are supported + lengths[0] = 2 * 3 * 5 * 7 * 11 * 13 * 19; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + + lengths[0] = 2 * 2 * 3 * 3 * 5 * 5 * 5 * 5 * 13; + lengths[1] = 17; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + + lengths[0] = 5 * 23; + lengths[1] = 2 * 2 * 3; + lengths[2] = 5 * 3 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 7 * 29; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); +} + +TEST_F(clfft_UnitTest, + setPlanDimLength_should_set_values_to_second_set_when_called_twice) { + cl_uint lengthSize = 0; + clfftDim dim; + size_t testLengths[1]; + + lengths[0] = 2; + lengths[1] = 4; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_1D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_1D, testLengths)); + EXPECT_EQ(CLFFT_1D, dim); + EXPECT_EQ(1, lengthSize); + EXPECT_EQ(2, testLengths[0]); } TEST_F(clfft_UnitTest, getPlanDimLength_should_yield_correct_values) { - clfftDim dim; - cl_uint lengthSize = 0; - size_t gotten_lengths[3]; - - lengths[0] = 1; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_1D, gotten_lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_1D, dim ); - EXPECT_EQ( 1, gotten_lengths[0] ); - - lengths[0] = 2; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_1D, gotten_lengths ) ); - EXPECT_EQ( 2, gotten_lengths[0] ); - - lengths[0] = 1; - lengths[1] = 1; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_2D, gotten_lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_2D, dim ); - EXPECT_EQ( 1, gotten_lengths[0] ); - EXPECT_EQ( 1, gotten_lengths[1] ); - - lengths[0] = 2; - lengths[1] = 4; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_2D, gotten_lengths ) ); - EXPECT_EQ( 2, gotten_lengths[0] ); - EXPECT_EQ( 4, gotten_lengths[1] ); - - lengths[0] = 1; - lengths[1] = 1; - lengths[2] = 1; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_3D, gotten_lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDim( test_plan, &dim, &lengthSize ) ); - EXPECT_EQ( CLFFT_3D, dim ); - EXPECT_EQ( 1, gotten_lengths[0] ); - EXPECT_EQ( 1, gotten_lengths[1] ); - EXPECT_EQ( 1, gotten_lengths[2] ); - - lengths[0] = 2; - lengths[1] = 4; - lengths[2] = 8; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanLength( test_plan, CLFFT_3D, gotten_lengths ) ); - EXPECT_EQ( CLFFT_3D, dim ); - EXPECT_EQ( 2, gotten_lengths[0] ); - EXPECT_EQ( 4, gotten_lengths[1] ); - EXPECT_EQ( 8, gotten_lengths[2] ); + clfftDim dim; + cl_uint lengthSize = 0; + size_t gotten_lengths[3]; + + lengths[0] = 1; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_1D, gotten_lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_1D, dim); + EXPECT_EQ(1, gotten_lengths[0]); + + lengths[0] = 2; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_1D, gotten_lengths)); + EXPECT_EQ(2, gotten_lengths[0]); + + lengths[0] = 1; + lengths[1] = 1; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_2D, gotten_lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_2D, dim); + EXPECT_EQ(1, gotten_lengths[0]); + EXPECT_EQ(1, gotten_lengths[1]); + + lengths[0] = 2; + lengths[1] = 4; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_2D, gotten_lengths)); + EXPECT_EQ(2, gotten_lengths[0]); + EXPECT_EQ(4, gotten_lengths[1]); + + lengths[0] = 1; + lengths[1] = 1; + lengths[2] = 1; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_3D, gotten_lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanDim(test_plan, &dim, &lengthSize)); + EXPECT_EQ(CLFFT_3D, dim); + EXPECT_EQ(1, gotten_lengths[0]); + EXPECT_EQ(1, gotten_lengths[1]); + EXPECT_EQ(1, gotten_lengths[2]); + + lengths[0] = 2; + lengths[1] = 4; + lengths[2] = 8; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanLength(test_plan, CLFFT_3D, gotten_lengths)); + EXPECT_EQ(CLFFT_3D, dim); + EXPECT_EQ(2, gotten_lengths[0]); + EXPECT_EQ(4, gotten_lengths[1]); + EXPECT_EQ(8, gotten_lengths[2]); } TEST_F(clfft_UnitTest, getPlanLength_should_fail_when_passed_null_pointer) { - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftGetPlanLength( test_plan, CLFFT_1D, NULL ) ); + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftGetPlanLength(test_plan, CLFFT_1D, NULL)); } TEST_F(clfft_UnitTest, getPlanInStride_should_fail_when_passed_null_pointer) { - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftGetPlanInStride( test_plan, CLFFT_1D, NULL ) ); + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftGetPlanInStride(test_plan, CLFFT_1D, NULL)); } TEST_F(clfft_UnitTest, getPlanOutStride_should_fail_when_passed_null_pointer) { - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftGetPlanOutStride( test_plan, CLFFT_1D, NULL ) ); + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftGetPlanOutStride(test_plan, CLFFT_1D, NULL)); } TEST_F(clfft_UnitTest, createDefaultPlan_should_fail_when_passed_null_pointer) { - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, NULL)); + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, NULL)); } TEST_F(clfft_UnitTest, createDefaultPlan_should_fail_when_passed_length_of_0) { - size_t length[3] = {1,1,1}; - - length[0] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, length)); - - length[0] = 1; - length[1] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_2D, length)); - length[0] = 0; - length[1] = 1; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_2D, length)); - length[0] = 0; - length[1] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_2D, length)); - - length[0] = 1; - length[1] = 1; - length[2] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); - length[0] = 1; - length[1] = 0; - length[2] = 1; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); - length[0] = 0; - length[1] = 1; - length[2] = 1; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); - length[0] = 0; - length[1] = 0; - length[2] = 0; - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); -} - -TEST_F(clfft_UnitTest, createDefaultPlan_should_fail_when_passed_invalid_dimension) { - size_t length[3] = {1,1,1}; - - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, ENDDIMENSION, length)); -} - -TEST_F(clfft_UnitTest, createDefaultPlan_should_fail_when_passed_unsupported_length) { - size_t length[3] = {1,1,1}; - - length[0] = 17; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, length)); - - length[0] = 23; - length[1] = 1; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_2D, length)); - length[0] = 1; - length[1] = 34; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_2D, length)); - length[0] = 19; - length[1] = 22; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_2D, length)); - - length[0] = 1; - length[1] = 97; - length[2] = 221; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); - length[0] = 1; - length[1] = 17; - length[2] = 1; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); - length[0] = 87; - length[1] = 1; - length[2] = 1; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); - length[0] = 5; - length[1] = 6; - length[2] = 17; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftCreateDefaultPlan( &test_plan, context, CLFFT_3D, length)); -} - -TEST_F(clfft_UnitTest, setPlanInStride_should_set_input_strides_to_supported_values) { - size_t strides[ ] = { 1, 16, 16*32 }; - size_t gotten_strides[3]; - - lengths[0] = 16; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_1D, strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanInStride( test_plan, CLFFT_1D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[0] ); - - lengths[0] = 16; - lengths[1] = 32; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_2D, strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanInStride( test_plan, CLFFT_2D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[0] ); - EXPECT_EQ( 16, gotten_strides[1] ); - - lengths[0] = 16; - lengths[1] = 32; - lengths[2] = 64; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_3D, strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanInStride( test_plan, CLFFT_3D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[0] ); - EXPECT_EQ( 16, gotten_strides[1] ); - EXPECT_EQ( 16*32, gotten_strides[2] ); + size_t length[3] = {1, 1, 1}; + + length[0] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, length)); + + length[0] = 1; + length[1] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_2D, length)); + length[0] = 0; + length[1] = 1; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_2D, length)); + length[0] = 0; + length[1] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_2D, length)); + + length[0] = 1; + length[1] = 1; + length[2] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); + length[0] = 1; + length[1] = 0; + length[2] = 1; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); + length[0] = 0; + length[1] = 1; + length[2] = 1; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); + length[0] = 0; + length[1] = 0; + length[2] = 0; + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); +} + +TEST_F(clfft_UnitTest, + createDefaultPlan_should_fail_when_passed_invalid_dimension) { + size_t length[3] = {1, 1, 1}; + + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, ENDDIMENSION, length)); +} + +TEST_F(clfft_UnitTest, + createDefaultPlan_should_fail_when_passed_unsupported_length) { + size_t length[3] = {1, 1, 1}; + + length[0] = 17; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, length)); + + length[0] = 23; + length[1] = 1; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_2D, length)); + length[0] = 1; + length[1] = 34; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_2D, length)); + length[0] = 19; + length[1] = 22; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_2D, length)); + + length[0] = 1; + length[1] = 97; + length[2] = 221; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); + length[0] = 1; + length[1] = 17; + length[2] = 1; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); + length[0] = 87; + length[1] = 1; + length[2] = 1; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); + length[0] = 5; + length[1] = 6; + length[2] = 17; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftCreateDefaultPlan(&test_plan, context, CLFFT_3D, length)); +} + +TEST_F(clfft_UnitTest, + setPlanInStride_should_set_input_strides_to_supported_values) { + size_t strides[] = {1, 16, 16 * 32}; + size_t gotten_strides[3]; + + lengths[0] = 16; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanInStride(test_plan, CLFFT_1D, strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanInStride(test_plan, CLFFT_1D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + + lengths[0] = 16; + lengths[1] = 32; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanInStride(test_plan, CLFFT_2D, strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanInStride(test_plan, CLFFT_2D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(16, gotten_strides[1]); + + lengths[0] = 16; + lengths[1] = 32; + lengths[2] = 64; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanInStride(test_plan, CLFFT_3D, strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanInStride(test_plan, CLFFT_3D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(16, gotten_strides[1]); + EXPECT_EQ(16 * 32, gotten_strides[2]); } TEST_F(clfft_UnitTest, getPlanInStride_should_yield_correct_values) { - size_t input_strides[ ] = { 1, 8, 8*16 }; - size_t output_strides[ ] = { 3, 99, 456789 }; - size_t gotten_strides[ 3 ]; - - size_t x; - - lengths[0] = 8; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_1D, input_strides ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_1D, output_strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanInStride( test_plan, CLFFT_1D, &x ) ); - EXPECT_EQ( 1, x ); - - lengths[0] = 8; - lengths[1] = 16; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_2D, input_strides) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_2D, output_strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanInStride( test_plan, CLFFT_2D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[ 0 ] ); - EXPECT_EQ( 8, gotten_strides[ 1 ] ); - - lengths[0] = 8; - lengths[1] = 16; - lengths[2] = 32; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_3D, input_strides) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_3D, output_strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanInStride( test_plan, CLFFT_3D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[ 0 ] ); - EXPECT_EQ( 8, gotten_strides[ 1 ] ); - EXPECT_EQ( 8*16, gotten_strides[ 2 ] ); -} - -TEST_F(clfft_UnitTest, setPlanOutStride_should_set_output_strides_to_supported_values) { - size_t strides[ ] = { 1, 16, 16*32 }; - size_t gotten_strides[3]; - - lengths[0] = 16; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_1D, strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanOutStride( test_plan, CLFFT_1D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[0] ); - - lengths[0] = 16; - lengths[1] = 32; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_2D, strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanOutStride( test_plan, CLFFT_2D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[0] ); - EXPECT_EQ( 16, gotten_strides[1] ); - - lengths[0] = 16; - lengths[1] = 32; - lengths[2] = 64; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_3D, strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanOutStride( test_plan, CLFFT_3D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[0] ); - EXPECT_EQ( 16, gotten_strides[1] ); - EXPECT_EQ( 16*32, gotten_strides[2] ); + size_t input_strides[] = {1, 8, 8 * 16}; + size_t output_strides[] = {3, 99, 456789}; + size_t gotten_strides[3]; + + size_t x; + + lengths[0] = 8; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_1D, input_strides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_1D, output_strides)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanInStride(test_plan, CLFFT_1D, &x)); + EXPECT_EQ(1, x); + + lengths[0] = 8; + lengths[1] = 16; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_2D, input_strides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_2D, output_strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanInStride(test_plan, CLFFT_2D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(8, gotten_strides[1]); + + lengths[0] = 8; + lengths[1] = 16; + lengths[2] = 32; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_3D, input_strides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_3D, output_strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanInStride(test_plan, CLFFT_3D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(8, gotten_strides[1]); + EXPECT_EQ(8 * 16, gotten_strides[2]); +} + +TEST_F(clfft_UnitTest, + setPlanOutStride_should_set_output_strides_to_supported_values) { + size_t strides[] = {1, 16, 16 * 32}; + size_t gotten_strides[3]; + + lengths[0] = 16; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanOutStride(test_plan, CLFFT_1D, strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanOutStride(test_plan, CLFFT_1D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + + lengths[0] = 16; + lengths[1] = 32; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanOutStride(test_plan, CLFFT_2D, strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanOutStride(test_plan, CLFFT_2D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(16, gotten_strides[1]); + + lengths[0] = 16; + lengths[1] = 32; + lengths[2] = 64; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanOutStride(test_plan, CLFFT_3D, strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanOutStride(test_plan, CLFFT_3D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(16, gotten_strides[1]); + EXPECT_EQ(16 * 32, gotten_strides[2]); } TEST_F(clfft_UnitTest, getPlanOutStride_should_yield_correct_values) { - size_t input_strides[ ] = { 3, 99, 456789 }; - size_t output_strides[ ] = { 1, 8, 8*16 }; - size_t gotten_strides[ 3 ]; - - size_t x; - - lengths[0] = 8; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_1D, input_strides ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_1D, output_strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanOutStride( test_plan, CLFFT_1D, &x ) ); - EXPECT_EQ( 1, x ); - - lengths[0] = 8; - lengths[1] = 16; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_2D, input_strides) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_2D, output_strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanOutStride( test_plan, CLFFT_2D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[ 0 ] ); - EXPECT_EQ( 8, gotten_strides[ 1 ] ); - - lengths[0] = 8; - lengths[1] = 16; - lengths[2] = 32; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_3D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_3D, lengths ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanInStride( test_plan, CLFFT_3D, input_strides) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanOutStride( test_plan, CLFFT_3D, output_strides ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanOutStride( test_plan, CLFFT_3D, gotten_strides ) ); - EXPECT_EQ( 1, gotten_strides[ 0 ] ); - EXPECT_EQ( 8, gotten_strides[ 1 ] ); - EXPECT_EQ( 8*16, gotten_strides[ 2 ] ); -} - -TEST_F(clfft_UnitTest, setPlanDistance_should_set_distance_to_supported_values) { - size_t inDistance, outDistance; - lengths[0] = 8; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 8+10, 8+2 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 18, inDistance ); - EXPECT_EQ( 10, outDistance ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 8+3, 8+11 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 11, inDistance ); - EXPECT_EQ( 19, outDistance ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 8, 8 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 8, inDistance ); - EXPECT_EQ( 8, outDistance ); - - lengths[0] = 2; - lengths[1] = 2; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDim( test_plan, CLFFT_2D ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 2*2+10, 2*2+2 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 14, inDistance ); - EXPECT_EQ( 6, outDistance ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 2*2+3, 2*2+11 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 7, inDistance ); - EXPECT_EQ( 15, outDistance ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 2*2, 2*2 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 4, inDistance ); - EXPECT_EQ( 4, outDistance ); -} - -TEST_F(clfft_UnitTest, setPlanDistance_should_fail_to_set_pitch_to_smaller_than_one_dataset) { - lengths[0] = 32; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 32-30, 32-30 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 32-16, 32-16 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 32-1, 32-1 ) ); - - lengths[0] = 32; - lengths[1] = 32; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_1D, lengths ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 32*32-30, 32*32-30 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 32*32-16, 32*32-16 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 32*32-1, 32*32-1 ) ); + size_t input_strides[] = {3, 99, 456789}; + size_t output_strides[] = {1, 8, 8 * 16}; + size_t gotten_strides[3]; + + size_t x; + + lengths[0] = 8; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_1D, input_strides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_1D, output_strides)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanOutStride(test_plan, CLFFT_1D, &x)); + EXPECT_EQ(1, x); + + lengths[0] = 8; + lengths[1] = 16; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_2D, input_strides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_2D, output_strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanOutStride(test_plan, CLFFT_2D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(8, gotten_strides[1]); + + lengths[0] = 8; + lengths[1] = 16; + lengths[2] = 32; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_3D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_3D, lengths)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanInStride(test_plan, CLFFT_3D, input_strides)); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanOutStride(test_plan, CLFFT_3D, output_strides)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanOutStride(test_plan, CLFFT_3D, gotten_strides)); + EXPECT_EQ(1, gotten_strides[0]); + EXPECT_EQ(8, gotten_strides[1]); + EXPECT_EQ(8 * 16, gotten_strides[2]); +} + +TEST_F(clfft_UnitTest, + setPlanDistance_should_set_distance_to_supported_values) { + size_t inDistance, outDistance; + lengths[0] = 8; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 8 + 10, 8 + 2)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(18, inDistance); + EXPECT_EQ(10, outDistance); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 8 + 3, 8 + 11)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(11, inDistance); + EXPECT_EQ(19, outDistance); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 8, 8)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(8, inDistance); + EXPECT_EQ(8, outDistance); + + lengths[0] = 2; + lengths[1] = 2; + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDim(test_plan, CLFFT_2D)); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanDistance(test_plan, 2 * 2 + 10, 2 * 2 + 2)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(14, inDistance); + EXPECT_EQ(6, outDistance); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanDistance(test_plan, 2 * 2 + 3, 2 * 2 + 11)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(7, inDistance); + EXPECT_EQ(15, outDistance); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 2 * 2, 2 * 2)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(4, inDistance); + EXPECT_EQ(4, outDistance); +} + +TEST_F(clfft_UnitTest, + setPlanDistance_should_fail_to_set_pitch_to_smaller_than_one_dataset) { + lengths[0] = 32; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 32 - 30, 32 - 30)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 32 - 16, 32 - 16)); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 32 - 1, 32 - 1)); + + lengths[0] = 32; + lengths[1] = 32; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_1D, lengths)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanDistance(test_plan, 32 * 32 - 30, 32 * 32 - 30)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanDistance(test_plan, 32 * 32 - 16, 32 * 32 - 16)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanDistance(test_plan, 32 * 32 - 1, 32 * 32 - 1)); } TEST_F(clfft_UnitTest, getPlanDistance_should_yield_correct_values) { - size_t inDistance; - size_t outDistance; - - lengths[0] = 2; - lengths[1] = 2; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); - - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanDistance( test_plan, 4, 6 ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanDistance( test_plan, &inDistance, &outDistance ) ); - EXPECT_EQ( 4, inDistance ); - EXPECT_EQ( 6, outDistance ); -} - -TEST_F(clfft_UnitTest, setLayout_and_getLayout_should_set_and_get_layouts_respectively) { - clfftLayout in, out; - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, in ); - EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_COMPLEX_PLANAR, in ); - EXPECT_EQ( CLFFT_COMPLEX_PLANAR, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_PLANAR ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, in ); - EXPECT_EQ( CLFFT_COMPLEX_PLANAR, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_INTERLEAVED ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_COMPLEX_PLANAR, in ); - EXPECT_EQ( CLFFT_COMPLEX_INTERLEAVED, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_HERMITIAN_INTERLEAVED ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_REAL, in ); - EXPECT_EQ( CLFFT_HERMITIAN_INTERLEAVED, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_HERMITIAN_PLANAR ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_REAL, in ); - EXPECT_EQ( CLFFT_HERMITIAN_PLANAR, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_HERMITIAN_PLANAR, CLFFT_REAL ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_HERMITIAN_PLANAR, in ); - EXPECT_EQ( CLFFT_REAL, out ); - - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_HERMITIAN_INTERLEAVED, CLFFT_REAL ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetLayout( test_plan, &in, &out ) ); - EXPECT_EQ( CLFFT_HERMITIAN_INTERLEAVED, in ); - EXPECT_EQ( CLFFT_REAL, out ); + size_t inDistance; + size_t outDistance; + + lengths[0] = 2; + lengths[1] = 2; + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); + + ASSERT_EQ(CLFFT_SUCCESS, clfftSetPlanDistance(test_plan, 4, 6)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftGetPlanDistance(test_plan, &inDistance, &outDistance)); + EXPECT_EQ(4, inDistance); + EXPECT_EQ(6, outDistance); +} + +TEST_F(clfft_UnitTest, + setLayout_and_getLayout_should_set_and_get_layouts_respectively) { + clfftLayout in, out; + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetLayout(test_plan, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_COMPLEX_INTERLEAVED, in); + EXPECT_EQ(CLFFT_COMPLEX_INTERLEAVED, out); + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetLayout(test_plan, CLFFT_COMPLEX_PLANAR, + CLFFT_COMPLEX_PLANAR)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_COMPLEX_PLANAR, in); + EXPECT_EQ(CLFFT_COMPLEX_PLANAR, out); + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetLayout(test_plan, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_PLANAR)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_COMPLEX_INTERLEAVED, in); + EXPECT_EQ(CLFFT_COMPLEX_PLANAR, out); + + EXPECT_EQ(CLFFT_SUCCESS, clfftSetLayout(test_plan, CLFFT_COMPLEX_PLANAR, + CLFFT_COMPLEX_INTERLEAVED)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_COMPLEX_PLANAR, in); + EXPECT_EQ(CLFFT_COMPLEX_INTERLEAVED, out); + + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_HERMITIAN_INTERLEAVED)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_REAL, in); + EXPECT_EQ(CLFFT_HERMITIAN_INTERLEAVED, out); + + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_HERMITIAN_PLANAR)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_REAL, in); + EXPECT_EQ(CLFFT_HERMITIAN_PLANAR, out); + + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_HERMITIAN_PLANAR, CLFFT_REAL)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_HERMITIAN_PLANAR, in); + EXPECT_EQ(CLFFT_REAL, out); + + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_HERMITIAN_INTERLEAVED, CLFFT_REAL)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetLayout(test_plan, &in, &out)); + EXPECT_EQ(CLFFT_HERMITIAN_INTERLEAVED, in); + EXPECT_EQ(CLFFT_REAL, out); } TEST_F(clfft_UnitTest, setLayout_should_fail_on_invalid_argument_values) { - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetLayout( test_plan, CLFFT_COMPLEX_INTERLEAVED, ENDLAYOUT ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetLayout( test_plan, ENDLAYOUT, CLFFT_COMPLEX_INTERLEAVED ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetLayout( test_plan, ENDLAYOUT, ENDLAYOUT ) ); - - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetLayout( test_plan, static_cast(ENDLAYOUT+42), CLFFT_COMPLEX_INTERLEAVED ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetLayout( test_plan, CLFFT_COMPLEX_INTERLEAVED, static_cast(ENDLAYOUT+42) ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetLayout( test_plan, static_cast(ENDLAYOUT+42), static_cast(ENDLAYOUT+42)) ); -} - -TEST_F(clfft_UnitTest, valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_1) { - // in place can go from real <-> hermitian interleaved - - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_INPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_HERMITIAN_INTERLEAVED ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); -} - -TEST_F(clfft_UnitTest, valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_2) { - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_INPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_HERMITIAN_INTERLEAVED, CLFFT_REAL ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); -} - -TEST_F(clfft_UnitTest, valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_3) { - // out of place can go from real <-> hermitian interleaved or planar - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_HERMITIAN_INTERLEAVED ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); -} - -TEST_F(clfft_UnitTest, valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_4) { - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_HERMITIAN_PLANAR ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); -} - -TEST_F(clfft_UnitTest, valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_5) { - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_HERMITIAN_INTERLEAVED, CLFFT_REAL ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); -} - -TEST_F(clfft_UnitTest, valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_6) { - clfftCreateDefaultPlan( &test_plan, context, CLFFT_1D, lengths ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_HERMITIAN_PLANAR, CLFFT_REAL ) ); - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); -} - -TEST_F(clfft_UnitTest, invalid_layout_combinations_for_real_to_complex_should_fail) { - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_REAL ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_COMPLEX_INTERLEAVED ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetLayout( test_plan, CLFFT_COMPLEX_INTERLEAVED, CLFFT_REAL ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_COMPLEX_PLANAR ) ); - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetLayout( test_plan, CLFFT_COMPLEX_PLANAR, CLFFT_REAL ) ); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetLayout(test_plan, CLFFT_COMPLEX_INTERLEAVED, ENDLAYOUT)); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetLayout(test_plan, ENDLAYOUT, CLFFT_COMPLEX_INTERLEAVED)); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetLayout(test_plan, ENDLAYOUT, ENDLAYOUT)); + + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetLayout(test_plan, static_cast(ENDLAYOUT + 42), + CLFFT_COMPLEX_INTERLEAVED)); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetLayout(test_plan, CLFFT_COMPLEX_INTERLEAVED, + static_cast(ENDLAYOUT + 42))); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetLayout(test_plan, static_cast(ENDLAYOUT + 42), + static_cast(ENDLAYOUT + 42))); +} + +TEST_F(clfft_UnitTest, + valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_1) { + // in place can go from real <-> hermitian interleaved + + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_INPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_HERMITIAN_INTERLEAVED)); + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); +} + +TEST_F(clfft_UnitTest, + valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_2) { + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_INPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_HERMITIAN_INTERLEAVED, CLFFT_REAL)); + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); +} + +TEST_F(clfft_UnitTest, + valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_3) { + // out of place can go from real <-> hermitian interleaved or planar + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_HERMITIAN_INTERLEAVED)); + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); +} + +TEST_F(clfft_UnitTest, + valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_4) { + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_HERMITIAN_PLANAR)); + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); +} + +TEST_F(clfft_UnitTest, + valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_5) { + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_HERMITIAN_INTERLEAVED, CLFFT_REAL)); + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); +} + +TEST_F(clfft_UnitTest, + valid_layout_combinations_for_real_to_complex_should_succeed_on_bake_6) { + clfftCreateDefaultPlan(&test_plan, context, CLFFT_1D, lengths); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_HERMITIAN_PLANAR, CLFFT_REAL)); + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); +} + +TEST_F(clfft_UnitTest, + invalid_layout_combinations_for_real_to_complex_should_fail) { + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_REAL)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_COMPLEX_INTERLEAVED)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetLayout(test_plan, CLFFT_COMPLEX_INTERLEAVED, CLFFT_REAL)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_COMPLEX_PLANAR)); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetLayout(test_plan, CLFFT_COMPLEX_PLANAR, CLFFT_REAL)); } TEST_F(clfft_UnitTest, real_to_planar_should_fail_on_bake) { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_INPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_REAL, CLFFT_HERMITIAN_PLANAR ) ); - EXPECT_EQ( CLFFT_INVALID_PLAN, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_INPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_REAL, CLFFT_HERMITIAN_PLANAR)); + EXPECT_EQ(CLFFT_INVALID_PLAN, + clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); } TEST_F(clfft_UnitTest, planar_to_real_should_fail_on_bake) { - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_INPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetLayout( test_plan, CLFFT_HERMITIAN_PLANAR, CLFFT_REAL ) ); - EXPECT_EQ( CLFFT_INVALID_PLAN, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_INPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetLayout(test_plan, CLFFT_HERMITIAN_PLANAR, CLFFT_REAL)); + EXPECT_EQ(CLFFT_INVALID_PLAN, + clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); } -TEST_F(clfft_UnitTest, setResultLocation_should_set_placeness_to_supported_values) { - clfftResultLocation place; +TEST_F(clfft_UnitTest, + setResultLocation_should_set_placeness_to_supported_values) { + clfftResultLocation place; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_INPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetResultLocation( test_plan, &place ) ); - EXPECT_EQ( CLFFT_INPLACE, place ); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_INPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetResultLocation(test_plan, &place)); + EXPECT_EQ(CLFFT_INPLACE, place); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetResultLocation( test_plan, &place ) ); - EXPECT_EQ( CLFFT_OUTOFPLACE, place ); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetResultLocation(test_plan, &place)); + EXPECT_EQ(CLFFT_OUTOFPLACE, place); } -TEST_F(clfft_UnitTest, setResultLocation_should_fail_on_invalid_argument_values) { - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetResultLocation( test_plan, ENDPLACE ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetResultLocation( test_plan, static_cast(ENDPLACE+42) ) ); +TEST_F(clfft_UnitTest, + setResultLocation_should_fail_on_invalid_argument_values) { + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetResultLocation(test_plan, ENDPLACE)); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetResultLocation( + test_plan, static_cast(ENDPLACE + 42))); } TEST_F(clfft_UnitTest, getResultLocation_should_yield_correct_values) { - clfftResultLocation placeness; + clfftResultLocation placeness; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_INPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetResultLocation( test_plan, &placeness ) ); - EXPECT_EQ( CLFFT_INPLACE, placeness ); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_INPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetResultLocation(test_plan, &placeness)); + EXPECT_EQ(CLFFT_INPLACE, placeness); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetResultLocation( test_plan, CLFFT_OUTOFPLACE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetResultLocation( test_plan, &placeness ) ); - EXPECT_EQ( CLFFT_OUTOFPLACE, placeness ); + ASSERT_EQ(CLFFT_SUCCESS, clfftSetResultLocation(test_plan, CLFFT_OUTOFPLACE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetResultLocation(test_plan, &placeness)); + EXPECT_EQ(CLFFT_OUTOFPLACE, placeness); } -TEST_F(clfft_UnitTest, SetPlanTransposeResult_should_set_resulttransposed_to_supported_values) { - clfftResultTransposed transposed; +TEST_F(clfft_UnitTest, + SetPlanTransposeResult_should_set_resulttransposed_to_supported_values) { + clfftResultTransposed transposed; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanTransposeResult( test_plan, CLFFT_TRANSPOSED ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanTransposeResult( test_plan, &transposed ) ); - EXPECT_EQ( CLFFT_TRANSPOSED, transposed ); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanTransposeResult(test_plan, CLFFT_TRANSPOSED)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanTransposeResult(test_plan, &transposed)); + EXPECT_EQ(CLFFT_TRANSPOSED, transposed); - EXPECT_EQ( CLFFT_SUCCESS, clfftSetPlanTransposeResult( test_plan, CLFFT_NOTRANSPOSE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanTransposeResult( test_plan, &transposed ) ); - EXPECT_EQ( CLFFT_NOTRANSPOSE, transposed ); + EXPECT_EQ(CLFFT_SUCCESS, + clfftSetPlanTransposeResult(test_plan, CLFFT_NOTRANSPOSE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanTransposeResult(test_plan, &transposed)); + EXPECT_EQ(CLFFT_NOTRANSPOSE, transposed); } -TEST_F(clfft_UnitTest, setPlanTransposeResult_should_fail_on_invalid_argument_values) { - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanTransposeResult( test_plan, ENDTRANSPOSED ) ); - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanTransposeResult( test_plan, static_cast(ENDTRANSPOSED+42) ) ); +TEST_F(clfft_UnitTest, + setPlanTransposeResult_should_fail_on_invalid_argument_values) { + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanTransposeResult(test_plan, ENDTRANSPOSED)); + EXPECT_EQ( + CLFFT_INVALID_ARG_VALUE, + clfftSetPlanTransposeResult( + test_plan, static_cast(ENDTRANSPOSED + 42))); } TEST_F(clfft_UnitTest, getPlanTransposeResult_should_yield_correct_values) { - clfftResultTransposed transposed; + clfftResultTransposed transposed; - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanTransposeResult( test_plan, CLFFT_TRANSPOSED ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanTransposeResult( test_plan, &transposed ) ); - EXPECT_EQ( CLFFT_TRANSPOSED, transposed ); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanTransposeResult(test_plan, CLFFT_TRANSPOSED)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanTransposeResult(test_plan, &transposed)); + EXPECT_EQ(CLFFT_TRANSPOSED, transposed); - ASSERT_EQ( CLFFT_SUCCESS, clfftSetPlanTransposeResult( test_plan, CLFFT_NOTRANSPOSE ) ); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetPlanTransposeResult( test_plan, &transposed ) ); - EXPECT_EQ( CLFFT_NOTRANSPOSE, transposed ); + ASSERT_EQ(CLFFT_SUCCESS, + clfftSetPlanTransposeResult(test_plan, CLFFT_NOTRANSPOSE)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetPlanTransposeResult(test_plan, &transposed)); + EXPECT_EQ(CLFFT_NOTRANSPOSE, transposed); } TEST_F(clfft_UnitTest, getTmpBufSize_should_fail_on_unbaked_plan) { - size_t buffersize; - EXPECT_EQ( CLFFT_INVALID_OPERATION, clfftGetTmpBufSize( test_plan, &buffersize ) ); + size_t buffersize; + EXPECT_EQ(CLFFT_INVALID_OPERATION, + clfftGetTmpBufSize(test_plan, &buffersize)); } TEST_F(clfft_UnitTest, getTmpBufSize_should_succeed_on_baked_plan) { - size_t buffersize; - ASSERT_EQ( CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL )); - EXPECT_EQ( CLFFT_SUCCESS, clfftGetTmpBufSize( test_plan, &buffersize ) ); + size_t buffersize; + ASSERT_EQ(CLFFT_SUCCESS, clfftBakePlan(test_plan, 1, &queue, NULL, NULL)); + EXPECT_EQ(CLFFT_SUCCESS, clfftGetTmpBufSize(test_plan, &buffersize)); } TEST_F(clfft_UnitTest, bake_plan_should_fail_to_bake_multi_GPU_plan) { - cl_uint number_of_gpus = 2; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftBakePlan(test_plan, number_of_gpus, &queue, NULL, NULL )); + cl_uint number_of_gpus = 2; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftBakePlan(test_plan, number_of_gpus, &queue, NULL, NULL)); } -void CL_CALLBACK foofies( clfftPlanHandle spoon, void* fork){} +void CL_CALLBACK foofies(clfftPlanHandle spoon, void *fork) {} TEST_F(clfft_UnitTest, bake_plan_should_fail_on_non_null_function_pointer) { - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftBakePlan(test_plan, 1, &queue, &foofies, NULL )); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftBakePlan(test_plan, 1, &queue, &foofies, NULL)); } TEST_F(clfft_UnitTest, bake_plan_should_fail_on_non_null_user_data) { - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftBakePlan(test_plan, 1, &queue, NULL, (void*)0xf00f1e5 )); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftBakePlan(test_plan, 1, &queue, NULL, (void *)0xf00f1e5)); } TEST_F(clfft_UnitTest, set_dimension_should_fail_on_invalid_value) { - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanDim( test_plan, ENDDIMENSION ) ); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, clfftSetPlanDim(test_plan, ENDDIMENSION)); } TEST_F(clfft_UnitTest, set_precision_should_fail_on_invalid_value) { - EXPECT_EQ( CLFFT_INVALID_ARG_VALUE, clfftSetPlanPrecision( test_plan, ENDPRECISION ) ); + EXPECT_EQ(CLFFT_INVALID_ARG_VALUE, + clfftSetPlanPrecision(test_plan, ENDPRECISION)); } TEST_F(clfft_UnitTest, set_length_should_fail_on_null_pointer) { - size_t* lengths = NULL; - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftSetPlanLength( test_plan, CLFFT_2D, lengths ) ); + size_t *lengths = NULL; + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftSetPlanLength(test_plan, CLFFT_2D, lengths)); } TEST_F(clfft_UnitTest, set_length_should_fail_on_invalid_dimension) { - size_t lengths[3] = {2,4,8}; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanLength( test_plan, ENDDIMENSION, lengths ) ); + size_t lengths[3] = {2, 4, 8}; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanLength(test_plan, ENDDIMENSION, lengths)); } TEST_F(clfft_UnitTest, get_length_should_fail_on_invalid_dimension) { - size_t lengths[3] = {2,4,8}; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftGetPlanLength( test_plan, ENDDIMENSION, lengths ) ); + size_t lengths[3] = {2, 4, 8}; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftGetPlanLength(test_plan, ENDDIMENSION, lengths)); } TEST_F(clfft_UnitTest, set_in_stride_should_fail_on_null_pointer) { - size_t* strides = NULL; - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftSetPlanInStride( test_plan, CLFFT_2D, strides ) ); + size_t *strides = NULL; + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftSetPlanInStride(test_plan, CLFFT_2D, strides)); } TEST_F(clfft_UnitTest, set_in_stride_should_fail_on_invalid_dimension) { - size_t strides[3] = {2,4,8}; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanInStride( test_plan, ENDDIMENSION, strides ) ); + size_t strides[3] = {2, 4, 8}; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanInStride(test_plan, ENDDIMENSION, strides)); } TEST_F(clfft_UnitTest, get_in_stride_should_fail_on_invalid_dimension) { - size_t strides[3] = {2,4,8}; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftGetPlanInStride( test_plan, ENDDIMENSION, strides ) ); + size_t strides[3] = {2, 4, 8}; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftGetPlanInStride(test_plan, ENDDIMENSION, strides)); } TEST_F(clfft_UnitTest, set_out_stride_should_fail_on_null_pointer) { - size_t* strides = NULL; - EXPECT_EQ( CLFFT_INVALID_HOST_PTR, clfftSetPlanOutStride( test_plan, CLFFT_2D, strides ) ); + size_t *strides = NULL; + EXPECT_EQ(CLFFT_INVALID_HOST_PTR, + clfftSetPlanOutStride(test_plan, CLFFT_2D, strides)); } TEST_F(clfft_UnitTest, set_out_stride_should_fail_on_invalid_dimension) { - size_t strides[3] = {2,4,8}; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftSetPlanOutStride( test_plan, ENDDIMENSION, strides ) ); + size_t strides[3] = {2, 4, 8}; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftSetPlanOutStride(test_plan, ENDDIMENSION, strides)); } TEST_F(clfft_UnitTest, get_out_stride_should_fail_on_invalid_dimension) { - size_t strides[3] = {2,4,8}; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftGetPlanOutStride( test_plan, ENDDIMENSION, strides ) ); + size_t strides[3] = {2, 4, 8}; + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftGetPlanOutStride(test_plan, ENDDIMENSION, strides)); } -TEST_F(clfft_UnitTest, enqueue_transform_should_fail_with_num_queues_and_events_greater_than_1) { - cl_mem* cl_mem_input = NULL; - cl_mem* cl_mem_output = NULL; +TEST_F( + clfft_UnitTest, + enqueue_transform_should_fail_with_num_queues_and_events_greater_than_1) { + cl_mem *cl_mem_input = NULL; + cl_mem *cl_mem_output = NULL; - EXPECT_EQ( CLFFT_NOTIMPLEMENTED, clfftEnqueueTransform( - test_plan, CLFFT_FORWARD, 2, &queue, 0, NULL, &outEvent, cl_mem_input, cl_mem_output, NULL )); + EXPECT_EQ(CLFFT_NOTIMPLEMENTED, + clfftEnqueueTransform(test_plan, CLFFT_FORWARD, 2, &queue, 0, NULL, + &outEvent, cl_mem_input, cl_mem_output, + NULL)); } TEST_F(clfft_UnitTest, get_version_should_get_a_version_number) { - cl_uint major = 0xb00f1e5; - cl_uint minor = 0xd00f1e5; - cl_uint patch = 0xf00f1e5; - EXPECT_EQ( CLFFT_SUCCESS, clfftGetVersion( &major, &minor, &patch ) ); - EXPECT_NE( 0xb00f1e5, major); - EXPECT_NE( 0xd00f1e5, minor); - EXPECT_NE( 0xf00f1e5, patch); + cl_uint major = 0xb00f1e5; + cl_uint minor = 0xd00f1e5; + cl_uint patch = 0xf00f1e5; + EXPECT_EQ(CLFFT_SUCCESS, clfftGetVersion(&major, &minor, &patch)); + EXPECT_NE(0xb00f1e5, major); + EXPECT_NE(0xd00f1e5, minor); + EXPECT_NE(0xf00f1e5, patch); } TEST_F(clfft_UnitTest, setup_should_succeed_given_a_setup_data_pointer) { - clfftSetupData data; - data.major = 6; - data.minor = 8; - data.patch = 42; - data.debugFlags = 0xf1a95; + clfftSetupData data; + data.major = 6; + data.minor = 8; + data.patch = 42; + data.debugFlags = 0xf1a95; - EXPECT_EQ( CLFFT_SUCCESS, clfftSetup( &data ) ); + EXPECT_EQ(CLFFT_SUCCESS, clfftSetup(&data)); } diff --git a/src/tests/unit_test_persistent_plans.cpp b/src/tests/unit_test_persistent_plans.cpp index d122b50a..84263b19 100644 --- a/src/tests/unit_test_persistent_plans.cpp +++ b/src/tests/unit_test_persistent_plans.cpp @@ -14,263 +14,266 @@ * limitations under the License. * ************************************************************************/ -//TODO persistent plan feature : caching kernel binaries for later reload +// TODO persistent plan feature : caching kernel binaries for later reload #if defined(_WIN32) -#include -#include -#include "clFFT.h" #include "../client/openCL.misc.h" +#include "clFFT.h" #include "clfft.typedefs.h" +#include +#include class clfft_PersistentPlans : public ::testing::Test { protected: - clfft_PersistentPlans(){} - virtual ~clfft_PersistentPlans(){} - virtual void SetUp(){} - virtual void TearDown(){} + clfft_PersistentPlans() {} + virtual ~clfft_PersistentPlans() {} + virtual void SetUp() {} + virtual void TearDown() {} }; -void test_persistent_plan( size_t * length, clfftLayout input_layout, clfftLayout output_layout, clfftResultLocation result_location ) -{ - try - { - clfftDim cl_dimension; - if( length[dimy] == 1 && length[dimz] == 1 ) - cl_dimension = CLFFT_1D; - else if( length[dimz] == 1 ) - cl_dimension = CLFFT_2D; - else - cl_dimension = CLFFT_3D; +void test_persistent_plan(size_t *length, clfftLayout input_layout, + clfftLayout output_layout, + clfftResultLocation result_location) { + try { + clfftDim cl_dimension; + if (length[dimy] == 1 && length[dimz] == 1) + cl_dimension = CLFFT_1D; + else if (length[dimz] == 1) + cl_dimension = CLFFT_2D; + else + cl_dimension = CLFFT_3D; - fftw_dim fftw_dimension = static_cast(cl_dimension); + fftw_dim fftw_dimension = static_cast(cl_dimension); - { - clfft_single write_fft( cl_dimension, length, NULL, 1, 0); - write_fft.input.set_all_data_points_on_all_passes_to_value(1.0f,0.0f); - write_fft.set_forward_transform(); + { + clfft_single write_fft(cl_dimension, length, NULL, 1, 0); + write_fft.input.set_all_data_points_on_all_passes_to_value(1.0f, 0.0f); + write_fft.set_forward_transform(); - if( result_location == CLFFT_INPLACE ) - write_fft.set_in_place(); - else - write_fft.set_out_of_place(); + if (result_location == CLFFT_INPLACE) + write_fft.set_in_place(); + else + write_fft.set_out_of_place(); - write_fft.input_layout(input_layout); - write_fft.output_layout(output_layout); - write_fft.write_plan_to_file("wakkawakka.fft"); - } + write_fft.input_layout(input_layout); + write_fft.output_layout(output_layout); + write_fft.write_plan_to_file("wakkawakka.fft"); + } - clfft_single read_fft( cl_dimension, length, NULL, 1, 0); - read_fft.input.set_all_data_points_on_all_passes_to_value(1.0f,0.0f); - read_fft.set_forward_transform(); - read_fft.read_plan_from_file("wakkawakka.fft"); - read_fft.transform(); + clfft_single read_fft(cl_dimension, length, NULL, 1, 0); + read_fft.input.set_all_data_points_on_all_passes_to_value(1.0f, 0.0f); + read_fft.set_forward_transform(); + read_fft.read_plan_from_file("wakkawakka.fft"); + read_fft.transform(); - fftw_single reference( fftw_dimension, length); - reference.set_forward_transform(); - reference.data.set_all_data_points_on_all_passes_to_value(1.0f,0.0f); - reference.transform(); + fftw_single reference(fftw_dimension, length); + reference.set_forward_transform(); + reference.data.set_all_data_points_on_all_passes_to_value(1.0f, 0.0f); + reference.transform(); - if( read_fft.placeness() == CLFFT_INPLACE ) - EXPECT_EQ( true, read_fft.input.is_equal_to( reference.data)); - else - EXPECT_EQ( true, read_fft.output.is_equal_to( reference.data)); - } - catch( const std::exception& err ) - { - handle_exception(err); - } + if (read_fft.placeness() == CLFFT_INPLACE) + EXPECT_EQ(true, read_fft.input.is_equal_to(reference.data)); + else + EXPECT_EQ(true, read_fft.output.is_equal_to(reference.data)); + } catch (const std::exception &err) { + handle_exception(err); + } } -TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_inplace_interleaved) -{ - size_t length[3] = {1024,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_inplace_interleaved) { + size_t length[3] = {1024, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_1d_inplace_interleaved) -{ - size_t length[3] = {32768,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_1d_inplace_interleaved) { + size_t length[3] = {32768, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_inplace_interleaved) -{ - size_t length[3] = {1024,1024,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_inplace_interleaved) { + size_t length[3] = {1024, 1024, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_inplace_interleaved) -{ - size_t length[3] = {4096,2,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_inplace_interleaved) { + size_t length[3] = {4096, 2, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_inplace_interleaved) -{ - size_t length[3] = {4096,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_inplace_interleaved) { + size_t length[3] = {4096, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_inplace_interleaved) -{ - size_t length[3] = {2,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_inplace_interleaved) { + size_t length[3] = {2, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_normal_3d_inplace_interleaved) -{ - size_t length[3] = {32,32,32}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, + DISABLED_normal_normal_normal_3d_inplace_interleaved) { + size_t length[3] = {32, 32, 32}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_inplace_interleaved) -{ - size_t length[3] = {2*3*5,2*3*5,2*3*5}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_inplace_interleaved) { + size_t length[3] = {2 * 3 * 5, 2 * 3 * 5, 2 * 3 * 5}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_inplace_planar) -{ - size_t length[3] = {1024,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_inplace_planar) { + size_t length[3] = {1024, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_1d_inplace_planar) -{ - size_t length[3] = {32768,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_1d_inplace_planar) { + size_t length[3] = {32768, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_inplace_planar) -{ - size_t length[3] = {1024,1024,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_inplace_planar) { + size_t length[3] = {1024, 1024, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_inplace_planar) -{ - size_t length[3] = {4096,2,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_inplace_planar) { + size_t length[3] = {4096, 2, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_inplace_planar) -{ - size_t length[3] = {4096,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_inplace_planar) { + size_t length[3] = {4096, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_inplace_planar) -{ - size_t length[3] = {2,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_inplace_planar) { + size_t length[3] = {2, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_normal_3d_inplace_planar) -{ - size_t length[3] = {32,32,32}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_normal_3d_inplace_planar) { + size_t length[3] = {32, 32, 32}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_inplace_planar) -{ - size_t length[3] = {2*3*5,2*3*5,2*3*5}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_INPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_inplace_planar) { + size_t length[3] = {2 * 3 * 5, 2 * 3 * 5, 2 * 3 * 5}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_INPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_outofplace_interleaved) -{ - size_t length[3] = {1024,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_outofplace_interleaved) { + size_t length[3] = {1024, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_1d_outofplace_interleaved) -{ - size_t length[3] = {32768,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_1d_outofplace_interleaved) { + size_t length[3] = {32768, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_outofplace_interleaved) -{ - size_t length[3] = {1024,1024,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, + DISABLED_normal_normal_2d_outofplace_interleaved) { + size_t length[3] = {1024, 1024, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_outofplace_interleaved) -{ - size_t length[3] = {4096,2,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_outofplace_interleaved) { + size_t length[3] = {4096, 2, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_outofplace_interleaved) -{ - size_t length[3] = {4096,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_outofplace_interleaved) { + size_t length[3] = {4096, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_outofplace_interleaved) -{ - size_t length[3] = {2,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_outofplace_interleaved) { + size_t length[3] = {2, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_normal_3d_outofplace_interleaved) -{ - size_t length[3] = {32,32,32}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, + DISABLED_normal_normal_normal_3d_outofplace_interleaved) { + size_t length[3] = {32, 32, 32}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_outofplace_interleaved) -{ - size_t length[3] = {2*3*5,2*3*5,2*3*5}; - test_persistent_plan( length, CLFFT_COMPLEX_INTERLEAVED, CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, + DISABLED_mixed_radices_3d_outofplace_interleaved) { + size_t length[3] = {2 * 3 * 5, 2 * 3 * 5, 2 * 3 * 5}; + test_persistent_plan(length, CLFFT_COMPLEX_INTERLEAVED, + CLFFT_COMPLEX_INTERLEAVED, CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_outofplace_planar) -{ - size_t length[3] = {1024,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_1d_outofplace_planar) { + size_t length[3] = {1024, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_1d_outofplace_planar) -{ - size_t length[3] = {32768,1,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_1d_outofplace_planar) { + size_t length[3] = {32768, 1, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_outofplace_planar) -{ - size_t length[3] = {1024,1024,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_2d_outofplace_planar) { + size_t length[3] = {1024, 1024, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_outofplace_planar) -{ - size_t length[3] = {4096,2,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_normal_2d_outofplace_planar) { + size_t length[3] = {4096, 2, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_outofplace_planar) -{ - size_t length[3] = {4096,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_large_large_2d_outofplace_planar) { + size_t length[3] = {4096, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_outofplace_planar) -{ - size_t length[3] = {2,4096,1}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_normal_large_2d_outofplace_planar) { + size_t length[3] = {2, 4096, 1}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_normal_normal_normal_3d_outofplace_planar) -{ - size_t length[3] = {32,32,32}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, + DISABLED_normal_normal_normal_3d_outofplace_planar) { + size_t length[3] = {32, 32, 32}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } -TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_outofplace_planar) -{ - size_t length[3] = {2*3*5,2*3*5,2*3*5}; - test_persistent_plan( length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, CLFFT_OUTOFPLACE ); +TEST_F(clfft_PersistentPlans, DISABLED_mixed_radices_3d_outofplace_planar) { + size_t length[3] = {2 * 3 * 5, 2 * 3 * 5, 2 * 3 * 5}; + test_persistent_plan(length, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR, + CLFFT_OUTOFPLACE); } #endif