Skip to content

Add FFT convolution kernels #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

wheeheee
Copy link
Member

@wheeheee wheeheee commented Jul 3, 2025

This is a draft for adding FFT convolution kernels (that are also plans), which are useful for repeated convolutions.
A lot has been adapted from the code here, courtesy of @JanJereczek
Here's what I have done so far:

  • created an abstract type for FFT convolution kernels tentatively named FFTConvKernel, subtypes R/CFFTConvKernel
  • working code for real and complex FFT convolution kernels and Array, FFTW flag defaults to FFTW.MEASURE
  • in the process, found that we don't check if the output indices are valid (i.e. out[output_indices] doesn't throw) before doing work except for :direct, so I added that. Don't remember if we have discussed this before, so left it in just in case
  • IIUC the kernel/plans can be reused for smaller x, maybe larger depending on nffts
  • not very tested, will add tests later if the feature is wanted

A typical workflow goes like this:

  1. Calculate outsize, the size of the intended output size(out) .+ size(ker) .- 1
  2. Create kernel with RFFTConvKernel or CFFTConvKernel(kernel, outsize)
  3. Run something like conv!(out[i], arrs[i], kernel) in a loop

Feedback would be much appreciated

Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 15.21739% with 39 lines in your changes missing coverage. Please review.

Project coverage is 96.98%. Comparing base (0660d55) to head (f26843a).

Files with missing lines Patch % Lines
src/dspbase.jl 15.21% 39 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #638      +/-   ##
==========================================
- Coverage   98.13%   96.98%   -1.16%     
==========================================
  Files          19       19              
  Lines        3277     3320      +43     
==========================================
+ Hits         3216     3220       +4     
- Misses         61      100      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants