ejmahler / RustFFT

RustFFT is a high-performance FFT library written in pure Rust.
Apache License 2.0
705 stars 49 forks source link

Fix size 1 simd butterflies #119

Closed HEnquist closed 1 year ago

HEnquist commented 1 year ago

This fixes a problem where SSE and NEON size 1 butterflies don't work for out-of-place transform. The tests were not catching this because it was using a clone of the expected result as output. Therefore it could not catch that butterflies never wrote anything to the output.

ejmahler commented 1 year ago

Good catch. I must have cloned the input vec in the tests purely for the convenience of not having to specify the length again.

I'm slightly sad that in the case of an in-place transform, we do an unnecessary read and unnecessary write. I can think of some ways to fix it, but if you're doing a size-1 FFT you are almost certainly never going to notice its performance. So, better to keep it simple.

HEnquist commented 1 year ago

I'm slightly sad that in the case of an in-place transform, we do an unnecessary read and unnecessary write

Yeah I agree. I thought a little about it but couldn't come up with any simple way to avoid it. It probably doesn't matter though, anyone who cares about performance is not likely to do 1-point FFT at all :D