Skip to content

Commit e1a42eb

Browse files
committed
Fix evaluation count in PyATF search strategies
The search strategies from PyATF are not guaranteed to always give a unique point. It is possible that `get_next_coordinates` actually returns the same configurations multiple times. However, these should not count towards the evaluation limit (`max_feval`). This commit makes it so that only unique configuration evaluations are counted towards the limit.
1 parent f9b223b commit e1a42eb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

kernel_tuner/strategies/pyatf_strategies.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,10 @@ def tune(searchspace: Searchspace, runner, tuning_options):
8282
get_next_coordinates_or_indices = search_technique.get_next_coordinates
8383
coordinates_or_indices = set() # Set[Union[Coordinates, Index]]
8484
costs = {} # Dict[Union[Coordinates, Index], Cost]
85-
eval_count = 0
8685

8786
try:
8887
# optimization loop (KT-compatible re-implementation of `make_step` from TuningRun)
89-
while eval_count < searchspace.size:
88+
while len(tuning_options.unique_results) < searchspace.size:
9089

9190
# get new coordinates
9291
if not coordinates_or_indices:
@@ -110,7 +109,6 @@ def tune(searchspace: Searchspace, runner, tuning_options):
110109
valid = False
111110
else:
112111
cost = opt_result
113-
eval_count += 1
114112

115113
# record the evaluation
116114
costs[coords_or_index] = cost

0 commit comments

Comments
 (0)