From 45322d432e14cd126234909f0633e89ded254fc9 Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Thu, 9 Jan 2025 16:05:16 -0500 Subject: [PATCH] [Tuner] Fix handling of compilation failures (#807) Also misc fixes for logging --- tuner/tuner/libtuner.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tuner/tuner/libtuner.py b/tuner/tuner/libtuner.py index f5a316a65..8c5b15761 100644 --- a/tuner/tuner/libtuner.py +++ b/tuner/tuner/libtuner.py @@ -466,7 +466,11 @@ def run_iree_compile_command(compile_pack: CompilePack) -> Optional[int]: timeout_seconds=compile_pack.iree_compile_timeout, ) ) - if result.process_res is None or result.is_timeout: + + # We need to check if the output vmfb exists as iree-compile returns a success + # status code when crash reproducers are dumped. + output_vmfb_exists = candidate_tracker.compiled_vmfb_path.is_file() + if result.process_res is None or result.is_timeout or not output_vmfb_exists: return None return candidate_tracker.candidate_id @@ -520,7 +524,7 @@ def run_iree_benchmark_module_command(benchmark_pack: BenchmarkPack): **extra_flags, ) except ireert.benchmark.BenchmarkTimeoutError as e: - logging.warning( + logging.info( f"Benchmark of candidate {candidate_id} timed out after {timeout} seconds." ) return BenchmarkResult( @@ -557,7 +561,9 @@ def run_iree_benchmark_module_command(benchmark_pack: BenchmarkPack): ) mean_benchmark_time = sum(times) / float(len(times)) - logging.debug(f"Benchmark time of candidate {candidate_id}: {mean_benchmark_time}") + logging.debug( + f"Benchmark time of candidate {candidate_id}: {mean_benchmark_time:.2f}" + ) return BenchmarkResult( candidate_id=candidate_id, time=mean_benchmark_time,