Route the spectral kernels onto DspTap's shared real FFT#19
Merged
Conversation
The spectral kernels (conv_engine / stft / nr / spectra) carried a private complex radix-2 Cooley–Tukey FFT (fft.h). They now share DspTap's real FFT (tap::dsp::real_fft) — the split-radix Ooura transform, plus the per-target vDSP (Apple) and CMSIS-Helium (Cortex-M55) float32 backends. - Pin the tap/dsptap submodule and wire it into the build (add_subdirectory + link tap::dsp); the C ABI and standalone tool builds pull it in too. - stft: forward/inverse via real_fft in the packed layout; the spectral op now operates on the N/2+1-bin half-spectrum (the scaffold unpacks/repacks around it). nr and spectra follow — nr gates the half-spectrum, spectra remaps it and lets the real inverse mirror the rest (its hand-rolled Hermitian mirror is gone). - conv_engine: store IR/FDL spectra in the packed half-spectrum and do the overlap-save multiply-accumulate on it — half the spectral memory and half the MAC. A product of two Hermitian spectra is Hermitian, so the exp(+i) convention and the 2/N inverse cancel through forward→multiply→inverse and the convolution is bit-for-bit the same operation (the reference-convolution test confirms it). - Retire fft.h and fft_test.cpp; the DspTap real FFT has its own contract tests in the DspTap repo. spectra_test's peak-bin analysis uses real_fft directly. - Add bench/fft_bench.cpp — a before/after round-trip benchmark vs a baseline copy of the retired radix-2 routine. On x86 double it measures ~6.5x per transform (split-radix + real-vs-complex); Apple/Arm add the backend win. All kernel tests pass (conv_engine reference convolution, nr, spectra, plus the rest of the battery). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRTDgYKY38WH8Bqz17W9k1
- build.yml now checks out submodules recursively so the dsptap submodule (the spectral kernels' FFT) is present at configure time. - Reflow bench/fft_bench.cpp with clang-format-18 (it was added after the earlier format pass, so it slipped the gate). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRTDgYKY38WH8Bqz17W9k1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The spectral kernels (
conv_engine/stft/nr/spectra) carried a private complex radix-2 Cooley–Tukey FFT (fft.h). They now share DspTap's real FFT (tap::dsp::real_fft) — the split-radix Ooura transform, plus the per-target vDSP (Apple) and CMSIS-Helium (Cortex-M55) float32 backends.Changes
tap/dsptapsubmodule,add_subdirectory+ linktap::dsp; the install/export and the C-ABI / standalone tool builds pull it in too.real_fftin the packed layout; the spectral op now operates on the N/2+1-bin half-spectrum (the scaffold unpacks/repacks around it).fft.handfft_test.cpp(DspTap owns the real-FFT contract tests);spectra_test's peak-bin analysis usesreal_fftdirectly.bench/fft_bench.cpp— a before/after round-trip benchmark against a baseline copy of the retired radix-2 routine.Correctness
A product of two Hermitian spectra is Hermitian, so the
exp(+i)sign convention and the2/Ninverse cancel through forward→multiply→inverse — the convolution is bit-for-bit the same operation. All kernel tests pass, including theconv_enginereference-convolution test (888,631 assertions / 132 cases).Performance
fft_benchmeasures ~6.5× per transform on x86 double (split-radix + real-vs-complex), before the vDSP/CMSIS backends add a further ~3× on Apple/Arm.Note
Downstream, TapTools-Max's
tap.convolve~/tap.nr~/tap.spectra~will need to linktap::dsp(the Ooura static lib) once its kernel submodule is bumped to this — a mechanical wrapper follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01MRTDgYKY38WH8Bqz17W9k1
Generated by Claude Code