Skip to content

Delay mag-phase conversion and wire atan benchmark#67

Merged
falseywinchnet merged 1 commit into
mainfrom
jmprpn-main/update-mag+phase-output-process
Jun 27, 2026
Merged

Delay mag-phase conversion and wire atan benchmark#67
falseywinchnet merged 1 commit into
mainfrom
jmprpn-main/update-mag+phase-output-process

Conversation

@falseywinchnet

Copy link
Copy Markdown
Owner

Motivation

  • Move phase computation out of the residue packing loop so residues are first rearranged/packed into standard complex bin order and then converted contiguously to magnitude/phase to enable a more vector-friendly conversion pass.
  • Use the existing vec5 cubic/vectorized phase path where possible to accelerate paired phase computation for both double and float.
  • Adjust the atan2 microbenchmark and wiring so the benchmark exercises the paired/vectorized path and can be built via make benchmarks for fairer comparisons.

Description

  • Reworked forward_mag_phase to first pack Bruun residues into standard complex bin order (fill output[k].re/output[k].im from work) and then call a contiguous conversion helper convert_standard_complex_to_mag_phase. (See src/detail/bruun_kernel.hpp.)
  • Added convert_standard_complex_to_mag_phase and convert_standard_complex_to_mag_phase_f32 helpers that perform contiguous complex->(magnitude,phase) conversion and reuse the vec5 cubic paired/vectorized phase path via bruun_phase_atan2_mag_pair for paired lanes where BRUUN_LEVEL >= 1.
  • Changed single-precision forward_mag_phase_f32 to pack residues in 4-wide batches using pack4_residues_to_complex_f32 when possible, then call the contiguous convert_standard_complex_to_mag_phase_f32 helper.
  • Updated examples/atan2_benchmark.cpp to introduce time_vec5_pair_loop which benchmarks the paired vec5 path, replaced the previous single-sample vec5 timing with the paired/vectorized timing for doubles, and clarified printed labels.
  • Wired the new atan2 benchmark into the Makefile by adding an ATAN2_BENCH target and including it in the benchmarks target so it builds with make benchmarks.

Testing

  • Ran make test benchmarks which built the library and benchmarks and executed unit probes; build/tests/correctness printed correctness ok and build/tests/api_c printed c api ok indicating success.
  • Built and ran the atan2 benchmark build/examples/atan2_benchmark (example run: build/examples/atan2_benchmark 1024), which produced timing output and exercised the paired/vectorized vec5 path; the run completed successfully.
  • The benchmarks target reported nothing outstanding to build after changes (make output indicated benchmarks were up-to-date), and compilation of examples succeeded during the test runs.

Codex Task

@falseywinchnet falseywinchnet merged commit 6a43448 into main Jun 27, 2026
4 checks passed
@falseywinchnet falseywinchnet deleted the jmprpn-main/update-mag+phase-output-process 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