PERF: Backport ABI-guaranteed SIMD baselines for FFTW builds#6028
Conversation
Cherry-pick of PR InsightSoftwareConsortium#6007 (commits 3662401, 934faaa) from main. Enable FFTW SIMD codelets using ABI-guaranteed baselines: - x86_64: SSE + SSE2 (required by AMD64 ABI) -- default ON - aarch64: NEON (required by AArch64 ABI) -- default ON - AVX/AVX2: default OFF unless compiler already targets them MSVC is excluded (FFTW SIMD codelets use GCC/Clang inline assembly). Simplifies AVX detection guards to #ifndef form. Closes InsightSoftwareConsortium#6025. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| CMake/itkExternal_FFTW.cmake | Adds ABI-guaranteed SIMD defaults (SSE/SSE2 on x86_64, NEON on aarch64) and AVX/AVX2 opt-in via compile-time macro detection; the documented MSVC exclusion is not guarded in code, likely regressing the fix from base-branch commit 418a2c2. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Configure ITK with FFTW] --> B{ITK_USE_SYSTEM_FFTW?}
B -- Yes --> Z[find_package FFTW]
B -- No --> C{macOS universal build?}
C -- Yes --> D[All SIMD defaults OFF]
C -- No --> E{CMAKE_SYSTEM_PROCESSOR}
E -- aarch64/arm64/ARM64 --> F[_fftw_default_neon = ON]
E -- x86_64/AMD64 --> G[_fftw_default_sse = ON / _fftw_default_sse2 = ON]
G --> H{check_c_source_compiles #ifndef __AVX__}
H -- compiles --> I[_fftw_default_avx = ON]
H -- fails --> J[avx stays OFF]
I --> K{check_c_source_compiles #ifndef __AVX2__}
J --> K
K -- compiles --> L[_fftw_default_avx2 = ON]
K -- fails --> M[avx2 stays OFF]
E -- i686/i386 --> N[All defaults OFF]
F --> O[option FFTW_ENABLE_* first-configure defaults]
L --> O
M --> O
N --> O
O --> P[ExternalProject_Add fftwf / fftwd with -DENABLE_* flags]
Reviews (1): Last reviewed commit: "PERF: Backport ABI-guaranteed SIMD basel..." | Re-trigger Greptile
thewtex
left a comment
There was a problem hiding this comment.
🚀
Will merge after CI turns green for 5.4.6.
Responding to @greptile-apps's review comment: This file is now identical to the The MSVC concern is unfounded. FFTW 3.3.10's SSE/SSE2 codelets are intrinsics-based ( Additionally, the ITK Windows CI does not enable FFTW ( No guard needed — this matches |
|
/azp run ITK.macOS |
|
/azp run |
|
You're absolutely right — thanks for the detailed clarification. I wasn't aware that FFTW's SSE/SSE2 codelets use intrinsics rather than inline assembly, and that the few Since this is a verbatim backport matching Tip: You can give me more context with .greptile/rules so I get this right next time. |
|
/azp run |
41a9b6f
into
InsightSoftwareConsortium:release-5.4
Summary
Backport of PR #6007 to
release-5.4. Cherry-pick of commits36624017c8and
934faaa8d5squashed into a single commit.Enables FFTW SIMD codelets using ABI-guaranteed baselines for
redistributable binary packages:
MSVC excluded (FFTW SIMD codelets use GCC/Clang inline assembly).
Also simplifies AVX detection guards to
#ifndefform.Closes #6025.
Test plan
🤖 Generated with Claude Code