Skip to content

Add vectorized vec5 cubic and tree32 phase approximations + benchmark updates#65

Merged
falseywinchnet merged 2 commits into
mainfrom
ubkvb7-main/add-new-atan_vectoring_network_experiment
Jun 27, 2026
Merged

Add vectorized vec5 cubic and tree32 phase approximations + benchmark updates#65
falseywinchnet merged 2 commits into
mainfrom
ubkvb7-main/add-new-atan_vectoring_network_experiment

Conversation

@falseywinchnet

Copy link
Copy Markdown
Owner

Motivation

  • Improve atan2/phase computation performance by adding a vectorized 2‑lane path and a new cubic vec5 first‑octant approximation while keeping the existing tree32 degree7 approach.
  • Make the core phase computation generic so different first‑octant strategies can be selected and reused in scalar and vector paths.
  • Expand the benchmark to measure multiple phase implementations and sin/cos table performance.

Description

  • Added low‑level vector helpers and predicates/macros (V2_DIV, V2_CMPGT, V2_SELECT) and a BRUUN_ALWAYS_INLINE macro to src/detail/bruun_kernel.hpp to support portable 2‑lane SIMD code for SSE2 and NEON.
  • Introduced bruun_atan_leaf_cubic, a new bruun_phase_first_octant_vec5_cubic scalar implementation, and retained the previous tree32/degree7 code as bruun_phase_first_octant_tree32_degree7.
  • Factored a generic templated bruun_phase_atan2_core that accepts a first‑octant function, added a 2‑lane SIMD version bruun_phase_first_octant_vec5_cubic_v2, and a paired vector entrypoint bruun_phase_atan2_mag_pair that computes two phases at once; replaced bruun_phase_atan2_mag to call through the core path.
  • Updated FFT forward_mag_phase to use the paired/vectorized path when available and to write magnitude/phase back into output more directly.
  • Updated examples/atan2_benchmark.cpp to include phase in samples and to time multiple variants (std::atan2, tree32, default, vec5 scalar, vec5 pair when BRUUN_LEVEL>=1, float variants, and sin+cos table), and added formatted benchmark output lines.

Testing

  • Built the library with -DBRUUN_LEVEL=1 (x86_64 with SSE2) and compiled examples/atan2_benchmark, which executed and produced benchmark output successfully.
  • Ran the project's test/validation step (ctest / unit tests) after the build and observed no failures.

Codex Task

@falseywinchnet falseywinchnet merged commit ee475ee into main Jun 27, 2026
0 of 4 checks passed
@falseywinchnet falseywinchnet deleted the ubkvb7-main/add-new-atan_vectoring_network_experiment branch June 27, 2026 11:51
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