DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::detail::fft::plan Namespace Reference

Classes

struct  Buffers
 The two ping-pong buffers, [re | im] each: x is read, y is written. More...
 
struct  Closing
 Where a closing pass into interleaved output writes, and its scales. More...
 
struct  Pass
 
struct  Plan
 
struct  RealPlan
 
struct  TwiddleSpan
 

Variables

constexpr size_t kClosingRowReach = 8192
 
constexpr bool kTwiddledRadix8 = false
 
constexpr size_t kTwiddled8RowReach = 16384
 
constexpr size_t kRealWholeTwiddleReach = 0
 
template<typename T >
constexpr size_t kRealHalvesReach = sizeof(T) == sizeof(float) ? ~size_t{ 0 } : size_t{ 2048 }
 

Variable Documentation

◆ kClosingRowReach

constexpr size_t dspark::detail::fft::plan::kClosingRowReach = 8192
inlineconstexpr

Bytes between the rows of a closing radix-8 pass from which the plan closes with a radix-4 and a radix-2 pass instead. The pass reads its eight rows together; spaced a way of the level-1 data cache apart they fill one set of an 8-way cache, and the pass then costs from the same to six times as much, by where the output lies. A way holds 4 KiB on x86 (32 KiB in 8 ways, 48 KiB in 12); the arm64 cores measured hold 16 KiB, and rows 4 KiB apart cost them less than the two passes.

Definition at line 187 of file FFT.h.

◆ kRealHalvesReach

template<typename T >
constexpr size_t dspark::detail::fft::plan::kRealHalvesReach = sizeof(T) == sizeof(float) ? ~size_t{ 0 } : size_t{ 2048 }
inlineconstexpr

Longest real transforms by lanes (in samples) whose joining step, at vectors of 32 bytes, works by halves (RealPlan::halves): no shuffle then crosses the 128-bit halves, and the step loads and stores half vectors. Those shuffles have one port on the x64 cores that bound this step; the loads and stores are free while the transform works within the level-1 data cache and are what the step waits for beyond it. Four double lanes load and store twice as often per value as eight float ones: they gain up to this size, the float lanes at every size measured.

Definition at line 234 of file FFT.h.

◆ kRealWholeTwiddleReach

constexpr size_t dspark::detail::fft::plan::kRealWholeTwiddleReach = 0
inlineconstexpr

Longest spectra (in points) whose joining pass, in a real transform by lanes, keeps each twiddle as a whole vector for the baseline kernels to load; longer ones keep it once and the pass broadcasts it. A broadcast from memory takes a shuffle on SSE2 and a vector operation on arm64, six per butterfly, where the load takes none; the tables of the long passes would then be as large as the data they turn, and cost more than they save once the transform leaves the level-2 cache. AVX broadcasts for free.

Definition at line 222 of file FFT.h.

◆ kTwiddled8RowReach

constexpr size_t dspark::detail::fft::plan::kTwiddled8RowReach = 16384
inlineconstexpr

Bytes between the eight input rows of a twiddled radix-8 pass (an eighth of the transform) from which a plan keeps to radix-4 passes: from 16 KiB on, the pass no longer measured faster than the two it replaces (its eight input rows and eight output rows then compete for the same sets of the level-1 data cache).

Definition at line 210 of file FFT.h.

◆ kTwiddledRadix8

constexpr bool dspark::detail::fft::plan::kTwiddledRadix8 = false
inlineconstexpr

Whether plans take three bits per pass, with twiddles, between the first pass and the closing one where that saves a pass over the data. It needs registers for the sixteen vectors of a radix-8 butterfly and its temporaries (32 on arm64; with the 16 of x86-64 such plans measured slower at most sizes), and it pays where vector operations are what bounds a pass: 2 to 5 % of a transform on an arm64 server core with two vector pipes. On the arm64 cores of the macOS machines measured, which have four, the same plans ran 7 to 12 % slower at 512 real points, so macOS and iOS builds keep to radix 4.

Definition at line 202 of file FFT.h.