← Back to Pull requests

fix(fftw3) : Unify fftw3 build for linux and windows #10209

Closed
unknown closed this pull request without merging on Nov 25, 2026 08:08 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 07:23 UTC
Author

Motivation

#8527 fixed fftw3's broken SONAME on Linux by switching it to GNU Autotools, while Windows kept using upstream's own CMake build. #8874 then added SSE2/AVX/AVX2 SIMD codelet flags on top of that autotools path. The result is that third-party/fftw3 is the only module in the superbuild with two completely different build systems depending on platform. Divergent flags, divergent patch surfaces, and twice the maintenance burden every time fftw3 needs a bump or a new platform-specific fix.

This PR reverts both #8527 and #8874's build-system changes and fixes the same underlying problems directly in upstream's own CMake build instead, so Linux and Windows share one build path, one set of patches, and one config output. No autotools, no second code path to maintain.

ISSUE ID : https://github.com/ROCm/TheRock/issues/7781

What changed

  • Revert #8527's autotools/CMake split (and #8874's SIMD-flag additions stacked on top of it) back to a single therock_cmake_subproject_declare path, used on both platforms. amdrocm-fft-test's package restoration in package.json is deliberately not reverted.

  • patches/third-party/fftw3/0001-fix-soversion-version-swap.patch: upstream's set_target_properties(... SOVERSION 3.6.9 VERSION 3 ...) has SOVERSION/VERSION backwards, so the linker embeds libfftw3.so.3.6.9 as the SONAME instead of libfftw3.so.3. No downstream package (and no system-provided fftw3) ships a library with that name, so anything linked against our build could never resolve the dependency against a normally-packaged fftw3. This was the original motivation for #8527's SONAME-targeted autotools switch.

  • patches/third-party/fftw3/0002-relocatable-config.patch: upstream's FFTW3Config.cmake.in bakes the build machine's absolute @CMAKE_INSTALL_FULL_LIBDIR@/@CMAKE_INSTALL_FULL_INCLUDEDIR@ into the legacy FFTW3_LIBRARY_DIRS/FFTW3_INCLUDE_DIRS variables, so a staged install copied elsewhere fails to resolve (#7781). Fixed with CMake's own configure_package_config_file()/PATH_VARS machinery.

  • Re-enable the SSE2/AVX/AVX2 SIMD codelet flags on Linux x86_64 that #8874 had added on top of the autotools build (-DENABLE_SSE2/AVX/AVX2=ON); AVX-512 has no equivalent in upstream's CMake build and is left as a separate follow-up if ever needed.

  • build_tools/packaging/linux/package.json: amdrocm-fft-test (which ships rocfft-test/hipfft-test, link directly against GPL-licensed libfftw3) was declared License: MIT. Corrected to MIT AND GPL.

  • cmake/tests/therock_subproject_prebuilt_test.py: updated a hardening-coverage test as the auto-tools part is reverted.
  • Test plan / results

    CI run: https://github.com/ROCm/TheRock/actions/runs/44941739592 — Linux (gfx90a, gfx94X-dcgpu) and Windows (gfx110X-all) math-libs builds, downstream DEB/RPM packaging, and "Trigger Test Artifacts" all completed with success.

    Verified against the downloaded build artifacts from that run:

    Relocatable config: FFTW3Config.cmake generated from the patched template resolves FFTW3_LIBRARY_DIRS/FFTW3_INCLUDE_DIRS via @PACKAGE_INIT@ → get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) — no build-machine absolute path baked in. FFTW3LibraryDepends.cmake/-release.cmake are generated by upstream's own install(EXPORT) unchanged, with correct relocatable _IMPORT_PREFIX logic.

    SONAME fix, at the library itself (readelf -d):

    libfftw3.so.3.6.9         SONAME: libfftw3.so.3
    libfftw3_threads.so.3.6.9 SONAME: libfftw3_threads.so.3
    

    SONAME fix, at the actual compiled/linked test binaries (readelf -d`) — the real end-to-end check, not just config metadata:

    rocfft-test  NEEDED  libfftw3.so.3
    rocfft-test  NEEDED  libfftw3_threads.so.3
    rocfft-test  NEEDED  libfftw3f.so.3
    rocfft-test  NEEDED  libfftw3f_threads.so.3
    
    hipfft-test  NEEDED  libfftw3.so.3
    hipfft-test  NEEDED  libfftw3_threads.so.3
    hipfft-test  NEEDED  libfftw3f.so.3
    hipfft-test  NEEDED  libfftw3f_threads.so.3
    

    All four library variants resolve to the correct unversioned SONAME in two independent consumers.

    Diff: 522 lines (+391 / -131) across 6 files Reviewer: nunnikri Review duration: 2925m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 522 lines diff across 6 files
    0.48
    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.374
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10209"
    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: 47.8% (MEDIUM) · Higher = larger blast radius
    47.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: 18.9% · Safe to merge
    18.9%
    Repository