Skip to content

Commit 4f05bb7

Browse files
committed
Introduce BenchmarkProvider abstraction for kernel benchmarking
1 parent 18b1021 commit 4f05bb7

File tree

7 files changed

+826
-699
lines changed

7 files changed

+826
-699
lines changed

helion/_testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from ._utils import counters
3535
from .runtime.settings import _get_backend
3636
from .runtime.settings import is_pallas_interpret
37-
from helion.autotuner.base_search import _clone_args
37+
from helion.autotuner.benchmark_provider import _clone_args
3838

3939
if _get_backend() == "pallas":
4040
from .autotuner.benchmarking import compute_repeat_generic as compute_repeat

helion/autotuner/aot_cache.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import os
3232
from pathlib import Path
3333
import sys
34-
import tempfile
3534
import traceback
3635
from typing import TYPE_CHECKING
3736
from typing import Any
@@ -757,11 +756,9 @@ def measure_all_configs(self) -> list[tuple[Config, float]]:
757756
old_precompile = self.autotuner.settings.autotune_precompile
758757
self.autotuner.settings.autotune_precompile = None
759758

760-
# Set up tmpdir if needed (normally done inside autotune())
761-
tmpdir_created = False
762-
if self.autotuner._precompile_tmpdir is None:
763-
self.autotuner._precompile_tmpdir = tempfile.TemporaryDirectory()
764-
tmpdir_created = True
759+
# Set up provider resources if needed (normally done inside autotune())
760+
benchmark_provider = self.autotuner.benchmark_provider
761+
benchmark_provider.setup()
765762

766763
try:
767764
for i, config in enumerate(all_configs):
@@ -805,9 +802,7 @@ def measure_all_configs(self) -> list[tuple[Config, float]]:
805802
finally:
806803
# Restore settings
807804
self.autotuner.settings.autotune_precompile = old_precompile
808-
if tmpdir_created and self.autotuner._precompile_tmpdir is not None:
809-
self.autotuner._precompile_tmpdir.cleanup()
810-
self.autotuner._precompile_tmpdir = None
805+
benchmark_provider.cleanup()
811806

812807
print(
813808
f"[AOT measure] Completed: {len(results)}/{len(all_configs)} configs succeeded",

0 commit comments

Comments
 (0)