Skip to main content

Module fft

Module fft 

Source
Expand description

Radix-2 1D FFT GPU compute kernel for OxiGDAL.

This module implements a monomorphic Cooley-Tukey Decimation-In-Time (DIT) radix-2 FFT using WGSL compute shaders dispatched via wgpu. Each workgroup processes exactly one transform; the batch variant dispatches multiple workgroups in parallel.

§Constraints

  • Size must be a power of two in the range [4, 2048].
  • All butterfly stages and the bit-reversal function are unrolled in the emitted WGSL because WGSL workgroup-shared memory paths do not allow fully dynamic loop bounds at all WGSL validation levels.

§Sign convention

Modetwiddle anglenormalisation
Forward-2π · k / Nnone
Inverse+2π · k / Ndivide by N

Structs§

Fft1d
GPU-accelerated radix-2 1D FFT (or IFFT) kernel.

Functions§

bit_reverse
Reverse the bottom log2_n bits of x.
make_fft_shader_source
Emit a monomorphic WGSL compute shader for a radix-2 Cooley-Tukey DIT FFT of exactly size points.
twiddle_factor
Compute the twiddle factor for position k of an n-point transform.
validate_size
Validate that size satisfies the FFT kernel constraints (power of two, in the range [4, 2048]).