Skip to content

Commit 3bf9414

Browse files
authored
Improve error message when no good config is found (#455)
1 parent 297f17a commit 3bf9414

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

helion/autotuner/base_search.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ def population_statistics(population: list[PopulationMember]) -> str:
386386
population = sorted(population, key=performance)
387387
if math.isinf(population[-1].perf):
388388
working = [x for x in population if not math.isinf(x.perf)]
389+
if len(working) == 0:
390+
raise exc.NoConfigFound
389391
return (
390392
f"failed={len(population) - len(working)} "
391393
f"min={working[0].perf:.4f} "

helion/exc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ class NotEnoughConfigs(BaseError):
245245
message = "FiniteSearch requires at least two configs, but got {0}."
246246

247247

248+
class NoConfigFound(BaseError):
249+
message = "No working config found from autotuning"
250+
251+
248252
class CantCombineTypesInControlFlow(BaseError):
249253
message = "Cannot combine types for {0!r} in control flow: {1} and {2}"
250254

0 commit comments

Comments
 (0)