Skip to navigation

aitune.torch.tune_strategy.first_wins_strategy

View as Markdown

First Wins tune strategy.

Module Contents

Classes

NameDescription
FirstWinsStrategyTry backends in order and stop at the first that passes the configured checks.

API

class aitune.torch.tune_strategy.first_wins_strategy.FirstWinsStrategy(
backends: list[aitune.torch.backend.Backend] | None = None,
kwargs = {}
)

Bases: PerformanceValidationMixin, MultiBackendStrategy

Try backends in order and stop at the first that passes the configured checks.

The default order tries TensorRT export paths before Inductor. It is a fallback policy, not a measured performance ranking. AOT and JIT use the same order.

aitune.torch.tune_strategy.first_wins_strategy.FirstWinsStrategy._default_aot_backends(
distributed: bool = False

Try TensorRT before Inductor for AOT; distributed modules need Inductor backends.

aitune.torch.tune_strategy.first_wins_strategy.FirstWinsStrategy._default_jit_backends(
distributed: bool = False

Try TensorRT before Inductor for JIT; distributed modules need Inductor backends.

aitune.torch.tune_strategy.first_wins_strategy.FirstWinsStrategy._describe_parts() -> list[str]

Returns the parts of the description.

aitune.torch.tune_strategy.first_wins_strategy.FirstWinsStrategy._tune(
module: torch.nn.Module,
name: str,
device: torch.device,
cache_dir: pathlib.Path

Tune a torch module with the provided graph specification and samples.

aitune.torch.tune_strategy.first_wins_strategy.FirstWinsStrategy.to_json_dict() -> dict[str, typing.Any]

Returns config dict for first wins strategy.