Feat: Use FFTW linear convolution for CPU fast-mode PSF resolve

Replace the nested spatial global convolution in fast_psf_accumulator_resolve with a reusable double-precision FFTW linear convolution on the CPU PSF backend.

- Add the private src/fast_psf_fftw.{c,h} module: zero-padded R2C/C2R plans, cached kernel spectrum and planar scratch, exact 1/(Pwidth*Pheight) and 1/N^2 normalization, (R,R) crop, and additive HDR output.
- Keep the previous nested loops as fast_psf_accumulator_resolve_spatial_reference for tests/benchmarks only; it is not a runtime fallback.
- Cache the circular row spans on FastPsfAccumulator and report one-time plan, kernel transform, scratch, and per-frame stage timings.
- Require fftw3_omp for CPU builds; HIP and dummy builds do not link FFTW.
- Namespace test/helper binaries by spacetime and build tag, and reject make test / psf-capture for non-CPU backends.
- Add tests/test_fast_psf_fftw.c (FFTW versus spatial), tests/benchmark_fast_psf_fftw.c, an FFTW CLI smoke check, and the 2026-09-25 benchmark record.
This commit is contained in:
wyj committed 2026-09-25 23:35:45 -04:00
1 parent 3deebfb2fa
commit 229f50cd86
14 files changed
+2372 -55

No files matched your search

+7 -3
View File
@@ -10,9 +10,13 @@ The default CPU build needs:
- A C11 compiler and OpenMP runtime (for example, GCC with libgomp).
- GNU Make.
- libpng headers and library for PNG output.
- `pkg-config`, used to locate and link FFTW.
- FFTW 3 built with OpenMP, discovered through `pkg-config fftw3_omp`
(`sci-libs/fftw[openmp]` on Gentoo). This is required for the CPU fast-mode
fast convolution; HIP and dummy PSF builds do not link FFTW.
Optional dependencies are CFITSIO and `pkg-config` for HDR/FITS output, and
HIP/ROCm with `hipcc` and a compatible GPU for HIP PSF accumulation.
Optional dependencies are CFITSIO for HDR/FITS output, and HIP/ROCm with
`hipcc` and a compatible GPU for HIP PSF accumulation.
## CPU build
@@ -181,7 +185,7 @@ the test executable; run it separately:
```sh
make PSF_BACKEND=hip SPACETIME=minkowski hip-psf-test
./build/Release/test_hip_psf
./build/Release/obj/minkowski/standard_sink1_hip/test_hip_psf
```
For rendering with real stellar data, continue with [README.md](README.md#prepare-the-stellar-catalog)