|
24 | 24 | import sys
|
25 | 25 | from typing import Any
|
26 | 26 | from typing import Callable
|
| 27 | +import time |
27 | 28 |
|
28 | 29 | # Maps tritonbench op names to Helion kernel examples
|
29 | 30 | # Can map to a single kernel or a list of kernel variants
|
@@ -349,21 +350,17 @@ def helion_method(
|
349 | 350 | # so that each input size can go through its own autotuning.
|
350 | 351 | from helion.runtime.kernel import Kernel
|
351 | 352 |
|
352 |
| - for attr_name in dir(mod): |
353 |
| - attr = getattr(mod, attr_name) |
354 |
| - if isinstance(attr, Kernel): |
355 |
| - attr.reset() |
| 353 | + # Force autotuning unless HELION_USE_DEFAULT_CONFIG=1 is set |
| 354 | + # This ensures we run autotuning even if the kernel has pre-specified configs |
| 355 | + if os.environ.get("HELION_USE_DEFAULT_CONFIG", "0") != "1": |
| 356 | + # Find all Kernel objects in the module and force autotuning |
| 357 | + for attr_name in dir(mod): |
| 358 | + attr = getattr(mod, attr_name) |
| 359 | + if isinstance(attr, Kernel): |
| 360 | + attr.reset() |
| 361 | + attr.settings.force_autotune = True |
356 | 362 |
|
357 | 363 | def _inner() -> Callable[..., Any] | object:
|
358 |
| - # Force autotuning unless HELION_USE_DEFAULT_CONFIG=1 is set |
359 |
| - # This ensures we run autotuning even if the kernel has pre-specified configs |
360 |
| - if os.environ.get("HELION_USE_DEFAULT_CONFIG", "0") != "1": |
361 |
| - # Find all Kernel objects in the module and force autotuning |
362 |
| - for attr_name in dir(mod): |
363 |
| - attr = getattr(mod, attr_name) |
364 |
| - if isinstance(attr, Kernel): |
365 |
| - attr.settings.force_autotune = True |
366 |
| - |
367 | 364 | result = kfunc(*args)
|
368 | 365 | if callable(result):
|
369 | 366 | return result()
|
|
0 commit comments