Skip to content

Commit 30de03e

Browse files
committed
Added deepcopy of unmodified restrictions for reconstructing Searchspace later
1 parent 62d98df commit 30de03e

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

kernel_tuner/interface.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from datetime import datetime
3131
from pathlib import Path
3232
from time import perf_counter
33+
from copy import deepcopy
3334

3435
import numpy
3536
from constraint import Constraint
@@ -607,14 +608,6 @@ def tune_kernel(
607608
# ensure there is always at least three names
608609
util.append_default_block_size_names(block_size_names)
609610

610-
# if the restrictions are not constraints or a callable, the restrictions are strings, so parse them to functions (increases restrictions check performance significantly)
611-
if (
612-
restrictions is not None
613-
and not callable(restrictions)
614-
and not any(isinstance(r, Constraint) for r in restrictions)
615-
):
616-
restrictions = util.compile_restrictions(restrictions, tune_params)
617-
618611
# sort all the options into separate dicts
619612
opts = locals()
620613
kernel_options = Options([(k, opts[k]) for k in _kernel_options.keys()])
@@ -675,6 +668,7 @@ def preprocess_cache(filepath):
675668
tuning_options.cachefile = None
676669

677670
# create search space
671+
tuning_options.restrictions_unmodified = deepcopy(restrictions)
678672
searchspace = Searchspace(tune_params, restrictions, runner.dev.max_threads)
679673
restrictions = searchspace._modified_restrictions
680674
tuning_options.restrictions = restrictions

kernel_tuner/runners/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def run(self, parameter_space, tuning_options):
8282

8383
results = []
8484

85-
# iterate over parameter space
85+
# iterate over parameter space
8686
for element in parameter_space:
8787

8888
# check if element is in the cache

0 commit comments

Comments
 (0)