Skip to the content.

FFTW

Video: When RVV FFT Wins 1.6× — and Gives 0% in Quantum ESPRESSOall videos

FFTW 3.3.10 with the RISC-V Vector (r5v) SIMD backend vs a scalar build of the same source. Only flag: --enable-r5v (rdolbeau r5v-test-release-005).

Harness: opensolvers/benchmarks/fftw. Swap via LD_PRELOAD (not FlexiBLAS). Apps: QE, GROMACS.

Headline

Axis Result
Microbench (FFTW_MEASURE, N=256) r5v 1.60× scalar
Same, large N (≥64K) ~1.06× (bandwidth-bound)
Planner ESTIMATE → MEASURE 3–5× (often bigger than RVV)
QE 64-atom SCF (stock ESTIMATE) ~0% wall / ~1.9% in fftw
QE + MEASURE wisdom ~6% wall (serial); MPI ~2–6%
Correctness Energies bit-identical across libs

The backend is real (*_r5v256 codelets; ~305× more RVV instructions than scalar). Wins evaporate when apps plan with FFTW_ESTIMATE and run many small mixed-radix transforms.

Microbench (Orange Pi RV2)

EESSI GCC 14.3, 1 thread, tests/bench -t 1.0. Median MFLOPS under MEASURE:

N r5v / scalar Speedup
256 2520 / 1579 1.60×
1024 1642 / 1265 1.30×
4096 1283 / 978 1.31×
65536 797 / 752 1.06×

BPI-F3 matches within a few percent (same binaries). Pin the planner and use ≥1 s timing — short -t + ESTIMATE can fake an RVV “regression.”

End-to-end

Hot-codelet experiments (gather avoidance, XOR-conj, …): only XOR-conj stayed (~1–4% QE); gather rewrites lost — detail in the benchmarks repo.

Reproduce

./build-fftw-r5v.sh
./bench-fftw-ab.sh
./run-qe-fft-ab.sh
./run-qe-fft-wisdom-ab.sh …

On RV2, prepend real GCC 14 bindir (compat GCC 13 otherwise wins). EasyBuild sketch: FFTW-3.3.10-GCC-14.3.0-r5v.eb (hmeiland/easybuild-easyconfigs#3).