Skip to content

Stage 2b: route the real FFT to the split-radix port; README and design note rewritten - #31

Merged
tap merged 10 commits into
mainfrom
claude/wave3-stage2b-flip
Sep 23, 2026
Merged

tap merged 10 commits into
mainfrom
claude/wave3-stage2b-flip

Conversation

@tap

@tap tap commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

What this changes

Stage 2b of docs/audit-fft-and-code-smells.md (Part 3). basic_real_fft<double> and, where no float backend define is active, basic_real_fft<float> now hold detail::split_radix_rdft<Sample> (fft/split_radix.h, the Stage 2a port) by value and route forward_inplace / inverse_inplace to it. The Ooura workspace members (m_ip, m_w), the lazy ip[0] = 0 first-call table build and the detail::ooura_rdft shims are gone; the CMSIS (TAP_DSP_FFT_CMSIS) and vDSP (TAP_DSP_FFT_ACCELERATE) float wrappers are untouched and selected exactly as before through detail::floating_engine_t<Sample>. No consumer output bit changes at default fp-contraction: the engine is bit-identical to the vendored C for both precisions (D10), measured on every CI platform and, by the 2b review, on clang with FMA; this PR proves that end to end below. The one measured exception is a g++ x86-64 build with -march (FMA), which moves basic_real_fft<float> by a few float ulp at N ≥ 1024 (double unchanged) — recorded in the D9 table, not claimed. README's FFT section is rewritten per Part 8 item 3, the fixed-point design note is folded into docs/fft-design.md, and the icount baselines are re-recorded to the port's exact counts.

