Skip to content

Commit 580075c

Browse files
fix restricted/invalid configs being counted as fevals (#202)
1 parent ab2d870 commit 580075c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

kernel_tuner/strategies/common.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,24 @@ def __call__(self, x, check_restrictions=True):
9494
result = params_dict
9595
result[self.tuning_options.objective] = util.InvalidConfig()
9696

97-
# compile and benchmark this instance
98-
if not result:
97+
if legal:
98+
# compile and benchmark this instance
9999
res = self.runner.run([params], self.tuning_options)
100100
result = res[0]
101101

102-
# append to tuning results
103-
if x_int not in self.tuning_options.unique_results:
104-
self.tuning_options.unique_results[x_int] = result
102+
# append to tuning results
103+
if x_int not in self.tuning_options.unique_results:
104+
self.tuning_options.unique_results[x_int] = result
105105

106-
self.results.append(result)
106+
self.results.append(result)
107+
108+
# upon returning from this function control will be given back to the strategy, so reset the start time
109+
self.runner.last_strategy_start_time = perf_counter()
107110

108111
# get numerical return value, taking optimization direction into account
109112
return_value = result[self.tuning_options.objective] or sys.float_info.max
110113
return_value = return_value if not self.tuning_options.objective_higher_is_better else -return_value
111114

112-
# upon returning from this function control will be given back to the strategy, so reset the start time
113-
self.runner.last_strategy_start_time = perf_counter()
114115
return return_value
115116

116117
def get_bounds_x0_eps(self):

0 commit comments

Comments
 (0)