Skip to content

Add AVX2 float BODFT forward combine (8-position, FMA)#72

Merged
falseywinchnet merged 1 commit into
mainfrom
yxlmq0-main/optimize-performance-with-avx2/sse2
Jun 27, 2026
Merged

Add AVX2 float BODFT forward combine (8-position, FMA)#72
falseywinchnet merged 1 commit into
mainfrom
yxlmq0-main/optimize-performance-with-avx2/sse2

Conversation

@falseywinchnet

Copy link
Copy Markdown
Owner

Motivation

  • Close the remaining performance gap by adding an AVX2/FMA single-precision forward combine so float BODFT can use a 256-bit path instead of only the 128-bit SSE2/NEON path.
  • Keep the scalar and 128-bit SIMD paths as fallbacks so correctness and non-AVX builds are preserved.

Description

  • Implemented an eight-position AVX2 single-precision forward combine in src/detail/bodft_kernel.hpp with helpers bodft_uzp8_ps, bodft_store8_ps, bodft_rev8_ps and bodft_combine_fwd_avx2_f32 that use AVX2/FMA intrinsics to deinterleave, compute three child twiddle products with vfmaddps/vfmsubps, permute lane-reversed partner bins, and store outputs through an AVX2 packing helper.
  • Routed float combine dispatch so when BRUUN_LEVEL >= 2 and sizeof(RT) == 4 the new AVX2 float path is used, while the existing 128-bit SSE2/NEON float combine remains the fallback and scalar tail loop remains unchanged.
  • Tightened the 128-bit fallback call to only run when the AVX2 path did not handle any positions to avoid redundant work.
  • Documented the change and validation in src/detail/bodft_avx2_notes.md describing the new float combine, FMA usage, partner-bin permutes, fallback behavior, and validation steps.

Testing

  • Built the project with cmake --build build -j2 and the build completed successfully.
  • Ran unit/functional tests with ctest --test-dir build --output-on-failure and all tests passed (2/2 tests passed).
  • Emitted assembly with make asm-check BUILD_DIR=build and verified AVX2/FMA instructions and permutes were present by searching for vfmadd*ps, vfmsub*ps, vpermd/permutes in the generated build/src/bodft_avx2.s.
  • Built and executed the standalone BODFT benchmark (examples/bodft_benchmark) on an AVX2/FMA build and on an SSE2/no-AVX build to validate correctness and timings; the benchmark completed and printed correctness/timing output for both float and double runs.

Codex Task

@falseywinchnet falseywinchnet merged commit aa658f9 into main Jun 27, 2026
4 checks passed
@falseywinchnet falseywinchnet deleted the yxlmq0-main/optimize-performance-with-avx2/sse2 branch June 27, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant