Skip to content

Commit

Permalink
KFR: skip real fft for odd sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
dancazarin committed Feb 26, 2024
1 parent bbcf60d commit 779c730
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions fftlibs/kfr/kfr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ class fft_implementation<dims, real, false, invert, inplace> : public fft_impl<r
template <typename real>
fft_impl_ptr<real> fft_create(const std::vector<size_t>& size, bool is_complex, bool invert, bool inplace)
{
if (!is_complex)
{
size_t s = std::accumulate(size.begin(), size.end(), size_t(1), std::multiplies<>{});
if (s & 1)
return nullptr;
}
return fft_create_for<fft_implementation, real>(size, is_complex, invert, inplace);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fft_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ std::string execfile(std::string command)
static std::string outname;
static bool progress = true;
static bool banner = true;
bool avx2only = false;
bool avx2only = false;
static std::vector<std::vector<size_t>> sizes;
static std::vector<bool> is_complex_list{ true, false };
static std::vector<bool> inverse_list{ false, true };
Expand Down

0 comments on commit 779c730

Please sign in to comment.