@@ -60,7 +60,7 @@ def __init__(self, kernel_source, kernel_options, device_options, iterations, ob
6060
6161 def get_device_info (self ):
6262 return self .dev
63-
63+
6464 def get_environment (self , tuning_options ):
6565 env = self .dev .get_environment ()
6666 env ["simulation" ] = True
@@ -90,7 +90,7 @@ def run(self, parameter_space, tuning_options):
9090 if tuning_options .budget .is_done ():
9191 results .append (None )
9292 continue
93-
93+
9494 # check if element is in the cache
9595 key = "," .join ([str (i ) for i in element ])
9696
@@ -109,33 +109,33 @@ def run(self, parameter_space, tuning_options):
109109 # is served from the cache beyond the first timel. That is, when the
110110 # configuration is already counted towards the unique_results.
111111 if key in self .visited_results :
112- result = util .disable_benchmark_timings (result )
112+ result = util .copy_without_benchmark_timings (result )
113113 else :
114114 # configuration is evaluated for the first time, print to the console
115115 util .print_config_output (tuning_options .tune_params , result , self .quiet , tuning_options .metrics , self .units )
116116 self .visited_results .add (key )
117117
118- # Simulate the evaluation of this configuration
119- tuning_options .budget .add_evaluations (1 )
120- tuning_options .budget .add_time (milliseconds = result ["compile_time" ])
121- tuning_options .budget .add_time (milliseconds = result ["verification_time" ])
122- tuning_options .budget .add_time (milliseconds = result ["benchmark_time" ])
123-
124118 try :
125119 self .total_simulated_time += result ["compile_time" ] + result ["verification_time" ] + result ["benchmark_time" ]
126120 except KeyError :
127121 raise RuntimeError (
128122 "Cannot use simulation mode with a time limit on a cache file that does not have full compile, verification, and benchmark timings on all configurations"
129123 )
130124
125+ # Simulate the evaluation of this configuration
126+ tuning_options .budget .add_evaluations (1 )
127+ tuning_options .budget .add_time (milliseconds = result ["compile_time" ])
128+ tuning_options .budget .add_time (milliseconds = result ["verification_time" ])
129+ tuning_options .budget .add_time (milliseconds = result ["benchmark_time" ])
130+
131131 results .append (result )
132132 continue
133133
134134 # if the configuration is not in the cache and not within restrictions, simulate an InvalidConfig with warning
135135 params_dict = dict (zip (tuning_options ['tune_params' ].keys (), element ))
136136 check = util .check_restrictions (tuning_options .restrictions , params_dict , True )
137137 if not check :
138- result = util .disable_benchmark_timings (params_dict ) # Set timings to zero
138+ result = util .copy_without_benchmark_timings (params_dict ) # Set timings to zero
139139 result [tuning_options .objective ] = util .InvalidConfig ()
140140 results .append (result )
141141 warn (f"Configuration { element } not in cache, does not pass restrictions. Will be treated as an InvalidConfig, but make sure you are evaluating the correct cache file." )
@@ -159,8 +159,8 @@ def run(self, parameter_space, tuning_options):
159159 for result in results :
160160 if result :
161161 # Time must be in ms
162- result ["strategy_time" ] = strategy_time / num_valid_results
163- result ["framework_time" ] = framework_time / num_valid_results
162+ result ["strategy_time" ] = 1000 * strategy_time / num_valid_results
163+ result ["framework_time" ] = 1000 * framework_time / num_valid_results
164164
165165
166166 return results
0 commit comments