|
1 | 1 | // Copyright (C) Mihai Preda. |
2 | 2 |
|
3 | 3 | #include "FFTConfig.h" |
| 4 | +#include "Args.h" |
4 | 5 | #include "common.h" |
5 | 6 | #include "log.h" |
6 | 7 | #include "TuneEntry.h" |
@@ -183,35 +184,25 @@ FFTConfig FFTConfig::bestFit(const Args& args, u32 E, const string& spec) { |
183 | 184 | // A FFT-spec was given, simply take the first FFT from the spec that can handle E |
184 | 185 | if (!spec.empty()) { |
185 | 186 | FFTConfig fft{spec}; |
186 | | - if (fft.maxExp() < E) { |
187 | | - log("%s can not handle %u\n", fft.spec().c_str(), E); |
188 | | - throw "FFT size"; |
| 187 | + if (fft.maxExp() * args.fftOverdrive < E) { |
| 188 | + log("Warning: %s (max %u) may be too small for %u\n", fft.spec().c_str(), fft.maxExp(), E); |
189 | 189 | } |
190 | 190 | return fft; |
191 | | - /* |
192 | | - for (const FFTShape& shape : FFTShape::multiSpec(spec)) { |
193 | | - for (u32 v = 0; v < N_VARIANT; ++v) { |
194 | | - if (FFTConfig fft{shape, v}; fft.maxExp() >= E) { return fft; } |
195 | | - } |
196 | | - } |
197 | | - log("%s can not handle %u\n", spec.c_str(), E); |
198 | | - throw "FFT size"; |
199 | | - */ |
200 | 191 | } |
201 | 192 |
|
202 | 193 | // No FFT-spec given, so choose from tune.txt the fastest FFT that can handle E |
203 | 194 | vector<TuneEntry> tunes = TuneEntry::readTuneFile(args); |
204 | 195 | for (const TuneEntry& e : tunes) { |
205 | 196 | // The first acceptable is the best as they're sorted by cost |
206 | | - if (E <= e.fft.maxExp()) { return e.fft; } |
| 197 | + if (E <= e.fft.maxExp() * args.fftOverdrive) { return e.fft; } |
207 | 198 | } |
208 | 199 |
|
209 | 200 | log("No FFTs found in tune.txt that can handle %u. Consider tuning with -tune\n", E); |
210 | 201 |
|
211 | 202 | // Take the first FFT that can handle E |
212 | 203 | for (const FFTShape& shape : FFTShape::allShapes()) { |
213 | 204 | for (u32 v = 0; v < 4; ++v) { |
214 | | - if (FFTConfig fft{shape, v, CARRY_AUTO}; fft.maxExp() >= E) { return fft; } |
| 205 | + if (FFTConfig fft{shape, v, CARRY_AUTO}; fft.maxExp() * args.fftOverdrive >= E) { return fft; } |
215 | 206 | } |
216 | 207 | } |
217 | 208 |
|
|
0 commit comments