DTolm / VkFFT

Vulkan/CUDA/HIP/OpenCL/Level Zero/Metal Fast Fourier Transform library
MIT License
1.51k stars 89 forks source link

c2r/r2c memory layout #43

Open wangii opened 3 years ago

wangii commented 3 years ago

Hi, could you explain or point out the location of the in-place c2r/r2c memory layout of the computation result? There is a comment on performR2C saying the memory layout on github, but I couldn't find it. thanks!

DTolm commented 3 years ago

Hello,

I am currently writing documentation for VkFFT, so I will copy the part about this issue here:

One of the main use cases of strides comes to solve the R2C/C2R Hermitian symmetry H stride mismatch - for real space, it is equal to Nx real elements and for the frequency space, it is equal to floor(Nx/2)+1 complex numbers. So, with strides it is possible to use a buffer, padded to 2(floor(Nx/2)+1) real elements in H stride (all elements between Nx and 2(floor(Nx/2)+1) will not be read so it does not matter what data is there before the write stage). All other strides are done as a multiplication between previous stride and number of elements in the previous axis. These are the default values of R2C/C2R strides in in-place, if they are not explicitly specified.

Best regards, Dmitrii Tolmachev

wangii commented 3 years ago

Got it, thanks!