Skip to content

Zero-padding issue in Y dimension (CUDA backend) #206

@Clemasteredge

Description

@Clemasteredge

Hi there,

I'm having trouble getting the zero-padding optimization to work with the CUDA backend.

It seems to be doing what I want when padding only the first dimensions (X).

Input array is 1024x512 complex single precision with random phases.

When padding in X only to 1536x512, I'm getting the expected results (compared with MATLAB using fft2 with padding):

  • Padded input phases:

Image

  • FFT magnitudes:

Image

When padding in Y only to 1024x768, the input padding looks correct, but the FFT is obviously wrong:

  • Padded input phases:

Image

  • FFT magnitudes:

Image

Apologies for the wrong MATLAB plot orientation, I was playing with the dimensions to see if that was causing the problem (it wasn't).

The VkFFTConfiguration zero-padding is configured as follows:

// Configure VkFFT and execute
VkFFTConfiguration configuration = VkFFTContext::createConfiguration(fftDims, precision, inputArray.complexity_);
configuration.normalize = 0;
configuration.performZeropadding[0] = padSize.x > 0;
configuration.performZeropadding[1] = padSize.y > 0;
configuration.performZeropadding[2] = padSize.z > 0;
configuration.fft_zeropad_left[0] = inputDims.x;
configuration.fft_zeropad_right[0] = fftDims.x;
configuration.fft_zeropad_left[1] = inputDims.y;
configuration.fft_zeropad_right[1] = fftDims.y;
configuration.fft_zeropad_left[2] = inputDims.z;
configuration.fft_zeropad_right[2] = fftDims.z;

The createConfiguration() method assigns the correct FFT dimensions, precision and complexity.

Is this a known issue? Or am I doing something obviously wrong?

Thanks,
Clement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions