KNOBS
PythonKNOBS: tuple[KnobSpec, ...] = (ACCUMULATION, KERNEL)The knob registry: each optimization knob declared once.
Copyright 2025 Ambiq. All Rights Reserved.
KNOBSconstantKnobSpecclassOne optimization knob.knob_namesfunctionThe names of all knobs.knobfunctionLook up a knob by name.default_knob_valuesfunctionEach knob's default value, the choice an operator makes without a handler.KNOBS: tuple[KnobSpec, ...] = (ACCUMULATION, KERNEL)One optimization knob.
KnobSpec( name: str, values: tuple[str, ...], default: str, approximate_values: frozenset[str], auto: Mapping[OptimizationGoal, str], applies_to: frozenset[str], summary: str,) -> Nonedataclass
One optimization knob.
name: strThe knob’s configuration key under optimization and
operators[].optimization.
values: tuple[str, ...]Its values, excluding auto.
default: strThe value that keeps the kernel library’s default numerics;
auto falls back to it when the approximation gate is closed.
approximate_values: frozenset[str]Values that change numerics relative to
default.
auto: Mapping[OptimizationGoal, str]The value auto picks for each goal, subject to the
approximation gate.
applies_to: frozenset[str]Operator type keys the knob can apply to.
summary: strWhat the knob changes.
Resolve a requested value; auto follows the static table.
resolve(requested: str, goal: OptimizationGoal, allow_approximate: bool) -> strResolve 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
| Name | Type | Default | Description |
|---|---|---|---|
requested | str | Required | The requested value, possibly ``auto``. |
goal | OptimizationGoal | Required | ``optimization.goal``. |
allow_approximate | bool | Required | ``optimization.allow_approximate``. |
Returns
| Value | Type | Description |
|---|---|---|
str | str | A value from ``values``. |
Raises
| Type | Description |
|---|---|
ValueError | If ``requested`` is neither ``auto`` nor one of ``values``. |
Whether value changes numerics relative to default.
is_approximate(value: str) -> boolWhether value changes numerics relative to default.
The names of all knobs.
knob_names() -> frozenset[str]The names of all knobs.
Look up a knob by name.
knob(name: str) -> KnobSpecLook up a knob by name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | str | Required | The knob's name. |
Returns
| Value | Type | Description |
|---|---|---|
KnobSpec | KnobSpec | The knob. |
Raises
| Type | Description |
|---|---|
KeyError | When no knob has that name. |
Each knob's default value, the choice an operator makes without a handler.
default_knob_values() -> dict[str, str]Each knob’s default value, the choice an operator makes without a handler.