Skip to content

Commit

Permalink
clean up the code
Browse files Browse the repository at this point in the history
Signed-off-by: Bangtian Liu <liubangtian@gmail.com>
  • Loading branch information
bangtianliu committed Jan 14, 2025
1 parent c51351a commit d13ec6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
17 changes: 8 additions & 9 deletions tuner/examples/simple/simple_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def main():
)
print("Generating candidate tuning specs...")
with TunerContext(logger=root_logger) as tuner_context:
tuner_context.add_logging_handler(summary_handler)
tuner_context.logger.addHandler(summary_handler)
simple_tuner = SimpleTuner(tuner_context)
candidates = libtuner.generate_candidate_specs(
args, path_config, candidate_trackers, simple_tuner
Expand All @@ -121,11 +121,11 @@ def main():
if stop_after_phase == libtuner.ExecutionPhases.compile_dispatches:
return

print("Benchmarking compiled dispatch candidates...")
logging.info(f"Summarization about top dispatch candidates:")
message = "Benchmarking compiled dispatch candidates..."
print(message)
logging.info(message)
simple_tuner.benchmark_flags = ["--input=1", "--benchmark_repetitions=3"]
top_candidates = libtuner.benchmark(
tuner_context,
args,
path_config,
compiled_candidates,
Expand Down Expand Up @@ -153,12 +153,12 @@ def main():
if stop_after_phase == libtuner.ExecutionPhases.compile_models:
return

print("Benchmarking compiled model candidates...")
logging.info(f"Summarization about top model candidates:")
message = "Benchmarking compiled model candidates..."
print(message)
logging.info(message)
simple_tuner.benchmark_flags = model_benchmark_flags
simple_tuner.benchmark_timeout = 60
top_model_candidates = libtuner.benchmark(
tuner_context,
args,
path_config,
compiled_model_candidates,
Expand All @@ -173,6 +173,5 @@ def main():

print("Check the detailed execution logs in:")
print(path_config.run_log.resolve())

print("Check the tuning results in:")
print("Check the summary in:")
print(path_config.summary_log.resolve())
3 changes: 0 additions & 3 deletions tuner/tuner/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def __enter__(self) -> "TunerContext":
self.mlir_ctx.__enter__()
return self

def add_logging_handler(self, handler: logging.Handler) -> None:
self.logger.addHandler(handler)

def __exit__(
self,
exc_type: type[BaseException] | None,
Expand Down
1 change: 0 additions & 1 deletion tuner/tuner/libtuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,6 @@ def get_speedup(result: BenchmarkResult) -> float:


def benchmark(
tuner_context: TunerContext,
args: argparse.Namespace,
path_config: PathConfig,
compiled_candidates: list[int],
Expand Down

0 comments on commit d13ec6a

Please sign in to comment.