Skip to content

Commit e4bdb2e

Browse files
only warm up when actually going to compile and run kernels
1 parent 3c7b8aa commit e4bdb2e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

kernel_tuner/runners/sequential.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,8 @@ def run(self, parameter_space, kernel_options, tuning_options):
7171
for element in parameter_space:
7272
params = OrderedDict(zip(tuning_options.tune_params.keys(), element))
7373

74-
# attempt to warmup the GPU by running the first config in the parameter space and ignoring the result
75-
warmup_time = 0
76-
if not self.warmed_up:
77-
warmup_time = perf_counter()
78-
self.dev.compile_and_benchmark(self.kernel_source, self.gpu_args, params, kernel_options, tuning_options)
79-
self.warmed_up = True
80-
warmup_time = 1e3 * (perf_counter() - warmup_time)
81-
8274
result = None
75+
warmup_time = 0
8376

8477
# check if configuration is in the cache
8578
x_int = ",".join([str(i) for i in element])
@@ -89,6 +82,14 @@ def run(self, parameter_space, kernel_options, tuning_options):
8982
params['verification_time'] = 0
9083
params['benchmark_time'] = 0
9184
else:
85+
86+
# attempt to warmup the GPU by running the first config in the parameter space and ignoring the result
87+
if not self.warmed_up:
88+
warmup_time = perf_counter()
89+
self.dev.compile_and_benchmark(self.kernel_source, self.gpu_args, params, kernel_options, tuning_options)
90+
self.warmed_up = True
91+
warmup_time = 1e3 * (perf_counter() - warmup_time)
92+
9293
result = self.dev.compile_and_benchmark(self.kernel_source, self.gpu_args, params, kernel_options, tuning_options)
9394

9495
params.update(result)

0 commit comments

Comments
 (0)