aitune.torch.tune_strategy.min_latency_strategy

View as Markdown

Min latency tune strategy.

Module Contents

Classes

NameDescription
MinLatencyProfilingResultProfiling result for min-latency selection.
MinLatencyStrategySearches and selects the backend with minimum latency at batch size 1.

API

class aitune.torch.tune_strategy.min_latency_strategy.MinLatencyProfilingResult(
selected_batch_size: int = 1,
latency: float
)
Dataclass

Bases: BackendProfilingResult

Profiling result for min-latency selection.

latency
float
metric
float

Returns latency as the comparison metric.

selected_batch_size
int = 1
class aitune.torch.tune_strategy.min_latency_strategy.MinLatencyStrategy(
args = (),
kwargs = {}
)

Bases: ProfilingTuneStrategy

Searches and selects the backend with minimum latency at batch size 1.

TorchEager is profiled in _pre_tune as a latency baseline when baseline validation is enabled (not injected into the backends list). When validation is enabled, the strategy falls back to TorchEager when no user-provided backend beats it. When disabled, the best user-provided backend wins and the strategy raises if all user backends fail.

_description
_metric_label
= 'latency'
_metric_unit
= 'ms'
_title
= 'Min Latency Strategy'
_value_fmt
= '.3f'
aitune.torch.tune_strategy.min_latency_strategy.MinLatencyStrategy._get_profiling_config(
batching: bool,
max_batch_size: int
aitune.torch.tune_strategy.min_latency_strategy.MinLatencyStrategy._is_better(
) -> bool

Profiles the backend at batch size 1 and returns latency.

aitune.torch.tune_strategy.min_latency_strategy.MinLatencyStrategy._speedup(
) -> float