← Back to Pull requests

[RF] Drop the FFTW3 dependency of RooFFTConvPdf #24012

Closed
unknown closed this pull request without merging on Nov 08, 2026 12:59 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 21:33 UTC
Author

Replace the external FFT backend of RooFFTConvPdf with a self-contained implementation, so that the class works in any ROOT build regardless of whether fftw3 is available.

Until now, RooFFTConvPdf used the TVirtualFFT plugin when ROOT was compiled with fftw3=ON, and otherwise fell back to declaring a wrapper around fftw3.h through the interpreter at runtime. The latter throws if the header cannot be found, so the PDF was effectively unusable in builds without fftw3, and the double code path had to be kept in sync.

The new implementation is built on a single iterative radix-2 Cooley-Tukey FFT with a precomputed twiddle-factor table, which keeps the round-off error at the epsilon level independently of the transform size. Since the sampling size N2 is not guaranteed to be a power of two, the circular convolution for arbitrary N2 is computed exactly by zero-padding to the next power of two >= 2N2 - 1, which yields the linear convolution, and folding the result back modulo N2. Both real input sequences are packed into a single complex sequence and their spectra are recovered via Hermitian symmetry, so one convolution costs only two transforms. The transform is unnormalized, matching the FFTW convention; the absolute scale is irrelevant anyway since RooHistPdf renormalizes the cached histogram. Since the convolution of two non-negative inputs is mathematically non-negative, round-off negatives in bins whose true value is ~0 are clamped to zero, avoiding spurious "p.d.f value is less than zero" evaluation errors downstream.

The result agrees with the previous FFTW-based implementation at the level of machine precision (validated against a long-double reference convolution), and end-to-end cache refills are about a factor 3 slower than with FFTW, which is largely masked by the cost of sampling the input pdfs.

As a consequence:
RooFitCore no longer links against FFTW::Double and the ROOFIT_MATH_FFTW3 compile definition is gone.
The three TVirtualFFT plans are removed from FFTCacheElem.
The documentation on how to install FFTW manually is dropped.
* stressRooFit test 208 no longer needs to check for the fftw3 build feature and the TVirtualFFT plugin, and now always runs (except with the codegen backend).

🤖 Done with the help of AI

Diff: 287 lines (+215 / -72) across 3 files Reviewer: vgvassilev Review duration: 3805m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 287 lines diff across 3 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.339
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #24012"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.8% (MEDIUM) · Higher = larger blast radius
39.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.7% · Safe to merge
15.7%