Expand description
Runtime configuration knobs.
A knob is a named, typed runtime setting — a kernel-selection toggle or a
heuristic threshold. Its value is resolved, in priority order, from an
explicit programmatic override, then the calling thread’s KnobScope,
then the process environment, then the global values a deployment config
installed (set_config_global), then a compiled-in default.
A knob declared scopable is read while a model is transformed or
prepared, so a KnobScope entered around those calls tunes it for that
one model. Every other knob is read elsewhere (machine detection, eval) and
only takes a process-wide value.
Knobs are declared with [declare_knob!] and register themselves into a
stack-wide inventory (this crate is the lowest in the stack, so linalg and
everything above can declare). The inventory lets every knob be listed and
documented from one place, and set through the API on targets where
environment variables are unavailable (e.g. wasm).
A knob is the lowest, deployer-facing layer of configuration; it is not a substitute for settings that must travel with a model.
Re-exports§
pub use inventory;
Structs§
- Knob
- A declared knob. Construct via [
declare_knob!] rather than directly so it is registered for listing. - Knob
Info - Type-erased description of a declared knob, collected stack-wide for listing and documentation.
- Knob
Scope - Knob values tuned for one model: entered around the calls that transform
and prepare it, they reach every
scopableknob read on this thread meanwhile.
Traits§
- Knob
Value - A type usable as a knob value: parseable from the string sources (env / API) and renderable for listing.
Functions§
- all
- All declared knobs, sorted by name.
- clear_
str - Drop a knob’s programmatic override by name. Returns
falseif not declared. - list
- Render all declared knobs as a human-readable list.
- set_
config_ global - Install a process-wide value below the environment, for a deployment config. Setting a knob again to a different value fails: two configs in one process must agree on what they both set globally.
- set_str
- Set a knob by name from a raw string — the environment-style source, for
hosts where environment variables are unavailable (e.g. wasm). Returns
falseif no knob by that name is declared.