3 Replies Latest reply on Jan 10, 2013 1:48 AM by stepan.prokipchyn

    REAL->HERMITIAN_INTERLEAVED->REAL FFT problems

    stepan.prokipchyn

      Hi,

       

      I am experimenting with AMD FFT library. Currently I am trying to apply forward (from REAL to HERMITIAN_INTERLEAVED) and backward (from HERMITIAN_INTERLEAVED to REAL) transforms sequentially. I am getting the same data as input array, so program seems to be correct. But here is a problem:

       

      When applying two backward transforms sequentially (don't ask me why I need that - this is a test project), I get CL_INVALID_COMMAND_QUEUE after second backward transform (see line 158).

       

      Can you guys help me to solve this?

        • Re: REAL->HERMITIAN_INTERLEAVED->REAL FFT problems
          bragadeesh

          Hi Stepan,

           

          Thanks for your test code. I have investigated it and found that the problem is in the library. It has got tot do with the way temporary buffers are created and used inside the library. The problem has been fixed and it will be made available in the next release.

           

          In the meantime, you can try the following modification in your 'backward' function to make your code work. Make sure to free the tmpBuffer appropriately. Let me know if this helped you.

           

          cl_mem backward(clAmdFftPlanHandle plan, cl_context context, cl_command_queue queue, size_t width, size_t height, cl_mem data)

          {

                    cl_int result;

                    auto buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, width * height * sizeof(double), NULL, &result);

                    CL_CHECK(result);

           

                    size_t tmpBuffersize;

                    clAmdFftGetTmpBufSize( plan, &tmpBuffersize );

           

                    auto tmpBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, tmpBuffersize, NULL, &result);

                    CL_CHECK(result);

           

                    CL_CHECK(clAmdFftEnqueueTransform(plan, clAmdFftDirection::CLFFT_BACKWARD, 1, &queue, 0, NULL, NULL, &data, &buffer, tmpBuffer));

                    CL_CHECK(clAmdFftEnqueueTransform(plan, clAmdFftDirection::CLFFT_BACKWARD, 1, &queue, 0, NULL, NULL, &data, &buffer, tmpBuffer));

           

                    auto res = clFinish(queue);

                    CL_CHECK(res);

           

                    return buffer;

          }