Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/patches/ef3e6a77e3ff40a7 # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## r15: give both sides of a SEQ parity pair the same costs (fixes the R15-PARITY-HOST flake under load) closed `ef3e6a77e3ff40a7` #581 · opened 2026-10-19 15:23 UTC · closed 2026-10-29 19:01 UTC Imported from GitHub aien-dev/omega-mv#581, by drakestapleton Base `a8ffd2b912c84197d08f963b05f9c7d8b30a3f8a` · Head `60c1b2fce22ef29ddcf2fa12099bedc25c0a9890` drakestapleton wrote on 2026-10-19 15:23 UTC Fixes the intermittent OMEGA-R15-PARITY-HOST failure (about 7 FAILs in 55 Spark judge runs, on heads with unchanged runtime code, for example `68a3a614` twice today at load 20 to 57). ## Root cause Omega times production serves and its candidate measure with the wall clock (`src/runtime/rx_omega.c` `fn_serve`, `time_calls`). AIEN and Omega make decisions from those times, so under load the two sides of a parity pair took different paths: a load spike during A725 warm-up made AIEN's prediction fail (two 8-call windows more than 20 % off), Explain read that as DRIFT, and one side opened an extra search epoch (the judge symptom: search_epoch 3 vs 2, evidence/belief/gpu_claims 16 vs 32). Heavier load also produced goal UNMET (status 4). None of these are orchestration differences between RES-1 and SEQ, which is what the gate is meant to compare. ## Fix - `rx_omega.h/.c`: optional test-only cost hook in `RxOmegaConfig` (`cost_ns`, `cost_ctx`). Default NULL (from `rx_omega_default_config`) keeps measured wall-clock time, so production is unchanged. When set, the calls still run; only the reported cost comes from the hook. - `tests/runtime/rx_r15_rig.c/.h`: fixed cost table by core class and realization kind (Omega's own unloaded measure on the GB10 host); X925 costs apply once the episode goal is in the world (a world event, not a thread timing). - `tests/runtime/rx_r15_parity.c`: turns the model on for the detector controls and pairs. Every compared field is unchanged and still compared exactly. G7, the R15 perf harness and R16 negative never enable it. - Crumbs recompiled with the pinned tool (`d0f0b95d`), last commit. ## Evidence (agent handoff on the Spark: `~/handoffs/2026-10-19-omega-r15-parity-flake.md`) - Red, base `a8ffd2b9` under pinned CPU load (2 busy loops on CPUs 14,19, test fenced to the same CPUs): 0 of 10 PASS; reproduced the exact judge symptom (search 3 vs 2, 16 vs 32 pattern). - Green, this branch, same load: 25 of 25 PASS. - Mutant (SEQ skips one evidence record; not committed): `FAIL pair 0: gpu_claims differs: RES-1 16, SEQ 15`, `SEQ_SEMANTIC_PARITY=FAIL`, loaded and unloaded. The gate still catches a real difference. - `test-r15-parity-host` PASS, `test-r15-g7-host` PASS (57 checks), `test-r10`, `test-r11`, `test-r14-host`, `test-r16-negative` PASS. - Not run: silicon parity, r15-perf, test-r16-authpath, test-r11-own-hold (GPU busy / out of scope). - Separate and not fixed here: the R13 host flake (#527 dead end) fails the same way on base and branch. Remaining wall-clock dependence (fails loudly, never changes a compared field silently): Omega's verify sandbox deadline (5 s) and the rig's failure timeouts. This PR was opened by the Hermes PR desk on Drake's behalf. drakestapleton wrote on 2026-10-29 19:01 UTC Closing in org cleanup (Drake, 2026-10-29): superseded by PR #598 and abandoned with merge conflicts. Replacement: PR #598. Reopen if still needed. ### Apply it ``` git checkout -b patch-ef3e6a77e3ff40a7 a8ffd2b912c84197d08f963b05f9c7d8b30a3f8a curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/ef3e6a77e3ff40a7.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 581 60c1b2fce22ef29ddcf2fa12099bedc25c0a9890 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":581,"url":"https://github.com/aien-dev/omega-mv/pull/581","export_sha256":"7319147b350ad908bf0b731068ec3be7b8dee848041dc862f71455e8e4680140","imported_utc":"2026-11-18T16:35:53Z"} ``` ### Changes ``` diff --git a/.crumb b/.crumb index d121d2dad..7050421d1 100644 --- a/.crumb +++ b/.crumb @@ -77,14 +77,14 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "dfa36de2ac8649f66f80587abea51a7f166285ee0b92e0e09774c98689055250", - "last_commit": "333091a6", + "digest": "b1b64344209cfd3eea39c5b47ae79f38b98e0adcb6557d06f885eac986f935c6", + "last_commit": "f2e67f8f", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", - "last_commit": "88e24bdd", + "digest": "dd592aeae42e8469d94b71ce89c9835427f7176c5389c1ab20bc237df93290f6", + "last_commit": "f2e67f8f", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -95,15 +95,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:e1a8c008214ad5dbc33a3e184d7e882dc56d1d50f9bd14c58f8773992961557e", - "compiled_at": "2026-10-18T21:10:38Z", + "children_root": "sha256:e92b04571b707d66b4cce14e565b01d5fc8568553b51d4bf09cc4387560e707e", + "compiled_at": "2026-10-19T15:23:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:be7220db494238bb4c33023d1df17286c35f947336bee5fc2e0405c136ec3e73", + "digest": "sha256:b7297efb57adef5c249fa69abd78ef58067d818bde04662971dbdb9c7a2ccf9e", "evidence_files": 11127, "evidence_root": "sha256:4528085ec1661c442b64fb5dc8def65067ea2620ff88e42bcf52d58b7642ea6e", "files": 14100, - "generated_at_commit": "f4a9849fb127f8d2d664dfc56890752ad180c507", - "source_tree": "sha256:21f93defce6c9ba159a4bd31083db787e156dfaa4afb80c3427cf88f732f8258" + "generated_at_commit": "f2e67f8f449b0e3e07d90c2c4f0c020856a3e432", + "source_tree": "sha256:c86592b587abf3e0335a039083394259d84e758e63151e0d4b30a859d46edaac" }, "owner_lane": "", "provenance": { diff --git a/src/.crumb b/src/.crumb index 4fe5298a4..b29b7a780 100644 --- a/src/.crumb +++ b/src/.crumb @@ -145,8 +145,8 @@ "purpose": "Ionic-droplet reservoir simulator (omega#440): binary32 fixed-step RK4 of the authors' droplet m" }, { - "digest": "9e27882accc1db2881793e3f389519f5dd37f83cd37c4d1a6e19f2aa2e84d217", - "last_commit": "5901baa5", + "digest": "b87400e4c599388f7a97e93608730d9eafb0c9f43a4aae452cf01979a9aa904c", + "last_commit": "f2e67f8f", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, @@ -181,15 +181,15 @@ "purpose": "Directory src/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:15012a017b26a269feb256b64875ece2912f5f82c57804baafa3777c4fcb80b9", - "compiled_at": "2026-10-16T07:33:43Z", + "children_root": "sha256:d417ee56dd1f21154af306fb3ca86e84f42f107ea1da8fc9afa16a0fac661b7a", + "compiled_at": "2026-10-19T15:23:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:dfa36de2ac8649f66f80587abea51a7f166285ee0b92e0e09774c98689055250", + "digest": "sha256:b1b64344209cfd3eea39c5b47ae79f38b98e0adcb6557d06f885eac986f935c6", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 537, - "generated_at_commit": "1d481ab853a14d3c11eff926ce1e25993085f76a", - "source_tree": "sha256:200c9243151691313acb5f86d3e9cb3058f1a1b92ece2a255b3340b691dfb894" + "generated_at_commit": "f2e67f8f449b0e3e07d90c2c4f0c020856a3e432", + "source_tree": "sha256:29b9ae4444fe0dda813aed7f2b7102bf0a6cc885a2430332d146f54b48457267" }, "owner_lane": "", "provenance": { diff --git a/src/runtime/.crumb b/src/runtime/.crumb index a07d4e990..242c89e1e 100644 --- a/src/runtime/.crumb +++ b/src/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-14T01:16:48Z", + "compiled_at": "2026-10-19T15:23:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:9e27882accc1db2881793e3f389519f5dd37f83cd37c4d1a6e19f2aa2e84d217", + "digest": "sha256:b87400e4c599388f7a97e93608730d9eafb0c9f43a4aae452cf01979a9aa904c", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 65, - "generated_at_commit": "e0abd0b524f5bf8e3ba6960b53868980bdd41b4e", - "source_tree": "sha256:b92e1bca69187a8c976a2ac11afdd807ea9690e1ca1a6ad3feb91fdda33fbbd8" + "generated_at_commit": "f2e67f8f449b0e3e07d90c2c4f0c020856a3e432", + "source_tree": "sha256:901fd7dc70cfe657a5c4017f1a0b3caec920bd5a56c0dd5684fbbdf4570a62ff" }, "owner_lane": "", "provenance": { diff --git a/src/runtime/rx_omega.c b/src/runtime/rx_omega.c index 92e993033..f63d261c2 100644 --- a/src/runtime/rx_omega.c +++ b/src/runtime/rx_omega.c @@ -169,7 +169,7 @@ int rx_omega_store_find(RxOmegaFaculty *f, uint64_t w0, RxOmegaRealization *out) } /* A realization the parent may execute: verified, and named by all 32 bytes. */ -static MatVecFn verified_fn(RxOmegaFaculty *f, const SemanticId *id) { +static MatVecFn verified_fn(RxOmegaFaculty *f, const SemanticId *id, uint32_t *kind) { pthread_mutex_lock(&f->mu); RxOmegaRealization *e = store_find_locked(f, id); MatVecFn fn = NULL; @@ -177,6 +177,7 @@ static MatVecFn verified_fn(RxOmegaFaculty *f, const SemanticId *id) { union { void *p; MatVecFn fn; } u; u.p = e->page; fn = u.fn; + if (kind) *kind = e->kind; e->parent_runs++; } pthread_mutex_unlock(&f->mu); @@ -203,17 +204,20 @@ static int fn_serve(RxCtx *c) { /* Whatever the world currently records for this regime. Never waits. */ MatVecFn fn = NULL; + uint32_t kind = RX_OMEGA_COST_REFERENCE; uint64_t used = 0; if (sel->field[0] != 0 && sel->field[6] == rx_omega_regime(M, N) && sel->field[1] != 0) { SemanticId id; id_from_words(&id, &sel->field[1]); - fn = verified_fn(f, &id); + fn = verified_fn(f, &id, &kind); if (fn) used = sel->field[1]; } uint64_t t0 = now_ns(); if (fn) fn(A, x, y, M, N); else omega_matvec_reference(A, x, y, (uint32_t)M, (uint32_t)N); uint64_t ns = now_ns() - t0; + if (f->cfg.cost_ns) + ns = f->cfg.cost_ns(f->cfg.cost_ctx, kind, (uint32_t)M, (uint32_t)N, 1); uint64_t digest = rx_omega_digest(y, (uint32_t)M); free(A); free(x); free(y); @@ -596,14 +600,18 @@ static int fn_verify(RxCtx *c) { #define ROUNDS 7u -static uint64_t time_calls(MatVecFn fn, const uint64_t *A, const uint64_t *x, uint64_t *y, +static uint64_t time_calls(const RxOmegaFaculty *f, MatVecFn fn, uint32_t kind, + const uint64_t *A, const uint64_t *x, uint64_t *y, uint32_t M, uint32_t N, uint32_t iters) { uint64_t t0 = now_ns(); for (uint32_t i = 0; i < iters; i++) { if (fn) fn(A, x, y, M, N); else omega_matvec_reference(A, x, y, M, N); } - return now_ns() - t0; + uint64_t ns = now_ns() - t0; + if (f->cfg.cost_ns) + ns = f->cfg.cost_ns(f->cfg.cost_ctx, fn ? kind : RX_OMEGA_COST_REFERENCE, M, N, iters); + return ns; } static int fn_measure(RxCtx *c) { @@ -622,7 +630,8 @@ static int fn_measure(RxCtx *c) { SemanticId id; id_from_words(&id, &cand->field[2]); uint64_t cps = 0, rps = 0, state = RX_OMEGA_DECLINED; - MatVecFn fn = v->field[1] == RX_OMEGA_PASSED ? verified_fn(f, &id) : NULL; + uint32_t kind = RX_OMEGA_COST_REFERENCE; + MatVecFn fn = v->field[1] == RX_OMEGA_PASSED ? verified_fn(f, &id, &kind) : NULL; uint32_t M = (uint32_t)s->field[1], N = (uint32_t)s->field[2]; if (fn && shape_ok(M, N)) { uint64_t *A = malloc((size_t)M * N * sizeof(uint64_t)); @@ -635,14 +644,14 @@ static int fn_measure(RxCtx *c) { omega_matvec_reference(A, x, yr, M, N); if (memcmp(y, yr, (size_t)M * sizeof(uint64_t)) == 0) { /* Size one round to about 200 microseconds of the reference. */ - uint64_t one = time_calls(NULL, A, x, yr, M, N, 1); + uint64_t one = time_calls(f, NULL, kind, A, x, yr, M, N, 1); uint32_t iters = one ? (uint32_t)(200000u / one) : 1000u; if (iters < 4) iters = 4; if (iters > 20000) iters = 20000; uint64_t best_c = UINT64_MAX, best_r = UINT64_MAX; for (uint32_t r = 0; r < ROUNDS; r++) { - uint64_t tc = time_calls(fn, A, x, y, M, N, iters); - uint64_t tr = time_calls(NULL, A, x, yr, M, N, iters); + uint64_t tc = time_calls(f, fn, kind, A, x, y, M, N, iters); + uint64_t tr = time_calls(f, NULL, kind, A, x, yr, M, N, iters); if (tc < best_c) best_c = tc; if (tr < best_r) best_r = tr; } diff --git a/src/runtime/rx_omega.h b/src/runtime/rx_omega.h index 6f5c60570..4290ba5e2 100644 --- a/src/runtime/rx_omega.h +++ b/src/runtime/rx_omega.h @@ -103,8 +103,16 @@ typedef struct { uint64_t hot_ns; uint32_t margin_pct; /* a realization must beat the reference by this */ uint32_t sandbox_ms; + /* Test only (R15 SEQ parity): when set, the cost of `calls` matvec calls + * replaces the wall-clock time measured around them, in serve and in + * measure. The calls still run. kind is the realization kind, or + * RX_OMEGA_COST_REFERENCE for the reference. NULL measures, as always. */ + uint64_t (*cost_ns)(void *ctx, uint32_t kind, uint32_t M, uint32_t N, uint64_t calls); + void *cost_ctx; } RxOmegaConfig; +#define RX_OMEGA_COST_REFERENCE UINT32_MAX + typedef struct { RxObjRef request, demand, result, search, selection; RxObjRef candidate[RX_OMEGA_SLOTS]; diff --git a/tests/.crumb b/tests/.crumb index bd5535a8b..4a57a7282 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -265,8 +265,8 @@ "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64" }, { - "digest": "bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", - "last_commit": "501d555c", + "digest": "7b373d0abea64f01c89d8ff40beab9366e302195eaea96e74cab34ef34055591", + "last_commit": "f2e67f8f", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -295,15 +295,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8", - "compiled_at": "2026-10-16T19:04:20Z", + "children_root": "sha256:92efdb2367194f2e55608acdda600c763c0fafdbfb7dbc378d35a3afd518a4aa", + "compiled_at": "2026-10-19T15:23:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", + "digest": "sha256:dd592aeae42e8469d94b71ce89c9835427f7176c5389c1ab20bc237df93290f6", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", "files": 1270, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc" + "generated_at_commit": "f2e67f8f449b0e3e07d90c2c4f0c020856a3e432", + "source_tree": "sha256:46165872c2ac8c94d2fdc65cb73db34930d58523dc5667a112ff7976897d6a25" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb index 48918ae9f..e52158ad1 100644 --- a/tests/runtime/.crumb +++ b/tests/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-13T02:12:57Z", + "compiled_at": "2026-10-19T15:23:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", + "digest": "sha256:7b373d0abea64f01c89d8ff40beab9366e302195eaea96e74cab34ef34055591", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 70, - "generated_at_commit": "95829f2abd7f66461b4ba153ea807f39e9d06db8", - "source_tree": "sha256:e037c5156071865094d0e60262d34ca920be2dd6f98e2603a1f0082330ba7841" + "generated_at_commit": "f2e67f8f449b0e3e07d90c2c4f0c020856a3e432", + "source_tree": "sha256:0277003955ee961ac4a6a63b69b997a3af2ba1247ce02a5e920017473888afc3" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/rx_r15_parity.c b/tests/runtime/rx_r15_parity.c index 0ed57f633..b25ae771a 100644 --- a/tests/runtime/rx_r15_parity.c +++ b/tests/runtime/rx_r15_parity.c @@ -14,8 +14,16 @@ * evidence, AIEN's belief, generation identity, the in-force realization * and the authority outcome. Gated on each side: goal MET, crumbs verify, * no crumb overflow, no illegal transition, no wrong result, no use of a - * realization not in force, and no lost trigger. Measured costs are printed - * and not compared. + * realization not in force, and no lost trigger. + * + * Both sides see the same costs: the rig gives Omega a fixed cost table + * (r15_use_cost_model) in place of wall-clock time, while the work itself + * still runs. Measured time differed between the two sides of a pair, and + * under machine load it crossed AIEN's and Omega's thresholds on one side + * only (a 20% miss read as drift opened an extra search; an X925 cost over + * the target left the goal UNMET), so a pair could differ for reasons that + * are not orchestration. With equal cost inputs any difference is the + * orchestration's. Costs are printed and not compared. * * R15_PARITY_PAIRS (default 5) sets the number of pairs. * Exit status 0 = SEQ_SEMANTIC_PARITY PASS. @@ -101,7 +109,7 @@ static int run_side(R15Config c, uint64_t target, R15Outcome *o, char *first, si static void print_side(const char *side, const R15Outcome *o) { printf(" %-5s goal status %llu, plan action %llu reason %llu, epoch %llu, " "selected %016llx (verdict %llu), evidence %llu/%llu trials, belief %llu, " - "generation %llu -> %llu, in force %016llx; measured: incumbent %llu ns, " + "generation %llu -> %llu, in force %016llx; costs: incumbent %llu ns, " "selected %llu ps, reference %llu ps, served %llu, crumbs %llu\n", side, U(o->goal_status), U(o->plan_action), U(o->plan_reason), U(o->selection_epoch), U(o->selection_id[0]), U(o->selected_verdict), U(o->evidence[4]), U(o->evidence[3]), @@ -160,7 +168,8 @@ int main(void) { printf("R15 SEQ parity: processor stand-in seat (host)\n"); #endif /* Diagnostic only (not the gate): R15_PARITY_REPEAT=: - * runs n episodes of one configuration and reports each outcome. */ + * runs n episodes of one configuration and reports each outcome, with + * measured (wall-clock) costs. */ const char *rep = getenv("R15_PARITY_REPEAT"); if (rep) { R15Config c = strncmp(rep, "SEQ", 3) == 0 ? R15_SEQ @@ -182,6 +191,7 @@ int main(void) { printf("R15 repeat %s: %d of %d failed\n", r15_config_name(c), bad, n); return bad ? 1 : 0; } + r15_use_cost_model(1); detector_control(R15_RES1); detector_control(R15_SEQ); for (int p = 0; p < pairs; p++) { diff --git a/tests/runtime/rx_r15_rig.c b/tests/runtime/rx_r15_rig.c index 48bb529ce..eb2ec6e8f 100644 --- a/tests/runtime/rx_r15_rig.c +++ b/tests/runtime/rx_r15_rig.c @@ -54,6 +54,36 @@ static uint64_t field(R15Rig *r, RxObjRef ref, uint32_t i) { return rx_world_read(&r->w, ref, &o) == RX_OK ? o.field[i] : UINT64_MAX; } +/* Fixed matvec cost per call in ns, by core class and realization kind + * (0..3, then the reference; any other kind is priced as the reference): + * Omega's own measure of each kind on this GB10, unloaded, 2026-10-19. On + * A725 quad4 is inside the 10% margin, so the first search keeps the + * reference; on X925 quad4 wins and its cost is under 55% of the A725 + * incumbent, so the goal is MET. */ +static const uint64_t k_model_ns[2][5] = { + {13300, 11100, 11300, 6060, 6200}, /* A725 */ + {4900, 4400, 4900, 2700, 4600}, /* X925 */ +}; + +static int g_cost_model; + +void r15_use_cost_model(int on) { g_cost_model = on; } + +/* X925 costs apply once the episode's goal is in the world. The goal is + * published after the X925 placement, so the cost change is tied to a world + * event, not to when the episode's thread gets to run: a thread paused + * between steps cannot open a window of X925 costs under the A725 + * placement, or of A725 costs in the X925 search. The goal is read live, so + * the one demand window spanning the goal mixes both costs; it can only add + * a miss to the A725 prediction, which the X925 costs fail anyway. A failed + * read counts as X925. */ +static uint64_t model_cost(void *ctx, uint32_t kind, uint32_t M, uint32_t N, uint64_t calls) { + R15Rig *r = ctx; + (void)M; (void)N; /* the rig serves one shape, R15_M x R15_N */ + uint32_t cls = field(r, r->aien.o.goal, 0) != 0; + return calls * k_model_ns[cls][kind < 4 ? kind : 4]; +} + static const RxSnapshotDep *snapshot(RxCtx *c, RxObjRef ref) { for (uint32_t i = 0; i < c->n_in; i++) if (c->in[i].obj.id == ref.id) return &c->in[i]; @@ -313,6 +343,10 @@ int r15_start_with(R15Rig *r, R15Config config, const uint32_t *fixture_subjects RxOmegaConfig oc; rx_omega_default_config(&oc); oc.hot_calls = 64; oc.hot_ns = 200000; oc.margin_pct = 10; + if (g_cost_model) { + oc.cost_ns = model_cost; + oc.cost_ctx = r; + } if (rx_omega_create_objects(&r->omega, &r->w, &oc) != RX_OK) return -1; r->omega.keys = &r->keys_omega; RxAienConfig ac; diff --git a/tests/runtime/rx_r15_rig.h b/tests/runtime/rx_r15_rig.h index bc3d12d73..148cc3310 100644 --- a/tests/runtime/rx_r15_rig.h +++ b/tests/runtime/rx_r15_rig.h @@ -154,6 +154,12 @@ int r15_placement(R15Rig *r, uint32_t cls); /* Confine every thread of the process to one core class. */ int r15_move_class(uint32_t cls); const char *r15_config_name(R15Config c); +/* Rigs started after this call (on = 1) give Omega a fixed cost table in + * place of wall-clock time for serve and measure, so every rig sees the same + * costs whatever the machine's load. The SEQ parity gate uses it for its + * detector controls and pairs; every other rig user (G7, the R15 harness, + * R16 negative) keeps measured costs (default off). */ +void r15_use_cost_model(int on); /* Reactions whose last activation read an older version of a trigger field * than the one now in the world (changes after the build baseline), in a ```