diff --git a/apps/fft/fft.cpp b/apps/fft/fft.cpp index 862b3f3e81e5..57f689b6aa07 100644 --- a/apps/fft/fft.cpp +++ b/apps/fft/fft.cpp @@ -1064,6 +1064,7 @@ namespace { // Compute a factorization of N suitable for use in the FFT. vector radix_factor(int N) { + assert(N > 0); // Some special cases to optimize. switch (N) { case 16: diff --git a/apps/fft/fft_generator.cpp b/apps/fft/fft_generator.cpp index e24481f90d2f..1d91ed85dd06 100644 --- a/apps/fft/fft_generator.cpp +++ b/apps/fft/fft_generator.cpp @@ -63,11 +63,9 @@ class FFTGenerator : public Halide::Generator { GeneratorParam output_number_type{"output_number_type", FFTNumberType::Real, fft_number_type_enum_map()}; - // Size of first dimension, required to be greater than zero. - GeneratorParam size0{"size0", 1}; - // Size of second dimension, may be zero for 1D FFT. - GeneratorParam size1{"size1", 0}; - // TODO(zalman): Add support for 3D and maybe 4D FFTs + // Size of dimensions, required to be greater than one + GeneratorParam size0{"size0", 2}; + GeneratorParam size1{"size1", 2}; // The input buffer. Must be separate from the output. // Only Float(32) is supported. @@ -85,7 +83,7 @@ class FFTGenerator : public Halide::Generator { Output> output{"output"}; void generate() { - _halide_user_assert(size0 > 0) << "FFT must be at least 1D\n"; + _halide_user_assert(size0 > 1 && size1 > 1) << "Both dimensions must be at least size 2\n"; Fft2dDesc desc;