Skip to content

feat(op): add hlo_fft for forward/inverse Fourier transforms#160

Open
sebffischer wants to merge 1 commit into
mainfrom
dev/20260428-fft
Open

feat(op): add hlo_fft for forward/inverse Fourier transforms#160
sebffischer wants to merge 1 commit into
mainfrom
dev/20260428-fft

Conversation

@sebffischer
Copy link
Copy Markdown
Collaborator

Summary

  • Adds hlo_fft() implementing the StableHLO fft op per SPEC.md for all four variants: FFT, IFFT, RFFT, IRFFT.
  • Type inference (infer_types_fft()) covers all spec constraints C1–C5, with each check annotated.
  • Custom repr.OpFft emits fft_type = #stablehlo<fft_type X> and fft_length = array<i64: …>.
  • Re-exports ComplexType() from tengen and adds repr.ComplexTypecomplex<f32> / complex<f64>.

Depends on r-xla/tengen#5 (adds ComplexType to tengen).

Test plan

  • testthat::test_file("tests/testthat/test-op-fft.R") — 21 passed, 0 failures.
  • Full test suite (testthat::test_local(".")) — 931 passed, 0 failures, 0 warnings.
  • PJRT compiles + executes a real-only RFFT → IRFFT round-trip end-to-end (numeric equality verified).
  • Snapshot coverage of repr for all four variants and of every constraint error.

Notes

Direct execution of variants returning a complex buffer works in PJRT but R-side has no complex dtype yet, so those tests are limited to IR snapshots.

🤖 Generated with Claude Code

Implements stablehlo.fft per SPEC.md, supporting all four variants
(FFT, IFFT, RFFT, IRFFT) with full constraint checking (C1-C5).

Re-exports ComplexType from tengen so users can refer to complex<f32>
(c64) and complex<f64> (c128) tensors. Depends on the matching
ComplexType addition in tengen.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant