Module materialize
Expand description
Materializing one trial’s RunConfig TOML from the base config.
The child receives the sampled values as rendered strings
(ATUNE_PARAM_<key>) and the base config as text. materialize applies
each value at its dotted key, sets the trial’s run.seed/run.root/
run.timestamp/run.slug, and re-serializes — the pure, unit-tested half
of the objective (04-rl-and-oniro.md §B.1 seam #3: “decode assignment into
section fields, or merge partial TOML”).
§Typing the overlaid values
A rendered value is a string; the target config field wants a concrete TOML
type. Rather than guessing from the string (which is lossy — a float value
of exactly 1.0 renders as "1" and would be mistaken for an integer, and
a choice(64, 128, 256) label is a string that must become an integer for
an integer field), the value is coerced to the type the base config
already has at that key. The base config is the source of truth for the
field’s type, so train.hidden (an integer in the base) stays an integer
and train.algo (a string) stays a string. A key absent from the base has
no type to mirror and falls back to inferring int → float → bool → string.
§The seed field
oniro’s run.seed is a u64, but a TOML integer is an i64, and the
executor’s replicate seed spans the whole u64 range. The seed is therefore
reduced to 63 bits with oniro_seed before it is written — a
deterministic reduction, so a paired common-random-numbers seed is still
common across trials (replicate j of trial i and trial i + 1 map to
the same run.seed), which is the whole point of the pairing.
Constants§
- MAX_
CONFIG_ BYTES - The most bytes a
RunConfigTOML may occupy, read or produced.
Functions§
- check_
config_ size - Refuses a config text that is over
MAX_CONFIG_BYTES. - materialize
- Builds one trial’s
RunConfigTOML. - oniro_
seed - Reduces a
u64replicate seed to a non-negativei64, so it fits oniro’s TOML integerrun.seedfield.