Dynamic config schema for map-like options.
More...
#include <config_schema.h>
Dynamic config schema for map-like options.
The schema supports:
- Option declaration (
def_option<T>)
- Optional canonicalizer (
set_canonicalizer)
- Resolution (
Resolve) that performs validation/defaulting, unknown-key policy, and canonicalization (last).
◆ Canonicalizer
◆ ConfigMap
◆ def_option()
template<typename T , typename... Traits>
| ConfigSchema& tvm::ir::ConfigSchema::def_option |
( |
const ffi::String & |
key, |
|
|
Traits &&... |
traits |
|
) |
| |
|
inline |
Declare a typed option.
Validation/coercion is implicitly generated from T. Additional optional traits may be supplied (e.g. refl::DefaultValue, const char* doc).
- Template Parameters
-
| T | The canonical value type of this option. |
| Traits | Optional metadata/traits. |
- Parameters
-
| key | Option key. |
| traits | Optional traits. |
- Returns
- Reference to
*this for chaining.
◆ HasOption()
| bool tvm::ir::ConfigSchema::HasOption |
( |
const ffi::String & |
key | ) |
const |
|
inline |
Check if an option with the given key exists.
◆ ListOptions()
| const std::vector<OptionEntry>& tvm::ir::ConfigSchema::ListOptions |
( |
| ) |
const |
|
inline |
List declared options in declaration order.
- Returns
- Const reference to the option entries vector.
◆ Resolve()
Default/validate, then canonicalize a config object.
Resolve flow: 1) Validate/coerce declared options in declaration order. 2) Materialize defaults and enforce required options. 3) Apply unknown-key policy. 4) Run canonicalizer as final step.
- Parameters
-
| config | Input config object. |
- Returns
- Canonical validated config object.
- Exceptions
-
| ValueError/TypeError | with option context. |
◆ set_canonicalizer()
Set whole-object canonicalizer.
◆ set_error_on_unknown()
| void tvm::ir::ConfigSchema::set_error_on_unknown |
( |
bool |
value | ) |
|
|
inline |
Set whether unknown keys trigger an error.
The documentation for this class was generated from the following file: