in compiler_gym/envs/llvm/llvm_env.py [0:0]
def reset(self, *args, **kwargs):
try:
observation = super().reset(*args, **kwargs)
except ValueError as e:
# Catch and re-raise some known benchmark initialization errors with
# a more informative error type.
if "Failed to compute .text size cost" in str(e):
raise BenchmarkInitError(
f"Failed to initialize benchmark {self._benchmark_in_use.uri}: {e}"
) from e
elif (
"File not found:" in str(e)
or "File is empty:" in str(e)
or "Error reading file:" in str(e)
):
raise BenchmarkInitError(str(e)) from e
raise
# Resend the runtimes-per-observation session parameter, if it is a
# non-default value.
if self._runtimes_per_observation_count is not None:
self.runtime_observation_count = self._runtimes_per_observation_count
if self._runtimes_warmup_per_observation_count is not None:
self.runtime_warmup_runs_count = self._runtimes_warmup_per_observation_count
return observation