interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / spec / omega-incremental-semantics.md

226 lines · 10172 bytes Raw Blame History Source

Omega semantic variables and incremental recomputation

Gate: OMEGA_INCREMENTAL_SEMANTICS_PASS Code: src/runtime/rx_semantic.{h,c} Test: tests/runtime/rx_sem_incremental.c (make test-sem-incremental)

Objective

Do not recompute cognition or derived state when nothing relevant changed.

Model

SemanticValue (RxSemValue) has these fields:

Semantic values come in two kinds:

DerivedSemanticValue (RxSemDerived) is one immutable cache entry:

Rule

A result is reused if and only if all of these match:

derivation_id                 = H(name, out_type, implementation generation, implementation digest)
for every input:  semantic_id, generation, digest(type, value words)

The key is SHA-256 over exactly these values. A cache hit also compares the full stored input record, not only the digest.

The key leaves out the following, on purpose:

None of these change meaning.

Three layers

Each layer is cheaper than the next one.

  1. Branch memo. A CLEAN node is served with no work.
  2. Early cutoff. A DIRTY node rebuilds its key. If the key is unchanged, the memo is still exact and nothing runs.
  3. Content-addressed cache. The cache is shared by every branch, agent, task and J-Space candidate in the engine. A hit reuses a result computed elsewhere from identical inputs. A miss runs the function once and files the result.

Invalidation (field-granular)

Writing a source changes one field. It marks DIRTY only the nodes that declared that field, plus their transitive readers, and only in the branch that was written. Two kinds of change mark nothing:

Example: a temperature change dirties thermal placement and the plan that reads it. It does not dirty any of these:

The test measures an object-granular baseline for comparison.

rx_sem_sync_world pulls bound fields from rx_world. It skips any field whose world field_version did not move. Retiring an object has two effects:

Branches and J-Space

A branch is a forked semantic view with its own source values and its own memo. A J-Space candidate is a branch that has a candidate id (see aien-architecture docs/06-jspace.md). A write in one branch never reaches the parent, a sibling, or the world. The cache can be shared safely because its keys are the complete content of what each result was derived from.

Provenance

Every PRODUCE and REUSE is a hash-chained event:

rx_sem_verify checks all of the following:

Qualification

The qualification has two parts: PROVE, which checks correctness, and MEASURE, which replays the same workload four ways.

PROVE

All of these run against a real rx_world with capabilities:

checkwhat it shows
dependency_trackingInputs match the declarations. The reverse index is right. Downstream of temperature is exactly {placement, plan}. Node ids are idempotent. A missing input is refused.
correct_invalidation400 unrelated world writes cause 0 invalidations and 0 runs. Temperature change: 2 nodes dirty, 4 stay clean, exactly 2 runs. Fan change: fan health only. A same-value write invalidates nothing. Early cutoff: the plan is not rerun when the placement comes back the same.
no_stale_reuse200,000 randomized operations: writes from a small value domain (so values recur), forks, drops and gets over up to 12 branches. Every get is compared with a from-scratch evaluator, and every hit is recomputed in audit mode. Also a directed A-B-A case.
generation_isolationAn object retired and re-created with the same bytes is refused while stale, then recomputed. A promoted function generation is recomputed and never served generation-1 results.
branch_isolationTwo candidates with different writes. The parent memo, the parent values and the world digest are unchanged. A sibling does not see the other's writes. A parent world change does not reach forked candidates. Dropping one candidate leaves the other intact.
cross_branch_valid_reuseAnother agent on another task gets the whole plan from the cache with 0 runs. 16 J-Space candidates with 4 distinct proposals: 8 runs and 24 cache hits, and duplicates are identical.
causal_provenanceA reused value explains back to its producer and to the world crumb that wrote its input. World crumbs verify. A REUSE event exists for the consumer. A tampered entry or event is detected.

MEASURE

One deterministic organism trace: 600 ticks.

The four replay modes:

modewhat it does
FULLRecomputes every derivation on every query.
OBJECTMemo plus cutoff, with object-granular invalidation.
FIELDMemo plus cutoff, with field-granular invalidation.
ENGINEFIELD plus the shared cache.

Checks:

The receipt reports:

Energy method. The measurement uses the on-device counters for package, CPU-E and CPU-P from hwmon aien_spbm, as described in the R15 research notes.

This measures the marginal energy of the work. It is not a wall-outlet measurement and not a quiet-machine R15 qualification.

Gate values

valuewhen
PASSAll checks pass, energy was measured and valid, and the run is bound to a clean candidate commit (OMEGA_CANDIDATE_COMMIT equals HEAD and the tree is clean).
PASS_UNBOUNDEverything passes, but the run is not bound to a clean candidate commit.
HOST_PASS_ENERGY_UNMEASUREDEverything passes on a host with no energy counter, such as CI.
FAILAnything else.

The host gate (tests/gates/run.sh rx-host-reference) requires the value that matches the machine: PASS on a host whose hwmon exposes the aien_spbm package energy counter, HOST_PASS_ENERGY_UNMEASURED on a host without it. It records which one as the observation incremental_semantics_verdict. PASS_UNBOUND and FAIL fail the gate on every host (omega-mv#404 item 2).

Limits