Skip to content

Lichtso/VulkanFFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

All Linux macOS Windows
Build Status Build Status Linux Build Status macOS Build Status Windows

Vulkan Fast Fourier Transform

Note: A more recent and more complete alternative was released.

This library can calculate a multidimensional Discrete Fourier Transform on the GPU using the Vulkan API. However, in most cases you probably want a different library, because Vulkan does not change much about the GPU computations, but is a lot more complex than other APIs. Alternatives are based on OpenGL, OpenCL or CUDA for example. Some reasons to use this library anyway are:

  • You already have a Vulkan application and just need a FFT implementation
  • You want to reduce CPU load, because Vulkan is meant do exactly that
  • You are on a platform where other options are worse or just not supported (e.g. OpenGL on MacOS)
  • You are just here for the CLI and don't care about Vulkan

Command Line Interface

Note that many small invocations are very inefficient, because the startup costs of Vulkan are very high. So the CLI is only useful for transforming big data sets and testing. Also, only the library is supported on windows, not the CLI.

Options

  • -x width Samples in x direction
  • -y height Samples in y direction
  • -z depth Samples in z direction
  • --inverse Calculate the IDFT
  • --input raw / ascii / png / exr Input encoding
  • --output raw / ascii / png / exr Output encoding
  • --device index Vulkan device to use
  • --list-devices List Vulkan devices
  • --measure-time Measure time spent in setup, upload, computation, download and teardown

Example Invocations

vulkanfft -x 16 -y 16 --input ascii --output png --inverse < test.txt > test.png
vulkanfft -x 16 -y 16 --input png --output ascii < test.png

Dependencies

  • cmake 3.11
  • Vulkan Runtime 1.0
  • Vulkan SDK 1.2.141.2 (to compile GLSL to SPIR-V)
  • xxd (to inline SPIR-V in C)
  • libpng 1.6.0 (optional, only needed for CLI)
  • libopenexr 2.5.2 (optional, only needed for CLI)

Current Features & Limitations

  • Dimensions
    • Only 1D, 2D, 3D
    • No higher dimensions
  • Direction & Scale
    • Forward / backward (inverse)
    • No normalized / unnormalized switch independent of direction
  • Sample Count / Size
    • Only POT (power of two)
    • No prime factorization
  • Memory Layout
    • Only buffers (row-major order)
    • No samplers / images / textures (2D tiling)
    • Only interleaved complex float
    • No separation of real and imaginary parts
  • Bit-Depth & Data Types
    • Only 32 bit complex floats
    • No real only mode
    • No 8, 16, 64, 128 bit floats or integers
  • Parallelization / SIMD
    • Only radix 2, 4, 8
    • No higher radix
  • Memory Requirements
    • 2*n because of swap buffers for Stockham auto-sort algorithm
    • No reordering and in-place operation
  • Memorization & Profiling
    • Only cold planning
    • No memorization or warm planning / wisdom profiling
  • Related Extras
    • No convolution