From e1a42ebeaa6eb74428feca945977101ab1e7caf6 Mon Sep 17 00:00:00 2001 From: stijn Date: Mon, 8 Dec 2025 14:51:33 +0100 Subject: [PATCH] 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. --- kernel_tuner/strategies/pyatf_strategies.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel_tuner/strategies/pyatf_strategies.py b/kernel_tuner/strategies/pyatf_strategies.py index 897b3b5b..d0d67778 100644 --- a/kernel_tuner/strategies/pyatf_strategies.py +++ b/kernel_tuner/strategies/pyatf_strategies.py @@ -82,11 +82,10 @@ def tune(searchspace: Searchspace, runner, tuning_options): get_next_coordinates_or_indices = search_technique.get_next_coordinates coordinates_or_indices = set() # Set[Union[Coordinates, Index]] costs = {} # Dict[Union[Coordinates, Index], Cost] - eval_count = 0 try: # optimization loop (KT-compatible re-implementation of `make_step` from TuningRun) - while eval_count < searchspace.size: + while len(tuning_options.unique_results) < searchspace.size: # get new coordinates if not coordinates_or_indices: @@ -110,7 +109,6 @@ def tune(searchspace: Searchspace, runner, tuning_options): valid = False else: cost = opt_result - eval_count += 1 # record the evaluation costs[coords_or_index] = cost