Skip to content
heliaAOT
HELIA HUB

knobs

The knob registry: each optimization knob declared once.

Copyright 2025 Ambiq. All Rights Reserved.

Machine-readable model

class

KnobSpec

Python

One optimization knob.

helia_aot/optimization/knobs.py:16

KnobSpec(
name: str,
values: tuple[str, ...],
default: str,
approximate_values: frozenset[str],
auto: Mapping[OptimizationGoal, str],
applies_to: frozenset[str],
summary: str,
) -> None

dataclass

One optimization knob.

method

resolve

Python

Resolve a requested value; auto follows the static table.

helia_aot/optimization/knobs.py:42

resolve(requested: str, goal: OptimizationGoal, allow_approximate: bool) -> str

Resolve a requested value; auto follows the static table.

An explicit value is used as given. auto takes the goal’s value, unless that value is approximate and the gate is closed, in which case it takes default.

Parameters of resolve
NameTypeDefaultDescription
requestedstrRequiredThe requested value, possibly ``auto``.
goalOptimizationGoalRequired``optimization.goal``.
allow_approximateboolRequired``optimization.allow_approximate``.
Returns of resolve
ValueTypeDescription
strstrA value from ``values``.
Errors raised by resolve
TypeDescription
ValueErrorIf ``requested`` is neither ``auto`` nor one of ``values``.
function

knob

Python

Look up a knob by name.

helia_aot/optimization/knobs.py:122

knob(name: str) -> KnobSpec

Look up a knob by name.

Parameters of knob
NameTypeDefaultDescription
namestrRequiredThe knob's name.
Returns of knob
ValueTypeDescription
KnobSpecKnobSpecThe knob.
Errors raised by knob
TypeDescription
KeyErrorWhen no knob has that name.