Ten commits, in order: the flip and its tests (a5e112e), the bench engine rename and the _c informational sibling (e2fa3a2), the docs (922db9d), the temporary key-emptying commit that the workflow_dispatch seeding run measured (b078a80), the re-record from that run (73475b4), the host microbenchmark numbers and the PR-number citations (460e2cd, c5dc5bf), and the review fix pass (182f49d docs and comments, f6beb20 README's Notebooks sentence from #30, 3ebefe0 bench configure message and the pending main-SHA cells; no transform code touched, see "Review fix pass" below).

Why

The port exists (#28) and is gated bit-identical to the C; routing it is what removes the #define double float build, the lazy table build inside the noexcept transform (audit F6) and the 76 global C symbols from every consumer's binary, and is the prerequisite for Stage 2c deleting the C. Rollback is one line: point detail::floating_engine<Sample>::type back at an Ooura shim.

Verification

The routing proof

  • tests/test_fft_routing.cpp (new, in tap_dsp_tests, runs on every host and QEMU leg): basic_real_fft<double> output is byte-identical (memcmp) to detail::split_radix_rdft<double> forward and inverse at N = 4, 8, 64, 512, 2048, 4096 on broadband, on-bin tone, impulse and DC; the same for float where TAP_DSP_FFT_FLOAT_BACKEND is not defined, and a static_assert that the class declares the port as its engine. On the M55 and macOS legs the float half is compiled out (there basic_real_fft<float> is CMSIS / vDSP by design; test_fft_backend.cpp pins those to the engine at float epsilon).
  • tests/test_fft_parity_ooura.cpp: engine_under_test stays on detail::split_radix_rdft (pointing it at the class would turn the float gate red on the two backend legs for a reason unrelated to the port); its header comment says so and names the routing test as the other half of the proof. Parity label 7/7 on g++ 13.3.0 and clang++ 18.1.3 locally; green on all seven CI legs.
  • tests/test_fft_backend.cpp: ooura_ref is now the ported float engine, as Stage 2b specifies; on Linux/Windows the suite is port-vs-port, which the file says is fine only because the 2a gate exists.

MuTap fingerprint gate (D10), done locally before opening this PR

MuTap origin/main (0f6a7f0, pin b08f6c6) exported to a scratch tree twice: once with submodules/dsptap = b08f6c6, once with this branch's tree; both built -DCMAKE_BUILD_TYPE=Release -DMUTAP_WERROR=ON (g++ 13.3.0), full ctest 197/197 in both (the 2b review reproduced it as 198/198 in both trees; the difference is configuration), mutap_fingerprint diffed. All 14 FINGERPRINT lines byte-identical, float rows included; Float32Parity.*, g168_adapted.* / itu_g16* and the nn-suppressor suites: the same 49 tests, all passing, in both trees.

Before (DspTap b08f6c6):

FINGERPRINT fdaf float b05f67a7426ed1f7
FINGERPRINT fd_kalman float d0dfe8c5f184d382
FINGERPRINT pem_afc float 5183c6aacd998a43
FINGERPRINT postfilter float 2e96c478d53c5eaa
FINGERPRINT nn_suppressor float 60e3762dfcef9fe2
FINGERPRINT aec_chain float 7982243bf2aab6f8
FINGERPRINT aec_chain_nn float 9b0add89588061da
FINGERPRINT fdaf double f9b5694359b78075
FINGERPRINT fd_kalman double 95567d89cbd871c7
FINGERPRINT pem_afc double 19423ce8e48b6b48
FINGERPRINT postfilter double 7143cf725565d4ab
FINGERPRINT nn_suppressor double 9b692f0e7ec4ae7c
FINGERPRINT aec_chain double 8208d54a5b57198a
FINGERPRINT aec_chain_nn double c9616eb564dfaed1
FINGERPRINT_COMPLETE

After (this branch, 73475b4; every later commit is docs, comments or a CMake message):

FINGERPRINT fdaf float b05f67a7426ed1f7
FINGERPRINT fd_kalman float d0dfe8c5f184d382
FINGERPRINT pem_afc float 5183c6aacd998a43
FINGERPRINT postfilter float 2e96c478d53c5eaa
FINGERPRINT nn_suppressor float 60e3762dfcef9fe2
FINGERPRINT aec_chain float 7982243bf2aab6f8
FINGERPRINT aec_chain_nn float 9b0add89588061da
FINGERPRINT fdaf double f9b5694359b78075
FINGERPRINT fd_kalman double 95567d89cbd871c7
FINGERPRINT pem_afc double 19423ce8e48b6b48
FINGERPRINT postfilter double 7143cf725565d4ab
FINGERPRINT nn_suppressor double 9b692f0e7ec4ae7c
FINGERPRINT aec_chain double 8208d54a5b57198a
FINGERPRINT aec_chain_nn double c9616eb564dfaed1
FINGERPRINT_COMPLETE

Bench: re-recorded to the port's exact counts (Part 11 / D11), never absorbed

Seeding run: workflow_dispatch of bench.yml on this branch at b078a80 (the four split-radix keys emptied, m55 left in compare mode), run 35844483811, arm-none-eabi-gcc 13.2.1 (15:13.2.rel1-2), QEMU 8.2.2 (1:8.2.2+ds-0ubuntu1.18); all five keys and the merge job green. The merged artifact is bench/baselines.json at 73475b4; the rows are in bench/README.md. This PR's own bench runs are the compare-mode confirmation (+0.00 % on every key at c5dc5bf, run 35847675359; the fix-pass head re-runs it, expected +0.00 % again since no engine changed).

key rfft_f32_512: C (seeded) → port ratio rfft_f32_2048: C → port ratio checksums port vs _c
m4-softfp 1,868,441,244 → 1,864,929,141 0.9981 2,296,984,479 → 2,294,360,259 0.9989 identical
m4f 98,090,666 → 97,138,544 0.9903 111,859,257 → 111,278,416 0.9948 identical
m33 102,248,169 → 100,945,841 0.9873 116,385,409 → 115,465,626 0.9921 identical
m55-ooura 94,561,954 → 89,276,321 0.9441 107,806,480 → 102,784,096 0.9534 identical
m55 (CMSIS, not re-recorded) 52,382,331; measured 52,382,366 1.0000 (+0.00 %) 54,858,120; measured 54,858,195 1.0000 (+0.00 %) differ (CMSIS vs the Ooura C, expected)

m55-ooura read IMPROVED beyond ±3 % as #28 predicted (0.9417 / 0.9521 there; 0.9441 / 0.9534 through the routed class); the M4 and M33 keys were inside the band and were re-recorded with it so the four split-radix keys move together. m55 moved by +35 / +75 instructions (the wrapper's two dropped vectors under a backend define and three more characters in the printed engine name), +0.00 %, baseline untouched. The same run's _c pair on m55 puts the vendored C at 1.81× (N = 512) / 1.97× (N = 2048) the CMSIS build's instructions over the whole scenario, which is now the figure fft.h and the README quote for the M55 (the consumers' "~3×" was transform-only). .text (MinSizeRel, shipping probe): m4-softfp 53,289, m4f 44,601, m33 44,001, m55 107,657 (CMSIS, −24 bytes), m55-ooura 39,281 — the Stage 2a port probe's numbers; the ceilings in bench.yml remain 0 (unrecorded since #26; a ceiling policy is a follow-up, noted in docs/fft-design.md).

The informational C-vs-port row stays honest until 2c: after the flip reference_c could no longer mean "the class as built", so the selector is renamed (basic_real_fft = what ships, the default; reference_c = the vendored C called directly through a thin adapter over rdft / rdft_f, the way test_fft_backend's old ooura_ref did), the informational sibling swaps sides to a _c suffix, and icount.py prints C/shipping with the checksum agreement on every run. Chosen over retiring the row because it keeps the comparison visible in every PR log and keeps the host microbenchmark's port-vs-C meaningful; 2c deletes the C and the pair. Since the fix pass, configure prints the selected engine (message(STATUS)), with the stale-cache remedy when a pre-2b build directory still holds reference_c. Host microbenchmark (x86-64, g++ 13.3.0, no -march, one loaded machine, in the design note): port / C round-trip ratio 0.97 – 1.00 with identical checksums.

Noise floor (the design note's TODO(stage 2b) row)

Measured on the engine as routed, x86-64 Linux, GCC 13.3.0 and Clang 18.1.3 -O3, glibc 2.39 (both compilers print the same values): double 1.8455e-16 relative 2-norm error vs the compensated-DFT oracle at N = 256 (fft_oracle_floor.DoubleForwardTracksCompensatedDft, pinned 4× = 7.4e-16 for the cross-host libm / contraction spread); float 1.1236e-7 vs double at N = 512 on detail::split_radix_rdft<float> itself (RealFftCrossPrecision.FloatEngineTracksDoubleAtN512, pinned 2× = 2.25e-7; the audit's Part 6 N2 probe value was 1.105e-7 on other material). The CI legs print the spread the pins exist for (run 35847675386, newlib): float 1.1236e-7 on the soft-float cortex-m4, 1.1650e-7 on the VFMA cortex-m4f / m33 / m55; double 1.8928e-16 on M4 / M4F / M33, 1.6643e-16 on the M55 — the same engine on every leg, last bits moved by libm and contraction, all inside the pins. All of it in fft.h's docstring, the README table, the design note's contract table and the two test comments.

Hosted

g++ 13.3.0 and clang++ 18.1.3, Release, -DTAP_DSP_WERROR=ON -DTAP_DSP_BUILD_CAPI=ON -DTAP_DSP_BUILD_BENCH=ON: zero warnings, ctest 409/409 each (incl. the _c smoke tests; host checksums shipping vs C identical, 0x662dd085b5b88325 at N = 512, 0x806d1c5dbb65c525 at N = 2048); parity label 7/7 each; pre-commit (clang-format 18.1.3) clean; scripts/tidy.sh (clang-tidy-18) clean over every touched TU incl. the bench ones. CI on b078a80, 73475b4 and c5dc5bf: the three hosts, the four QEMU legs, drift check, clang-tidy and the five bench keys all green (24 checks).

Review fix pass (reviews A and B on c5dc5bf)

finding fix commit
A1 should-fix: unconditional "no output bit changed" (README, fft.h) qualified to what is measured (default contraction on every CI platform; clang with FMA); the g++ x86-64 -march exception named; reproduced here (g++ 13.3.0 -O3 -march=haswell: double 0 ulp, float moves at N = 1024, 4096, 16384, 65536, 2^20; clang++ 18.1.3 0/0; gate 6/6 on both) and added as two rows of the D9 table with the review's 56/1200, 3.6e-7 figure 182f49d
B1 should-fix: "the same number on the M55 / macOS backend legs" per-leg values from the head's logs with run and job ids, in the contract table, README table and both test comments; "same engine, not the same last bits (libm, contraction, D9)" 182f49d
B2 should-fix: "~3× fewer instructions on the M55 / ~3× faster on Apple Silicon" M55: the bench's own 1.81× / 1.97× (C / CMSIS, whole scenario, run 35844483811); Apple: attributed to MuTap's transform-only measurement on the C (tap/MuTap#31), "not re-measured here (Stage 4)" 182f49d
B3 should-fix: README Notebooks "designed placeholder" #30's hand-off sentence, cited to #30, pointing at the fixed-point record in docs/fft-design.md f6beb20
A3 nit and #30's numerics review A4: "keeps growing with the stage count" re-measured on the header: ~4 LSB at the constant exponent under both policies, flat in N (fixed 4 … 9, BFP 3.5 … 4.4); BFP's finer output LSB makes it read 14 … 279, growing by the exponent gap, not with N 182f49d
A2 nit: "0.0 – 0.1 %" 0.00 – 0.26 % 182f49d
A4 nit: reference_c stale-cache trap message(STATUS) of the selected engine with the remedy; not respelled (reasoning in bench/README.md); INFORMATIONAL_SUFFIX comment 3ebefe0
A5 nit: main SHA placeholder cells read pending with why and who fills them; on the after-merge list below 3ebefe0
B7 nit: compile-time cost (D8) measured here and recorded in the design note next to the port record: preprocessed 78,558 → 81,042 lines; g++ -O2 0.69 → 1.73 s, -O0 0.68 → 0.89 s; clang++ -O2 0.83 → 1.36 s, -O0 0.75 → 0.84 s (min of 5); the review's independent numbers beside them 182f49d
A6 nit: bench TUs not tidy-gated in CI (style.yml) not changed here (taphouse workflow file); noted for the style-job owner —
B6 nit: MuTap's by-path CI job belongs to the bump / 2c, as before —

git diff c5dc5bf..3ebefe0 --stat: README.md, bench/CMakeLists.txt, bench/README.md, docs/fft-design.md, include/tap/dsp/fft.h, scripts/icount.py, tests/test_fft.cpp, tests/test_fft_oracle.cpp — the fft.h and test diffs are comment lines only; the routing and parity tests re-run byte-identical on g++ and clang++.

Cross-PR notes. (B4) #30 carries the re-point of its notebook's three docs/fft-fixed-point.md citations in its own fix pass. (B5) dsptap_fft_backend() and the bridge still say "ooura" for the default float build and "the double profile is always Ooura": tools/** / notebooks/** are #30's this wave, and renaming the string is bridge-visible (it forces a notebook re-execution), so the rename is batched with Stage 2c. Merge order: #31 first, then #30 rebases onto it (merge-tree clean, disjoint hunks in tests/CMakeLists.txt).

Notes for the reviewer

  • No contract change. No documented numeric contract point moves for any profile; the changelog row in docs/fft-design.md records the engine change and the deprecation with every consumer pin byte-identical. basic_real_fft's transforms stay non-const (Stage 4 decides constness across engines, as Stage 3b: fixed-point real FFT, Q15 and Q31 profiles of the same contract #27 recorded).
  • D9, fp-contraction — decided: NO export. tap::dsp sets and exports no -ffp-contract flag. Stated in fft.h's class docstring and the design note with the evidence (0 ulp at default flags on every CI platform, three of them VFMA; identical bench checksums C vs engine on every Ooura key; the fingerprint gate above with no flag anywhere in MuTap's build) and the reason (an INTERFACE -ffp-contract=off would pessimize every consumer TU on the M55 and Apple arm64 for a cross-compiler reproducibility that libm's last-bit cos / sin differences already deny across hosts). The gate stays at -ffp-contract=off; the default-flags identity is stated as an observation, not a guarantee (g++ on x86-64 with -march is measured to move the float profile's last bits, clang not; both in the D9 table).
  • D5, the float-I/O-on-double overloads — [[deprecated]]. tools/capi calls only the double overloads; MuTap and MuTap-Max have no caller (grepped, and the MuTap tree above compiled with -Werror against this branch, which is the executable proof). The two DspTap tests that pin them silence the warning locally with a pragma; the overloads go after one consumer cycle.
  • Kept for 2c: the extern "C" rdft / cdft declarations in fft.h (test_fft_parity_ooura.cpp and the bench's reference_c adapter still call rdft / rdft_f through them; nothing routes through them any more), third_party/ooura/fftsg*.c in the tap_dsp_fft library, the _c bench pair and INFORMATIONAL_SUFFIX, MuTap's by-path CI job, the capi's "ooura" backend string. README states header-only from 2c and what the library still carries until then.
  • Not done here, on purpose: Stage 6's TAP_EXPECTS, std::span overloads, [[nodiscard]] on the floating size queries and the capi hygiene; the Q15/Q31 bench scenarios (a follow-up PR after this merges); the .text ceilings (see above). third_party/**, ci.yml, style.yml, tools/**, notebooks/**, analysis/** and the taphouse style files are untouched.
  • After merge (serial per the rollout rule): (1) the MuTap bump pins the squash SHA of this PR, expects the fingerprint harness identical as above and icount 0 % on m33 / hexagon, and adds the Part 5 glossary line to docs/itu-compliance.md mapping "measured on Ooura" to "the vendored C at DspTap ≤ 5ca3b1c and the bit-identical split-radix port from the Stage 2b SHA onward"; (2) the same bump fills the eight pending main SHA cells of bench/README.md's re-record rows with that squash SHA; (3) Stage 2c renames the capi's "ooura" backend string and re-executes the notebooks.
  • NOTICE.md, README.md, bench/README.md and the design note cite this PR as Stage 2b: route the real FFT to the split-radix port; README and design note rewritten #31; the design note's changelog row names "the Stage 2b: route the real FFT to the split-radix port; README and design note rewritten #31 squash SHA on main" as the SHA the MuTap bump pins.

🤖 Generated with Claude Code

https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy

tap and others added 7 commits September 23, 2026 09:41
include/tap/dsp/fft.h: basic_real_fft<double> and, where no float backend
define is active, basic_real_fft<float> hold detail::split_radix_rdft<Sample>
(fft/split_radix.h) by value and route forward_inplace / inverse_inplace to
it. The Ooura workspace members (m_ip, m_w), the lazy ip[0] = 0 first-call
table build and the detail::ooura_rdft shims are gone; the CMSIS and vDSP
float wrappers are untouched and selected exactly as before through
detail::floating_engine_t. The extern "C" rdft/cdft declarations stay
(the parity gate calls rdft/rdft_f through them; Stage 2c removes them
with the C). No output bit changes: the engine is bit-identical to the
vendored C for both precisions (tests/test_fft_parity_ooura.cpp, D10).

The class docstring states the routing, the four profiles, the measured
noise floors, and the fp-contraction policy (D9): tap::dsp exports no
-ffp-contract setting, with the measurements and the reason (VFMA speed on
the M55 and Apple arm64 against a cross-compiler reproducibility libm
already denies) written down. The float-I/O-on-double overloads are
[[deprecated]] (D5): no caller in tools/capi, MuTap or MuTap-Max.

Tests: tests/test_fft_routing.cpp (new, in tap_dsp_tests) pins
basic_real_fft to the engine byte for byte (memcmp, forward and inverse,
N = 4 .. 4096, four materials) for double and, where no backend is
selected, float. test_fft_backend.cpp's ooura_ref becomes the ported
float engine, as Stage 2b specifies (port-vs-port on Linux/Windows, which
is fine only because the 2a gate exists; the file says so).
test_fft_parity_ooura.cpp keeps engine_under_test on the engine, since
basic_real_fft<float> is a backend on the M55 and macOS legs; its header
comment says why. The design note's noise-floor row is measured and
pinned: double 1.85e-16 vs the compensated-DFT oracle at N = 256
(fft_oracle_floor.DoubleForwardTracksCompensatedDft, pinned 4x for the
cross-host libm / contraction spread) and float 1.12e-7 vs double at
N = 512 on the engine itself (RealFftCrossPrecision.FloatEngineTracksDoubleAtN512,
pinned 2x); GCC 13.3 and Clang 18.1 print the same values.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
…nformational `_c` sibling

After the flip TAP_DSP_BENCH_ENGINE=reference_c no longer described
basic_real_fft, so the selector is renamed to say what each value is:
basic_real_fft (the default; the class as built: the split-radix engine,
or CMSIS / vDSP behind it for float) and reference_c (the vendored Ooura C
called directly through a thin adapter over rdft / rdft_f with the same
copy loop and 2/N arithmetic, the way test_fft_backend's ooura_ref used
to call it). The split_radix value goes: it would measure the same thing
as the default.

The informational pair swaps sides: bench/icount/CMakeLists.txt builds
each float scenario a second time against the C under a `_c` suffix
(scripts/icount.py INFORMATIONAL_SUFFIX), printed beside the gated
sibling with the C/shipping ratio and whether the checksums agree, never
gated or baselined; the float size probe likewise (bench.yml's size step
prints the C probe beside the shipping probe). Stage 2c deletes the C and
the pair. bench/README.md and the bench.yml header record the mechanism
and the stale-cache caveat (a pre-2b build directory still says
reference_c). Host checksums: shipping and C identical at both float
sizes (0x662dd085b5b88325, 0x806d1c5dbb65c525).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
…ded into fft-design.md

README.md (audit Part 8 item 3): the engine table (split-radix / CMSIS /
vDSP / int32 radix-4), the four-profile table with the floating floors
now measured numbers, the two-line migration note for consumers (the
words change, no output bit does), and the honest header-only statement
(header-only from Stage 2c; until then tap_dsp_fft still carries the
reference C and the CMSIS objects). The "planned C++20 port" / "Nothing
from either has shipped yet" sentences go; the primitive count is
unchanged.

docs/fft-design.md: docs/fft-fixed-point.md is folded in as "The
fixed-point profiles: design record" and the separate file deleted (every
citation in fft.h, fft/fixed_point.h, README.md and CLAUDE.md re-pointed);
the contract table gains an Engine row and its fixed-point cells from the
battery, the Q31 forward-scale row is corrected to X / 2N, the
shareability row to Q15 false / Q31 non-const this stage, the noise-floor
row carries the pinned 1.85e-16 / 1.12e-7 figures, the fp-contraction
section records the D9 decision (no export) and its reasons, and the
changelog gains the 3b and 2b rows. NOTICE.md's provenance bullet says
the port is routed and the C remains only as the parity reference until
2c. CLAUDE.md: the design-discipline paragraph names the engine.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
…eding dispatch)

Temporary, superseded by the re-record commit that follows: the bare keys
now measure the port, whose counts sit outside the +-3% band on m55-ooura
(measured 0.9417 / 0.9521 in #28), and per Part 11 / D11 a baseline is
re-recorded to the exact new counts, never absorbed. bench.yml seeds an
empty key only on a push to main or a workflow_dispatch; this commit is
what the workflow_dispatch on this branch seeds from. m55 (CMSIS-DSP) is
not emptied: nothing routed there changed and its baseline must not move.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
… (run 35844483811)

The seeding dispatch on this branch (b078a80, bench run 35844483811,
arm-none-eabi-gcc 13.2.1, QEMU 8.2.2) measured the routed class on every
QEMU leg; this commit copies the merged baselines artifact into
bench/baselines.json and writes the before/after per (key, scenario) into
bench/README.md's table, as Part 11 / D11 require: never absorbed, the exact
new count. C -> port: m4-softfp 0.9981 / 0.9989, m4f 0.9903 / 0.9948,
m33 0.9873 / 0.9921 (inside the +-3% band), m55-ooura 0.9441 / 0.9534
(IMPROVED beyond it, the re-record's reason). m55 (CMSIS-DSP) is not
re-recorded: +35 / +75 instructions, +0.00% against its baseline. The `_c`
siblings reproduced the seeded C counts to within +28..+34 instructions
with output checksums identical to the port's on every Ooura key.
docs/fft-design.md gains the Stage 2b size and instruction tables beside
the Stage 2a ones.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
The design note's host-microbenchmark row (TODO(stage 2b)) takes the
tap_dsp_bench_fft numbers measured on the development container with the
port (basic_real_fft) and the vendored C (reference_c) built side by side:
at parity on x86-64 without -march (round-trip ratio 0.97 - 1.00), one
machine, load stated, checksums identical. The PR landed as #31, not #30;
the four citations are corrected.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy

@tap tap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hostile review A (numerics, routing, test rigor, bench integrity) of head c5dc5bf. Everything below was checked against source, a build (g++ 13.3.0 and clang++ 18.1.3, Release, -DTAP_DSP_WERROR=ON -DTAP_DSP_BUILD_BENCH=ON -DTAP_DSP_BUILD_CAPI=ON), a run, or the CI job logs. No blockers. One should-fix (docs honesty), the rest nits.

Findings

  1. should-fix — the unconditional "no output bit changed" claim is false for one real consumer configuration. README.md:40 ("What did not change: any output bit … for double and for float") and fft.h:365-366 ("the flip changed no output bit of any consumer") are unconditional, while the D9 paragraph in the same docstring and the design note say x86-64 -march is "not measured, and not claimed". Measured with an independent harness (origin/main = the vendored C, rebuilt from third_party/ooura/fftsg*.c at the same flags, vs this head; N = 4 … 65536; five materials; forward_inplace, inverse_inplace, out-of-place forward/inverse incl. aliased, copy, copy-assign, the float-I/O overloads): g++ -O3 -march=haswell → basic_real_fft<float> differs from the C at N ≥ 1024 (56 of 1200 blocks, max |Δ|/max|ref| 3.6e-7), double identical; clang++ -O3 -march=haswell → identical for both. Fix: qualify the two sentences to what is measured (default contraction on every CI platform; clang with FMA; not g++ x86-64 with -march for float), and add the row to the D9 table.
  2. nit — docs/fft-design.md:758: "differ from the Stage 2a _port adapter's by 0.0 – 0.1 %" is 0.00 – 0.26 % from the file's own tables (m55-ooura 512: 89,047,005 → 89,276,321).
  3. nit — docs/fft-design.md:492 (folded fixed-point record): "keeps growing with the stage count" to N = 65536 holds only under block floating point per #30 (14 → 279 LSB); fixed scaling levels off past N = 2048, as the bullet's own mechanism sentence predicts. Qualify.
  4. nit — bench/CMakeLists.txt:25: reference_c keeps its old spelling with a new meaning, so a pre-flip cache silently measures the C on the gated keys and drops the _c pairs. A renamed value would make the static_assert in bench_common.h reject the stale cache; a message(STATUS) of the selected engine is the minimum. Also INFORMATIONAL_SUFFIX = "_c" is a two-character suffix; harmless today.
  5. nit — bench/README.md:174-181: main SHA is the placeholder "the #31 squash SHA on main"; it needs the real SHA after the squash (the MuTap bump is the natural place) or the provenance rule is broken by its newest rows.
  6. nit — CI gate scope (not in this diff): style.yml configures the clang-tidy compile database with -DTAP_DSP_BUILD_TESTS=ON only, so the bench TUs this PR touches are not tidy-gated in CI; the PR relies on the local run. I ran scripts/tidy.sh (clang-tidy-18) over a -DTAP_DSP_BUILD_BENCH=ON database on all nine touched TUs: clean. Consider adding the flag to the style job.

Verified correct

  • The flip (fft.h): both in-place directions route to m_engine with the same pointer; forward/inverse/copy and the 2/N scaling are textually unchanged; size()/num_bins() unchanged; the CMSIS and vDSP wrapper bodies are byte-identical to main (only the selection mechanism moved into floating_engine<> / make_floating_engine, init(int) receives the same value); member order m_size before m_engine; the [[deprecated]] overloads are intact and still exercised (RealFftFloatIO.*, 2 tests, both compilers, zero warnings under -Werror with the pragma); extern "C" block present and used by the parity TU and the bench adapter; the new #include "tap/dsp/fft/split_radix.h" pulls only standard headers. Copy semantics: the engine holds an int and two std::vectors, tables are re-pointed per transform; copy-construct and copy-assign outputs identical to main's (harness) and test_fft_rt.cpp's three copy tests still run.
  • End-to-end bit identity vs main (b08f6c6): 60,291,280 bytes of output memcmp-identical under g++ 13.3 -O3 and clang++ 18.1 -O3, and main g++ vs head clang++ identical too (same libm, default contraction). MuTap's fingerprint gate in the PR body is therefore corroborated independently.
  • Routing proof: memcmp class-vs-engine runs forward and inverse, six sizes × four materials, double everywhere and float where no backend define is active. Logs: m4-softfp / m4f / m33 ran both routing tests (349 tests, 0 skipped); m55 ran Double… + FloatIsABackendOnThisBuild (349 tests, 0 SKIPPED); macOS ran the same pair (409/409). Mutations: (1) engine typedef re-pointed at a C shim → compile fails on the routing test's static_assert; (2) typedef intact, forward output scaled by 1+eps → both memcmp tests red at N = 4; (3) typedef intact, transforms bypass m_engine through a private C shim → green, as expected — the file proves bytes and the declared engine, not that the member is what is called, which is the right claim for consumers.
  • Pins: g++ and clang++ both print 1.1236e-07 (float engine vs double, N = 512, pin 2.25e-7) and 1.8455e-16 (double vs compensated DFT, N = 256, pin 7.4e-16); FloatTracksDouble's 1e-6 unchanged; ctest 409/409 on both compilers; parity label 7/7 on both.
  • Bench integrity: bare keys measure basic_real_fft (engine=basic_real_fft backend=split_radix, cmsis on m55); the reference_c adapter's forward/inverse/copy and 2/N are line-identical to the class's; host smoke checksums 0x662dd085b5b88325 / 0x806d1c5dbb65c525 identical for the bare and _c binaries. Seeding run 35844483811: modes seed ×4 + compare (m55); every count equals bench/baselines.json and both README/design-note tables exactly; the merge job's output equals the committed file; m55 untouched (measured 52,382,366 / 54,858,195, +0.00 %); _c counts are +28 … +34 over the seeded C exactly as stated; .text 53,289 / 44,601 / 44,001 / 107,657 / 39,281 and C 53,225 / 44,793 / 44,185 / 39,449 / 39,449 with the cited job ids; toolchain strings match. PR run 35847675359 at this head: all five keys +0.00 %, checksums identical on the four Ooura keys, DIFFER on m55 (expected). scripts/icount.py driven with stubbed measurements: a _c regression or failure never touches the verdict, a baseline naming _c is IGNORED, --update never writes _c, --record files it under informational, --merge drops a hand-placed _c under a target, and a gated +5 % still fails.
  • Docs numbers: every fixed-point number spot-checked reproduces from tap_dsp_tests (per-bin SNR 69.1/66.5/60.2 and 152.0/149.4/142.8 dB, the −40 dBFS and BFP rows, rms 0.29 / 0.68–0.75, saturation pins 1.0/1.5/8.5/32, round-trip 0.51→1.02 and 3.34→6.7 in test_fft.cpp vs 0.56→1.13, 3.38→6.77, 41.5→83 in test_fft_fixed.cpp, bias 0.81/1.05→1.63/2.1 and 6/62→12/124, noise ratios 2.11/3.49/2.09/4.65, tone 0.044/0.77/1.07/1.29); the Q31 forward-scale row reads X/2N; all 24 test names cited in the contract table exist; the noise-floor row carries the pinned values.
  • Style: clang-format-18 --dry-run -Werror clean on every touched header and TU; clang-tidy-18 clean (see 6).

Generated by Claude Code

Comment thread README.md Resolved
Comment thread include/tap/dsp/fft.h Resolved
Comment thread docs/fft-design.md Resolved
Comment thread docs/fft-design.md Resolved
Comment thread bench/CMakeLists.txt Resolved
Comment thread bench/README.md Resolved

@tap tap left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hostile review B (consumers, build/CI, docs, provenance, process) of head c5dc5bf. The numerics reviewer covers the arithmetic, the routing proof and the bench numbers; this review covers everything around them. Every finding below was verified against source, the CI logs or a local build before posting. No blockers.

Findings

  1. should-fix — docs/fft-design.md:53, tests/test_fft.cpp:504-505: "the same number on the M55 / macOS backend legs" is false. The head CI run prints FloatEngineTracksDoubleAtN512 = 1.1650e-07 on cortex-m33, cortex-m4f and cortex-m55 (VFMA legs, newlib) and 1.1236e-07 only on cortex-m4-softfp and x86-64; DoubleForwardTracksCompensatedDft prints 1.8928e-16 on the M4/M33 legs and 1.6643e-16 on the M55 vs the 1.8455e-16 stated. Same engine on every leg, different last bits (libm + contraction), all inside the pins. Fix: reword both places (line comments have the text); optionally record the observed spread beside the pin rationale, since it now exists in the logs.

  2. should-fix — README.md:21-22, include/tap/dsp/fft.h:66: the "~3× fewer instructions on the M55 / ~3× faster on Apple Silicon" claims are carried forward and now cited to documents that measure otherwise. fft.h:66 cites bench/README.md / docs/fft-design.md; the seeding run's m55 job prints C/CMSIS = 1.8052 (N = 512) and 1.9652 (N = 2048) on the icount scenario, there is no Apple measurement in the repo (TODO(stage 4)), and the design note's host-microbenchmark section itself says the 3× claims "are the consumers' measurements on the vendored C and are re-measured here, not carried forward on trust". Fix: attribute the 3× to its real source (MuTap, transform-only, on the C) or state the bench's figures; say the Apple number is unmeasured here.

  3. should-fix — README.md Notebooks section (433-436) still says the fixed-point section of fft.ipynb "is a designed placeholder until Stage 3b/3c lands"; #30's hand-off sentence is not carried. README is this PR's file this wave and #30's body hands the sentence to it explicitly. The merge-tree is clean (below), so adding it here, cited to #30, is safe; otherwise say in the body who adds it.

  4. should-fix, cross-PR (for the #30 owner) — the deleted docs/fft-fixed-point.md is still cited by #30's notebooks/fft.ipynb in three markdown cells (git grep on origin/claude/wave3-stage3c-verification: lines 655, 911, 961, "docs/fft-fixed-point.md §5") and in #30's PR body. This PR's own tree is clean (only the two "formerly" mentions in fft-design.md:8,136; fft.h, fft/fixed_point.h, README and CLAUDE.md are re-pointed). Whichever PR lands second inherits dangling citations; the re-point is markdown-only and needs no re-execution. Request to #30, not a change here.

  5. nit, cross-PR — tools/capi/dsptap_capi.cpp:225 dsptap_fft_backend() still returns "ooura" for the default float build, and dsptap_capi.h:69-70 / notebooks/dsptap_py.py:134,179 say "the double profile is always Ooura". After this PR that string names an engine nothing runs; #30's executed notebook stamps float32 backend 'ooura' into every figure. tools/** / notebooks/** are #30's this wave, so "untouched on purpose" is the right process here; flag for #30 or batch with 2c (renaming it is a bridge-visible change that forces a notebook re-execution, so 2c may be the cheaper moment).

  6. nit — MuTap's by-path CI job after this PR. MuTap origin/main's branchless-parity job still compiles submodules/dsptap/third_party/ooura/fftsg*.c and links the objects into tests/fingerprint_harness.cpp. Reproduced with the exact recipe against both trees: it links (the C objects are dead weight — nm shows rdft/rdft_f/makewt defined and unreferenced; no duplicate definitions, since split_radix.h is templates in tap::dsp::detail with no extern "C"), both forms run, and the 14 FINGERPRINT lines are identical between the two trees. The harness's own header line prints backend=ooura (MuTap's string) — that, the Part 5 glossary line and the job rewrite belong to the bump / 2c, as the body says.

  7. nit — compile-time cost, for the record (D8). fft.h now drags fft/split_radix.h (2,582 lines) into every consumer TU: preprocessed TU 78,559 → 81,043 lines; a TU instantiating real_fft + real_fft32 with one call each: g++ 13.3 -O2 0.71 s → 1.70 s, -O0 0.76 → 0.90 s; clang++ 18 -O2 0.82 → 1.35 s, -O0 unchanged. Consistent with Part 4's "1.3 s as C++ for the whole file" and MuTap's ~20 TUs. Worth one line in the design note's D8 record; nothing to change.

Verified correct

  • MuTap build + fingerprint gate (reproduced). MuTap origin/main (0f6a7f0, pin b08f6c6) exported twice, submodules/dsptap = b08f6c6 (A) and this head (B); both cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DMUTAP_WERROR=ON -DMUTAP_BUILD_TESTS=ON, g++ 13.3.0: zero warnings in B (17 -Werror targets), ctest 198/198 in both (the body says 197; both trees agree, so the difference is configuration), the Float32Parity.* / g168_adapted.* / itu_g16* / nn-suppressor suites the same 51 passing tests in both, and mutap_fingerprint byte-identical: all 14 FINGERPRINT lines, float rows included, matching the two blocks in the body exactly.
  • D5 deprecation is safe at the bump. Every MuTap call (fdaf.h, fd_kalman.h, pem_afc.h, postfilter.h, nn_suppressor.h, tests/support/itu_signals.h) is same-type on basic_real_fft<Sample> / real_fft with double buffers; MuTap-Max source/ has no FFT call; tools/capi calls the double overloads only. The B build above is the executable proof (-Werror, no -Wdeprecated-declarations hit). Locally, a caller of real_fft::forward(const float*, float*) does warn on both g++ and clang++.
  • MuTap-Max. Links mutap only; nothing references tap_dsp_fft; its per-external CMake comments ("Ooura rdft that tap::mu::basic_real_fft calls", MuTap::fft) were already stale before this PR and stay until the bump proves they can go (Part 4 / Part 8 item 7).
  • Build surface. fft.h standalone and in a TU compiles clean under -std=c++20 -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -pedantic -Werror on g++ 13.3 and clang++ 18.1, and under -fno-exceptions -fno-rtti. tap_dsp_fft is still linked by tap::dsp; no duplicate definitions (above). -DTAP_DSP_FFT_ACCELERATE=ON on Linux fails at configure with a clear message (CMakeLists.txt:100). The M55 leg configures float32 FFT backend = CMSIS-DSP Helium, builds with -DTAP_DSP_WERROR=ON warning-free, runs fft_routing.FloatIsABackendOnThisBuild; macOS runs the same plus fft_backend_parity/512, 2048; all remaining std:: uses in fft.h still need its includes.
  • QEMU legs (head vs main 35799637468). All four: TAP_DSP_TESTS_COMPLETE rc=0 selected=349 skipped=0 (main: 345; +4 = the two routing tests, FloatEngineTracksDoubleAtN512, DoubleForwardTracksCompensatedDft, each 0 ms), parity selected=4 and default-flags selected=1. fft_routing.DoubleIsTheSplitRadixEngineByteForByte and FloatIsTheSplitRadixEngineByteForByte pass on M4/M4F/M33. Wall time of tap_dsp_tests_emulated: m33 126 → 182 s, m4-softfp 99 → 168 s, m4f 159 → 157 s, m55 36 → 28 s. The m33 / m4-softfp growth is runner variance, not this PR: the slowest tests on those legs (psola ClockWrap 23 → 33 s, Decimate.Transparent 10 → 15 s, neither FFT-bound) grew in the same proportion.
  • Bench workflow. bench/icount/CMakeLists.txt, bench/CMakeLists.txt, bench_common.h, bench.yml and scripts/icount.py (INFORMATIONAL_SUFFIX = "_c") are consistent; the split_radix selector value is gone everywhere; the size step keeps set -eo pipefail and both numeric-.text probes; the seeding policy is unchanged (on: block untouched; seed only when event != pull_request, refuse on PR, and the base-branch emptied-key check). Run 35844483811 is workflow_dispatch at b078a80; its baselines-merged artifact is byte-identical to bench/baselines.json at head; git diff b078a80 73475b4 restores all five keys; head's compare run prints +0.00% on every key with the _c siblings' checksums identical on the Ooura keys and DIFFER on m55 (CMSIS), as documented. bench/README.md rows 174-183 / 202-206 match baselines.json.
  • Docs. README FFT section has the engine table, the four-profile table with scale / floor / target, the two-line migration note, "header-only from Stage 2c" with what the library still carries; no "planned" / "nothing shipped" remnants; "seven primitives" intact. docs/fft-fixed-point.md is folded in whole (a diff of the old body against the folded section shows only the intended edits: the shareability sentence, the "Stage 3c adds" bullets, and the fold-in TODO list removed because it was done); the contract table's Engine row, the 2b changelog row and the D9 record are present and consistent with fft.h's docstring. NOTICE.md matches Part 5 / D6 (C stays as parity reference, readme.txt permanent, SPDX unchanged). CLAUDE.md change is one re-point plus one true sentence.
  • Cross-PR merge. git merge-tree --write-tree --merge-base=origin/main c5dc5bf origin/claude/wave3-stage3c-verification → clean, tree a348fb0. Both touch tests/CMakeLists.txt, in disjoint hunks (#31 at 116-133, #30 appended after line 264). Suggested order per Part 12 (left-to-right): #31 first, then #30 rebases (no conflicts) and carries findings 4 and 5 plus the README sentence if #31 did not; if #30 lands first, #31 rebases clean and must add the README sentence itself.
  • Hygiene. All seven commits carry both trailers; the temporary emptying commit b078a80 states why it exists and what supersedes it; the body follows the template, cites the seeding run and both fingerprint blocks, ends with the footer lines, and names no other model.

Generated by Claude Code

Comment thread docs/fft-design.md Resolved
Comment thread tests/test_fft.cpp Resolved
Comment thread README.md Resolved
Comment thread include/tap/dsp/fft.h Resolved
Comment thread README.md Resolved
tap added a commit that referenced this pull request Sep 23, 2026
…ngs in both units

Review of #30 (A4, A8, A9, B1, B2; the bridge guards of A1 / A5 smoked
in §4.0). Executed from a clean kernel against 080862f with the pinned
requirements (numpy 2.4.6, matplotlib 3.11.2, nbconvert 7.17.1); every
§1-3 number is unchanged, every figure carries one stamp.

§1-3: the three figures had stamp(fig) three times in a row and carried
three overprinted stamps; once each now.

§4.1 / cell 15: the battery's rows are cited from docs/fft-design.md,
"The fixed-point profiles: design record", §5 (the file
docs/fft-fixed-point.md is folded there by #31, which merges first), and
described as recorded and printed by `ctest -V`, not pinned: the battery
pins the maximum measured/model ratios and the output fingerprints.

§4.2: "levels off under fixed, roughly doubles per octave under block
floating point" was a unit artefact. The table now prints F(x) + F(-x)
at index 0 / 1 both at the returned exponent (the battery's count) and
at the fixed-scaling constant (count * 2^(e - const), the golden model's
unit): there the coherent DC-path bias is flat and the same under both
policies, fixed 4 .. 9 and block floating 3.5 .. 4.4 LSB over
N = 256 .. 65536, while the count (14 -> 279) doubles per radix-4 stage
with the exponent (7 .. 11 against a constant of 9 .. 17) because the
block comes back 2^(const - e) finer. The figure's right panel is drawn
in the common unit, the count kept as a dotted reference.

§4.3: the exponent thresholds are per profile (Q15 BFP e = 0 up to a
block peak of -24.8 dBFS, first shift at -31.6; Q31 BFP -35.7 / -42.2),
and the 44 quiet blocks are split into the 30 pauses at the -60 dBFS
floor and the 14 quiet-syllable blocks (-50 .. -30 dBFS): fixed Q15
24.3 dB against block-floating 76.9 dB median per-bin SNR on the
syllables, 1.5 against 54.8 dB on the pauses.

§4.4: the BFP round trip's 21 -> 377 reconstructed LSB is the same unit
effect (k stays at 3 while fixed scaling's k is log2 N + 3); the cell
also prints it in fixed scaling's reconstructed LSB, 0.08 falling to
0.006.

§4.0 smokes the bridge's guards: RealFFT(131072, <fixed-point profile>)
raises ValueError naming the bound, RealFFT(131072, "double")
constructs, an int16 view at an odd byte offset raises TypeError.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
tap and others added 3 commits September 23, 2026 11:19
Review A finding 1: the "no output bit changed" sentences in README.md and
fft.h's class docstring were unconditional while D9 two paragraphs down
said x86-64 with -march was not measured. Now measured, and the D9 table in
docs/fft-design.md carries the rows: g++ 13.3.0 -O3 -march=haswell keeps
double at 0 ulp and moves basic_real_fft<float> at N = 1024, 4096, 16384,
65536 and 2^20 (a few float ulp relative to the block peak, 3.6e-7 in the
review's harness); clang++ 18.1.3 at the same flags is identical for both;
the -ffp-contract=off gate is 6/6 on both. Both sentences now say "at
default contraction on every CI platform and on clang with FMA", name the
g++ -march exception, and keep the MuTap fingerprint statement, which is
measured at MuTap's flags.

Review B finding 1: "the same number on the M55 / macOS backend legs" was
false. The head's CI (run 35847675386) prints FloatEngineTracksDoubleAtN512
= 1.1236e-7 on cortex-m4-softfp and x86-64 and 1.1650e-7 on the VFMA legs
cortex-m4f / m33 / m55; DoubleForwardTracksCompensatedDft = 1.8928e-16 on
the M4 / M33 legs and 1.6643e-16 on the M55 against 1.8455e-16 on x86-64.
Same engine, last bits moved by libm and contraction (D9), all inside the
pins. The contract table, the README table and both test comments now
carry the per-leg values with the run and job ids; the hosted legs run
ctest non-verbose and print no value, which the table says.

Review B finding 2: the "~3x fewer instructions on the M55 / ~3x faster on
Apple Silicon" claims cited bench/README.md and the design note, which
measure otherwise. The M55 figure is now the bench's own: on the m55 key
the vendored C executes 1.81x (N = 512) / 1.97x (N = 2048) the CMSIS
build's instructions over the whole ratchet scenario (run 35844483811,
counts in the design note). The Apple figure is attributed to MuTap's
transform-only measurement on the C (tap/MuTap#31) and marked not
re-measured here (Stage 4). The host-microbenchmark paragraph says which
claim went where.

Nits: the port-vs-_port range is 0.00 - 0.26 % per the file's own tables
(A2); the folded fixed-point record's "keeps growing with the stage count"
was a unit artifact (A3, and #30's numerics review): re-measured on the
header, the Q31 DC-path bias at index 0/1 is about 4 LSB at the constant
exponent under both policies and flat in N (fixed 4 ... 9, BFP 3.5 ... 4.4
for N = 256 ... 65536); block floating point returns e 2 ... 6 bits under
the constant there, so in its finer output LSB the same bias reads
14 ... 279, growing by the exponent gap, not with N. The compile-time cost
of the flip is recorded beside the port record (B7): a TU including fft.h
preprocesses to 81,042 lines against 78,558 on main; a TU instantiating
both floating profiles compiles in g++ -O2 0.69 -> 1.73 s, -O0 0.68 ->
0.89 s, clang++ -O2 0.83 -> 1.36 s, -O0 0.75 -> 0.84 s (min of 5, this
host), consistent with the review's independent numbers; D8 stands.

No transform code changes: the fft.h and test diffs are comment lines only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
Review B finding 3. The section still called the fixed-point part of
notebooks/fft.ipynb "a designed placeholder until Stage 3b/3c lands";
#30 (Stage 3c) fills it and hands this README sentence over in
its body, since README is this PR's file this wave. Carried here as what
the verification layer measures from #30 onward, cited to #30, and pointing
at the fixed-point design record in docs/fft-design.md rather than the
folded docs/fft-fixed-point.md. #31 merges first; #30 rebases onto it
(merge-tree clean, disjoint hunks in tests/CMakeLists.txt).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
… pending

Review A finding 4: TAP_DSP_BENCH_ENGINE=reference_c kept its pre-flip
spelling with a new meaning, so a build directory configured before Stage
2b would measure the C on the gated keys and skip the _c pairs without a
word. bench/CMakeLists.txt now prints the selection at configure as a
STATUS line, with the stale-cache remedy when the value is reference_c.
The value is deliberately not respelled to make the stale cache fail
bench_common.h's static_assert: that would move the _c binaries' printed
engine string and their informational counts against the +28 ... +34 the
README records, and rename identifiers across the bench, for a hazard only
a local pre-2b directory can meet; bench/README.md says so, and the
selector goes with the C at 2c. scripts/icount.py notes the two-character
INFORMATIONAL_SUFFIX hazard the review pointed at.

Review A finding 5: the eight re-record rows' "main SHA" placeholder now
says it is pending, why (the squash does not exist while the PR is open),
and who fills it (the MuTap bump that pins the squash, on #31's after-merge
list).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy

tap commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Fix pass for reviews A (numerics) and B (process) on c5dc5bf. New head 3ebefe0; three commits, no transform code touched (fft.h and the two test TUs differ in comment lines only); all 24 checks green, the bench re-run at +0.00 % with byte-exact counts on every key (checksums identical on the four Ooura keys, DIFFER on m55 as documented).

finding fix commit
A1 should-fix — unconditional "no output bit changed" (README:40, fft.h:365) reproduced on this FMA host with the repo's informational parity target at -O3 -march=haswell: g++ 13.3.0 double 0 ulp, float moves at N = 1024, 4096, 16384, 65536, 2^20 (0 at 2048, 8192, 32768); clang++ 18.1.3 0/0; gate 6/6 on both. Both sentences now qualified to what is measured (default contraction on every CI platform; clang with FMA), the g++ -march exception named, MuTap's fingerprint statement kept as measured at MuTap's flags; two rows added to the D9 table with your 56/1200, 3.6e-7 figure 182f49d
B1 should-fix — "the same number on the M55 / macOS backend legs" (fft-design.md:53, test_fft.cpp:504) per-leg values from the head's logs (run 35847675386): float 1.1236e-7 on x86-64 and cortex-m4-softfp, 1.1650e-7 on cortex-m4f / m33 / m55; double 1.8455e-16 x86-64, 1.8928e-16 M4 / M4F / M33, 1.6643e-16 M55; hosted legs print no value (ctest non-verbose). Contract table, README table, both test comments say "same engine, last bits moved by libm and contraction (D9)" 182f49d
B2 should-fix — "~3× fewer instructions on the M55 / ~3× faster on Apple Silicon" (README:21, fft.h:66) M55: the bench's own C / CMSIS 1.81× (512) / 1.97× (2048) on the whole ratchet scenario (run 35844483811, _c counts in the design note); Apple: attributed to MuTap's transform-only measurement on the C (tap/MuTap#31), "not re-measured here (Stage 4)"; the host-microbenchmark paragraph says which claim went where 182f49d
B3 should-fix — README Notebooks "designed placeholder" #30's hand-off sentence carried, cited to #30, pointing at the fixed-point record in docs/fft-design.md f6beb20
A3 nit / #30 review A4 — "keeps growing with the stage count" re-measured on the header: ~4 LSB at the constant exponent under both policies, flat in N (fixed 4 … 9; BFP 3.5 … 4.4 for N = 256 … 65536, at e = 7 … 11); BFP's finer output LSB makes the same bias read 14 … 279, growing by the exponent gap 2^(const − e), not with N 182f49d
A2 nit — "0.0 – 0.1 %" 0.00 – 0.26 % (m55-ooura 512 named) 182f49d
A4 nit — reference_c stale-cache trap message(STATUS) of the selected engine at configure, with the -UTAP_DSP_BENCH_ENGINE remedy on reference_c; the value deliberately not respelled (reasoning in bench/README.md: it would move the _c binaries' informational counts and rename bench identifiers for a hazard only a local pre-2b directory can meet); INFORMATIONAL_SUFFIX two-character hazard commented in icount.py 3ebefe0
A5 nit — main SHA placeholder the eight cells read pending with why (the squash does not exist yet) and who fills them (the MuTap bump); on the after-merge list 3ebefe0
B7 nit — compile-time cost (D8) measured here (min of 5, unloaded host): preprocessed 78,558 → 81,042 lines; g++ -O2 0.69 → 1.73 s, -O0 0.68 → 0.89 s; clang++ -O2 0.83 → 1.36 s, -O0 0.75 → 0.84 s; recorded next to the port record with your independent numbers; D8 stands 182f49d
A6 nit — bench TUs not tidy-gated by style.yml not changed here (workflow file); local scripts/tidy.sh clean over the touched TUs, as before —
B6 nit — MuTap's by-path CI job bump / 2c, as the body says —

Cross-PR. (B4) #30 re-points its notebook's three docs/fft-fixed-point.md citations in its own fix pass. (B5) dsptap_fft_backend() / the bridge's "ooura" string: tools/** and notebooks/** are #30's this wave and the rename forces a notebook re-execution, so it is batched with Stage 2c (noted in the body's "Kept for 2c"). Merge order stays #31 then #30 (merge-tree clean, disjoint hunks in tests/CMakeLists.txt).

After merge. (1) MuTap bump pins the squash SHA, expects the 14 fingerprint rows identical and icount 0 % on m33 / hexagon, and adds the Part 5 glossary line to docs/itu-compliance.md; (2) the same bump fills the eight pending main SHA cells in bench/README.md; (3) Stage 2c renames the capi's "ooura" string and re-executes the notebooks.

Local verification at 3ebefe0: g++ 13.3.0 and clang++ 18.1.3, Release, -DTAP_DSP_WERROR=ON -DTAP_DSP_BUILD_CAPI=ON -DTAP_DSP_BUILD_BENCH=ON: zero warnings, ctest 409/409 each, parity label 7/7 each, routing tests byte-identical, pre-commit clang-format clean, clang-tidy-18 clean over the touched TUs; the reference_c configure message exercised in a scratch directory.


Generated by Claude Code

@tap
tap merged commit bbfa48d into main Sep 23, 2026
24 checks passed
tap added a commit that referenced this pull request Sep 23, 2026
… size probes

Stage 2c of docs/audit-fft-and-code-smells.md (Part 3), the bench half,
plus the three fixed-point scenarios Stage 3b specified in Part 11.

The `_c` informational mechanism goes: bench_common.h's TAP_DSP_BENCH_ENGINE
selector and the reference_c_bench_adapter over rdft/rdft_f, the cache
variable and its configure messages in bench/CMakeLists.txt, the second
loop in bench/icount/CMakeLists.txt, the `_c` size probe, INFORMATIONAL_SUFFIX
and its report/merge/record paths in scripts/icount.py, and the bench.yml
lines that printed the C's .text and the shipping/C ratio. The DONE line
keeps printing engine=basic_real_fft, the constant the shipping class always
printed, so the recorded float counts do not move (host checksums
unchanged: 0x662dd085b5b88325, 0x806d1c5dbb65c525, 0x77a2050ea57bd325).

New scenarios rfft_q15_512, rfft_q31_512, rfft_q31_2048 (precision codes 2
and 3 in icount_main.cpp, scaling::fixed) on every key including the
soft-float M4: the input is the xorshift state narrowed to the sample width
(uniform over the full Q range, no floating conversion), the fold hashes the
integer output bit patterns plus each transform's returned exponent, and the
ok= check is the contract's round-trip identity |out*2^s - x| <= 8*2^s in
int64 (measured 0.52 / 3.6 LSB for Q15 / Q31; the header pins 8.5 for one
Q31 transform). Size probes rfft_q15_512 and rfft_q31_512 join the float
probe; bench.yml's size step measures the three shipping probes with one
ceiling each (text_ceiling_f32/q15/q31, still 0 until the recording run;
policy: measured + 3 %, rounded up to 64 bytes) and keeps pipefail and the
unavailable-.text checks. Host smoke tests cover the new binaries.

bench/README.md: the scenarios table, the retired mechanism as a record, the
ceiling policy, and the eight "pending" main-SHA cells of the Stage 2b
re-record filled with bbfa48d (the #31 squash). The new keys have no
baselines yet; the seeding commit that follows records them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
tap added a commit that referenced this pull request Sep 23, 2026
…2c record; notebook re-executed

NOTICE.md: the C is no longer part of the shipping tree; it remains under
tests/reference/ooura/ (fftsg.c and fftsg_float.c, listed as outside the
shipping tree) as the parity oracle; third_party/ooura/readme.txt stays; the
derivative-work statement and SPDX are unchanged. The Part 5 contact attempt
is recorded honestly: not yet attempted as of 2026-09-23; the draft is at
docs/fft-design.md, "Draft email to the author — for the maintainer to
send"; nothing has been sent by anyone, and sending it is the maintainer's
decision, flagged in the PR.

README.md: "Header-only" in the present tense (tap::dsp a pure INTERFACE
target; a static library exists only under TAP_DSP_FFT_CMSIS), the consumer
section, provenance and license paragraphs updated for where the reference C
lives now.

CLAUDE.md (audit Part 8 item 5): the header-only statement in the intro and
the design-discipline bullet; the four QEMU legs and the ratchet in the
Build & test section; fft.ipynb named beside pitchshift.ipynb in the
verification layer; the vendored-code checklist line covers a reference copy
kept for a test.

docs/fft-design.md: provenance paragraph rewritten for 2c, the MuTap
follow-ups spelled out (THIRD_PARTY_NOTICES.md rewrite, the
branchless-parity job rewritten header-only), the licensing statement in the
present tense, the draft email's status, the 2c changelog row (no output
bit, no contract point; MuTap fingerprint 14 rows identical), the #31 squash
SHA bbfa48d filled in, and the size and instruction tables for the
fixed-point profiles from the recording run (35861317022), with the
ceilings.

notebooks/fft.ipynb: re-executed from a clean kernel with the pinned
requirements (numpy 2.4.6, matplotlib 3.11.2, nbconvert 7.17.1, ipykernel
7.3.0) against the capi built from this tree: the stamps carry float32
backend 'split_radix' and tree 21b3488; every other text output is
byte-identical to the committed execution (24 outputs compared; the nine
figures differ only by the stamp string). The engine is named split-radix in
the intro, the setup cell's print and the section 5 heading.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
tap added a commit that referenced this pull request Sep 23, 2026
…line rows rejoin their table; CMake and CLAUDE.md wording

include/tap/dsp/fft/fixed_point.h lines 33 and 498: the two comment
citations of third_party/ooura/fftsg.c, a path this PR removed, now read
tests/reference/ooura/fftsg.c (review A finding 2, review B finding 4).
Comment-only: gcc -fpreprocessed -E -P output of the header is byte-identical
to the parent; the 16 fixed-point fingerprints and the Q15/Q31 batteries
pass unchanged.

bench/README.md: the blank lines at 163 and 174 split the "Recorded
baselines and updates" table, so GitHub rendered the #31 and #32 rows as
pipe-delimited prose (review A finding 1). Both removed; every row now
belongs to the header at 151-152 and no other table in the file has the
pattern (checked). No value changed.

CMakeLists.txt line 22: tap_dsp_fft is a STATIC library, not an "object
library", which is a distinct CMake kind (review B finding 6). The dead
INSTALL_INTERFACE line stays for Stage 6, as the PR body's deferred list
says.

CLAUDE.md lines 89-91: the sentence that said no Arm toolchain is needed
and then required one is reworded per review B finding 5: the hosted build
and battery need none; where gcc-arm-none-eabi and qemu-system-arm are
installed the toolchain-file configure reproduces a leg.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
tap added a commit that referenced this pull request Sep 23, 2026
… a prediction that did not hold

docs/audit-fft-and-code-smells.md: a Part 13 amendment (wave 3, recorded at
the Stage 2c fix pass) for the Stage 2b MuTap gate text "icount ratchet at
0% delta on m33 and hexagon (0% is the gate, because nothing numeric
changed)". Measured on the MuTap bump to ae0c027 (tap/MuTap#54, PR run
35866422618 against the previous main run 35804748507): every scenario's
output checksum unchanged and fingerprints identical on all legs, but the
instruction counts moved downward (m33 chain -1.17/-1.15%, fdkf
-2.46/-2.03%, shadow -3.05/-3.05% crossing the two-sided +-3% band,
suppressor -1.13/-1.14%; hexagon -0.004 to -0.86%; m55 CMSIS <= 0.003%):
the header-only port compiles to fewer instructions than the vendored C on
GCC 13.2 Cortex-M and Hexagon clang, the direction DspTap's own 2b
re-record measured (#31). Disposition: re-recorded per D11 with a written
commit in the bump; the gate for a bump is "fingerprints byte-identical on
every leg", and the ratchet is re-recorded when the engine changes. The
Stage 2b paragraph in Part 3 keeps its text and gains a one-line pointer to
the amendment rather than a rewrite.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
tap added a commit to tap/MuTap that referenced this pull request Sep 23, 2026
DspTap ae0c027 (Stage 2b, tap/DspTap#31) routes the float FFT to the C++20
split-radix port; outputs are byte-identical (fingerprints identical on
every leg) but the port compiles to fewer instructions than the vendored C
on GCC 13.2 (Cortex-M) and Hexagon clang; DspTap re-recorded its own
baselines in #31 for the same reason. Improvement, re-recorded per DspTap
D11 so the gate stays tight.

Counts are the 30 values the ratchet job printed on the PR's pull_request
run 35866422618 (head 2571c24; the push run 35866417101 and both runs of
the first head b01c4e4 printed the same values), written as `--update`
writes them: exactly the measured scenarios per key, sorted, indent 2.
Before/after per target and scenario, the run, the toolchain/QEMU strings
and the reason are the new "Recorded baselines and updates" table in
bench/README.md. Against the committed baselines: m33 -0.16 % to -3.05 %
(the two shadow scenarios crossed the -3 % band and turned the job red),
hexagon -0.01 % to -1.50 %, m55 +13 to +4,807 instructions (CMSIS
untouched; the wrapper lost two unused workspace vectors) with the two
nn_suppressor rows -0.10 % / -0.12 %. The plan's 0 % prediction for this
bump assumed the port and the C share an instruction stream; this table
is the measured correction.

Cross-check: the m33 and m55 workloads rebuilt and counted locally on the
identical toolchain/QEMU pair (gcc-arm-none-eabi 15:13.2.rel1-2,
qemu-system-arm 1:8.2.2+ds-0ubuntu1.18, plugin against the job's pinned
qemu-plugin.h) reproduce all 20 committed counts exactly (+0.00 %).
Hexagon has no local rig; the PR's ratchet run confirms it.

Two README sentences that named the M33/Hexagon FFT as "Ooura" now name
the split-radix engine and its lineage.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZPTzNxo5Fe4EtpXXKf7Sy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant