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/ae0d47370a30440a # 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 ## GitHub aien-dev/omega-mv#1009 (code only) closed derived `ae0d47370a30440a` #1009 Imported from GitHub aien-dev/omega-mv#1009 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `a1667d594929da0a37f92f265b3105a7347055cf` · Head `efe77eac25f4bc778892599f8814840dc108c2bd` ### Fetch it A git bundle of the pull request's head, 8252 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/ae0d47370a30440a.bundle -o ae0d47370a30440a.bundle git fetch ae0d47370a30440a.bundle refs/pull/1009/head ``` Raw bundle · 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 1009 efe77eac25f4bc778892599f8814840dc108c2bd ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":1009,"url":"https://github.com/aien-dev/omega-mv/pull/1009","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:13Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 0cdbf712a..6ff51826e 100644 --- a/.crumb +++ b/.crumb @@ -48,7 +48,7 @@ }, { "digest": "c90443bd3d00414c2b75a7dd64703381ba635c8b0fa0f355f222fb5dd0840424", - "last_commit": "2638a49bd", + "last_commit": "28513391a", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -90,13 +90,13 @@ }, { "digest": "fd1213241c865c525cdbb1d84e9dbe42ed3f33056db94d08157617a88722e0a9", - "last_commit": "a99239a52", + "last_commit": "a1667d594", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "4d1c0dbfc70db83a69e68f262048bfd70e7216afda8bf0e5071ef4fb31f3a297", - "last_commit": "a99239a52", + "digest": "9ea58b159330ed3c4e74b95f1fa62f470df588ae7036ad5a5a3abb3dc47005ac", + "last_commit": "60e149b47", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -107,15 +107,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:4db466878771f1c8f38aef28e5802ffb9adbd99712976c14cb4baeb22b1550c1", - "compiled_at": "2026-10-31T14:35:27Z", + "children_root": "sha256:dfadc6dd8249af73deac5811acdd40db503086685c88012a1e5222361c76ddb0", + "compiled_at": "2026-10-31T14:53:15Z", "compiler": "crumb-compile/1", - "digest": "sha256:aad4acc546afc0f42bf4fbddc32cbfd9b8b5916fa2eca4c9c0e29047b0941838", + "digest": "sha256:4a214d1b9e17ac0a8502c857bd8dac48414597778880ca5398ed8ce2909118d1", "evidence_files": 14989, "evidence_root": "sha256:90148c46bbc2cd096c96064273ac90d63efb54260fe285e18d84429cdf657830", - "files": 23229, - "generated_at_commit": "a99239a52cff9b67d4daf41fc3ab5111bd3e17b1", - "source_tree": "sha256:03061c6431aaebdc8f63c0ce7f0dcfd8c53f787a47b74b93c356f5b9f6149d47" + "files": 23230, + "generated_at_commit": "60e149b471d940e7a15cc8a44b5e463a9f4b3be5", + "source_tree": "sha256:649b759d30e2bba12a8137c41f108e7b344c0f10067b9785f60c72e68bad3c04" }, "owner_lane": "", "provenance": { diff --git a/tests/.crumb b/tests/.crumb index 14270d374..ff6685603 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -271,8 +271,8 @@ "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64" }, { - "digest": "3c0c470be85111fb756052d050a5d4620aad93b56908050d9135bc77e441ad42", - "last_commit": "0ccdd31d7", + "digest": "2abedd856b822c40ceaffa3570f5ff27d9befbdf54c5f00e81f7f77cba5e15b2", + "last_commit": "60e149b47", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -307,15 +307,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:63ecced764c3e1a6584cf63fe2465b5120d719658dbb804ed4f5e81cf7aae9aa", - "compiled_at": "2026-10-31T14:01:27Z", + "children_root": "sha256:7a051f9379a1e960c4a0a7d8c261286e5f78eba68a9501d6249842cfa721bd50", + "compiled_at": "2026-10-31T14:53:15Z", "compiler": "crumb-compile/1", - "digest": "sha256:4d1c0dbfc70db83a69e68f262048bfd70e7216afda8bf0e5071ef4fb31f3a297", + "digest": "sha256:9ea58b159330ed3c4e74b95f1fa62f470df588ae7036ad5a5a3abb3dc47005ac", "evidence_files": 74, "evidence_root": "sha256:9aa38bf7dcfa5eb3499356a0a2a1dd7704fedfae2d16822a7c9e1400f3a72723", - "files": 2047, - "generated_at_commit": "2638a49bd83d12c1e0c76a4c446d6be1c9a4d4f4", - "source_tree": "sha256:b13fee8dc19375b9f385d3e5eabc0a6f10c06f0e3b36936e312d2c75681c8325" + "files": 2048, + "generated_at_commit": "60e149b471d940e7a15cc8a44b5e463a9f4b3be5", + "source_tree": "sha256:b9c73a06ffb9a893696c949565bd887bc63e2f15a35621c1b2337e9a2e202c93" }, "owner_lane": "", "provenance": { diff --git a/tests/gates/run.sh b/tests/gates/run.sh index 2c4ca3ffa..a315aeda1 100755 --- a/tests/gates/run.sh +++ b/tests/gates/run.sh @@ -82,6 +82,38 @@ receipt() { } gates_pass() { grep -E 'TOTAL GATES: [0-9]+ \| PASSED: [0-9]+ \| FAILED: 0' "$1" && ! grep -E 'FAILED: [1-9]' "$1"; } +# speed : a speed test (tests/runtime/rx_quiet_reps.h) that found +# the machine too busy to time ends with `AIEN-OBS not_run_reason "cpu_busy"` and exit 77; make reports +# any failing recipe as 2, so the refusal is read from the test's own receipt for this step: "failures": 0 +# and the gate word NOT_RUN, which the test writes only when nothing it judged failed. Then the step goes +# on, so every other check is still judged, and ends NOT_RUN (exit 77) only if nothing else failed. +# Anything else is the failure it was. A passing run gets the receipt check it always had. +BUSY=0 +speed() { + local target="$1" file="$2" word="$3" rc=0 r f bad=1 + make "$target" || rc=$? + if [ "$rc" -eq 0 ]; then + receipt "$file" '"failures": 0,' '"candidate_bound": true,' "\"$word\": \"PASS\"" + return + fi + # Every receipt of that name written during this step must say so; any other one keeps the failure. + r="$(find build/qual-runs -name "$file" -type f -newer "$STEP_MARK")" + if [ -n "$r" ]; then + bad=0 + while IFS= read -r f; do + grep -q '"failures": 0,' "$f" && grep -q '"candidate_bound": true,' "$f" && + grep -q "\"$word\": \"NOT_RUN\"" "$f" || bad=1 + done <<< "$r" + fi + if [ "$bad" = 0 ]; then + echo "run.sh: $target: machine too busy to time (cpu_busy); not judged, the rest of the step runs" >&2 + printf '%s\n' "$r" | xargs sha256sum + BUSY=1 + return 0 + fi + return "$rc" +} + case "$step" in crumb-verify) # Hosted crumb.yml builds the crumb tool from the aien-architecture commit in crumb.lock. @@ -244,8 +276,7 @@ case "$step" in receipt rx_capability_query_receipt.json '"failures": 0,' '"candidate_bound": true,' '"OMEGA_CAPABILITY_QUERY_PASS": "PASS"' receipt rx_semantic_comm_receipt.json '"failures": 0,' '"candidate_bound": true,' '"OMEGA_SEMANTIC_COMMUNICATION_PASS": "PASS"' receipt rx_cognitive_routing_receipt.json '"failures": 0,' '"candidate_bound": true,' '"OMEGA_COGNITIVE_ROUTING_PASS": "PASS"' - make test-workflow-fusion - receipt rx_workflow_fusion_receipt.json '"failures": 0,' '"candidate_bound": true,' '"OMEGA_WORKFLOW_FUSION_PASS": "PASS"' + speed test-workflow-fusion rx_workflow_fusion_receipt.json OMEGA_WORKFLOW_FUSION_PASS make test-typed-results receipt rx_typed_results_receipt.json '"failures": 0,' '"candidate_bound": true,' '"OMEGA_TYPED_RESULT_CONSTRAINTS_PASS": "PASS"' make test-costmodel @@ -258,6 +289,7 @@ case "$step" in tools/rx_host_receipts.sh heartbeat "$r" tools/rx_host_receipts.sh native "$native" "$OMEGA_CANDIDATE_COMMIT" tools/rx_host_receipts.sh generation "$generation" "$OMEGA_CANDIDATE_COMMIT" + if [ "$BUSY" = 1 ]; then obs not_run_reason '"cpu_busy"'; exit 77; fi ;; faculty-arm) pin physics-src-6d7cf0d physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb index d13ad2876..f7bf40653 100644 --- a/tests/runtime/.crumb +++ b/tests/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-31T14:01:27Z", + "compiled_at": "2026-10-31T14:53:15Z", "compiler": "crumb-compile/1", - "digest": "sha256:3c0c470be85111fb756052d050a5d4620aad93b56908050d9135bc77e441ad42", + "digest": "sha256:2abedd856b822c40ceaffa3570f5ff27d9befbdf54c5f00e81f7f77cba5e15b2", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 70, - "generated_at_commit": "2638a49bd83d12c1e0c76a4c446d6be1c9a4d4f4", - "source_tree": "sha256:948a02bb5e6024a6af400bfa8a1c666844391f7ec51bdca6235ce02d1b533cc6" + "files": 71, + "generated_at_commit": "60e149b471d940e7a15cc8a44b5e463a9f4b3be5", + "source_tree": "sha256:06592c124bf3aaad7c313003454851a88261ce6aca5efb5478a76496205e9125" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/rx_quiet_reps.h b/tests/runtime/rx_quiet_reps.h new file mode 100644 index 000000000..2ab310abd --- /dev/null +++ b/tests/runtime/rx_quiet_reps.h @@ -0,0 +1,107 @@ +/* Speed checks on a shared machine: keep only the repetitions the machine did + * not disturb. + * + * A stopwatch check compares wall times. On the Spark other jobs share the + * cores, and a run whose threads sat runnable without a core (the kernel's + * run-queue delay) is longer by time the code under test never asked for. + * That delay is measured, not guessed: /proc/self/task//schedstat field 2 + * is the time each thread of this process has spent runnable but waiting for + * a CPU (Documentation/scheduler/sched-stats.rst, "time spent waiting on a + * runqueue"). A repetition whose threads waited more than the allowance below + * is set aside and run again; the check then takes the same statistic (the + * median) with the same threshold over undisturbed repetitions only. + * + * Nothing is loosened: the work, the statistic and the threshold are the + * ones the check always had. A real slowdown is in every repetition, + * undisturbed ones included, so it still fails. When too few repetitions are + * undisturbed within the attempt budget the check is refused and says why + * (rx_busy_refuse below: NOT_RUN cpu_busy, never a pass). Where schedstat is missing every + * repetition counts (the old behaviour) and the output says so. + */ +#ifndef RX_QUIET_REPS_H +#define RX_QUIET_REPS_H + +#include +#include +#include + +/* Allowance: run-queue delay summed over all threads of the process during + * one repetition, at most RX_QUIET_FLOOR_NS plus RX_QUIET_PERMILLE of the + * repetition's wall time. The floor covers waking an idle worker (a few + * microseconds per hand-off on an idle core). */ +#define RX_QUIET_FLOOR_NS 50000ull +#define RX_QUIET_PERMILLE 20ull + +/* Sum of run-queue delay (ns) over every thread of this process; -1 when the + * kernel does not report it. */ +static inline int64_t rx_run_delay_ns(void) { + DIR *d = opendir("/proc/self/task"); + if (!d) return -1; + int64_t sum = 0; + int seen = 0; + struct dirent *de; + while ((de = readdir(d))) { + if (de->d_name[0] < '0' || de->d_name[0] > '9') continue; + char path[288]; + snprintf(path, sizeof path, "/proc/self/task/%s/schedstat", de->d_name); + FILE *fp = fopen(path, "r"); + if (!fp) continue; + unsigned long long on_cpu = 0, waited = 0; + if (fscanf(fp, "%llu %llu", &on_cpu, &waited) == 2) { + sum += (int64_t)waited; + seen = 1; + } + fclose(fp); + } + closedir(d); + return seen ? sum : -1; +} + +/* Whether a repetition of `wall_ns` whose threads waited `delay_ns` for a + * core counts. delay < 0 (not reported) always counts. */ +static inline int rx_quiet_rep(int64_t delay_ns, uint64_t wall_ns) { + if (delay_ns < 0) return 1; + return (uint64_t)delay_ns <= RX_QUIET_FLOOR_NS + wall_ns * RX_QUIET_PERMILLE / 1000ull; +} + +/* A check that found the machine too busy to time is a refusal, not a + * failure: nothing was measured, so nothing is judged, and the checks that + * need that measurement are not judged either. The program then ends with + * the local judge's "could not run" contract (aien-test SELF_NOT_RUN_EXIT): + * stdout line `AIEN-OBS not_run_reason "cpu_busy"` and exit 77, a retryable + * NOT_RUN, never a pass. Any real failure anywhere in the run wins: the exit + * is then 1, whatever was refused. */ +#define RX_NOT_RUN_EXIT 77 + +static inline unsigned *rx_busy_refusals(void) { + static unsigned n; + return &n; +} + +/* Record one refusal; `what` names the measurement that was not taken. */ +static inline void rx_busy_refuse(const char *what) { + (*rx_busy_refusals())++; + fprintf(stderr, " NOT RUN %s (cpu_busy): checks that need this measurement are not judged\n", what); +} + +/* The program's exit status from its failure count and `pass`, everything + * else its receipt judges: a refusal never covers a check judged false. */ +static inline int rx_busy_exit(int failures, int pass) { + if (failures) return 1; + if (*rx_busy_refusals()) { + if (!pass) return 1; + printf("AIEN-OBS not_run_reason \"cpu_busy\"\n"); + fflush(stdout); + return RX_NOT_RUN_EXIT; + } + return 0; +} + +/* A receipt's gate word: FAIL when `pass` (everything judged) is false, + * NOT_RUN when a measurement was refused, else PASS. */ +static inline const char *rx_busy_verdict(int pass) { + if (!pass) return "FAIL"; + return *rx_busy_refusals() ? "NOT_RUN" : "PASS"; +} + +#endif diff --git a/tests/runtime/rx_workflow_fusion.c b/tests/runtime/rx_workflow_fusion.c index debbf338a..bb7db2d5d 100644 --- a/tests/runtime/rx_workflow_fusion.c +++ b/tests/runtime/rx_workflow_fusion.c @@ -56,6 +56,7 @@ #include #include #include +#include "rx_quiet_reps.h" enum { SUBJ_EXTERNAL = 100, ISSUER = 3, SUBJ_PLAN = 61, SUBJ_PROPOSER = 71, SUBJ_PROMOTER = 72 }; @@ -83,6 +84,8 @@ enum { MS_COMPILED = 101, MS_HYBRID, MS_LEARNED, MS_HARDWARE, MS_POISONED, MS_PA static int g_checks; static int g_fail; +/* Measurements refused as too busy to time (rx_quiet_reps.h). */ +static int g_untimed_compiled, g_untimed_parallel, g_untimed_poisoned; #define CHECK(cond, ...) do { \ g_checks++; \ @@ -1049,34 +1052,68 @@ static int cmp_u64(const void *a, const void *b) { /* 41 interleaved runs per leg at 4 workers: reactions that computed per * run, crumbs per run, median latency, CPU time, outcomes. */ -static void measure(AgMetaSkill *m, uint32_t goal, AgFusionMeasure *ms, int with_energy, const char *what) { +/* 1 when measured; 0 when the machine was too busy to time it (a refusal, + * rx_quiet_reps.h): nothing was measured and nothing that needs it is judged. */ +static int measure(AgMetaSkill *m, uint32_t goal, AgFusionMeasure *ms, int with_energy, const char *what) { Pair *p = &g_pair; CHECK(pair_start(p, goal, m, 4) == 0, "%s: pair", what); memset(ms, 0, sizeof *ms); AgResult ro, rf; for (uint64_t r = 1; r <= 3; r++) pair_run(p, r, a_value(r), &ro, &rf, NULL, NULL, 0); enum { RUNS = 41 }; + /* RUNS undisturbed pairs (rx_quiet_reps.h): a pair counts only when + * neither leg's threads waited for a core, at most 60 attempts per pair. + * Every attempt is still checked for the same outcome on both legs. */ + enum { ATTEMPTS = RUNS * 60 }; uint64_t ns_o[RUNS], ns_f[RUNS], cpu_o = 0, cpu_f = 0, cr_o = 0, cr_f = 0, cm_o = 0, cm_f = 0; - for (uint64_t i = 0; i < RUNS; i++) { - uint64_t id = 10 + i, a = a_value(id); + uint32_t kept = 0, tried = 0; + int delay_known = 1; + for (uint64_t i = 0; i < ATTEMPTS && kept < RUNS; i++) { + uint64_t id = 10 + i, a = a_value(id), t_o = 0, t_f = 0; set_inputs(&p->o, a, id); set_inputs(&p->f, a, id); uint64_t c0 = p->o.w.n_crumbs, t0 = cpu_ns(); - run(&p->o, &p->lo, id, &ro, &ns_o[i]); - cpu_o += cpu_ns() - t0; - cr_o += p->o.w.n_crumbs - c0; - cm_o += commits_between(&p->o, c0, p->o.w.n_crumbs); + int64_t d0 = rx_run_delay_ns(); + run(&p->o, &p->lo, id, &ro, &t_o); + int64_t d1 = rx_run_delay_ns(); + uint64_t u_o = cpu_ns() - t0, k_o = p->o.w.n_crumbs - c0; + uint64_t m_o = commits_between(&p->o, c0, p->o.w.n_crumbs); c0 = p->f.w.n_crumbs; t0 = cpu_ns(); - run(&p->f, &p->lf, id, &rf, &ns_f[i]); - cpu_f += cpu_ns() - t0; - cr_f += p->f.w.n_crumbs - c0; - cm_f += commits_between(&p->f, c0, p->f.w.n_crumbs); + int64_t d2 = rx_run_delay_ns(); + run(&p->f, &p->lf, id, &rf, &t_f); + int64_t d3 = rx_run_delay_ns(); + uint64_t u_f = cpu_ns() - t0, k_f = p->f.w.n_crumbs - c0; + uint64_t m_f = commits_between(&p->f, c0, p->f.w.n_crumbs); + tried++; + CHECK(ro.outcome == rf.outcome, "%s: attempt %u: outcomes differ", what, tried); + if (d0 < 0 || d1 < 0 || d2 < 0 || d3 < 0) delay_known = 0; + if (!rx_quiet_rep(delay_known ? d1 - d0 : -1, t_o) || + !rx_quiet_rep(delay_known ? d3 - d2 : -1, t_f)) + continue; + ns_o[kept] = t_o; + ns_f[kept] = t_f; + kept++; + cpu_o += u_o; + cr_o += k_o; + cm_o += m_o; + cpu_f += u_f; + cr_f += k_f; + cm_f += m_f; ms->ok_before += ro.outcome == AG_RUN_SUCCESS; ms->failed_before += ro.outcome == AG_RUN_FAILURE; ms->ok_after += rf.outcome == AG_RUN_SUCCESS; ms->failed_after += rf.outcome == AG_RUN_FAILURE; } + printf(" %s: undisturbed pairs %u of %u (%s)\n", what, kept, tried, + delay_known ? "run-queue delay from schedstat" : "schedstat missing: every pair counts"); + if (kept < RUNS) { + fprintf(stderr, " %s: machine too busy to time: %u of %u undisturbed pairs in %u attempts\n", + what, kept, RUNS, (unsigned)ATTEMPTS); + rx_busy_refuse(what); + pair_stop(p); + return 0; + } qsort(ns_o, RUNS, sizeof ns_o[0], cmp_u64); qsort(ns_f, RUNS, sizeof ns_f[0], cmp_u64); ms->runs = RUNS; @@ -1105,28 +1142,36 @@ static void measure(AgMetaSkill *m, uint32_t goal, AgFusionMeasure *ms, int with "(+/- %.1f) uJ, performance cores %.1f -> %.1f (+/- %.1f) uJ", ms->energy_uj_before, ms->energy_uj_after, ms->energy_noise_uj, cpu_mean(0), cpu_mean(1), cpu_noise()); printf("\n"); + return 1; } static void t_measure(void) { printf("[*] measurement: original and fused side by side\n"); if (MC.state != AG_MS_VERIFIED) return; unpublished_refused(&MC, "verified"); - measure(&MC, GOAL_EFFECT, &R.m_compiled, 1, "compiled"); - CHECK(rx_fusion_accept_measure(&MC, &R.m_compiled, 50) == 0 && MC.state == AG_MS_MEASURED, - "compiled accepted: fewer reactions, not slower, same outcomes"); + /* A refused measurement (machine too busy to time) leaves its MetaSkill + * verified and unmeasured: the acceptance below, and for the compiled one + * the canary, promotion and use that follow it, are not judged. */ + g_untimed_compiled = !measure(&MC, GOAL_EFFECT, &R.m_compiled, 1, "compiled"); + if (!g_untimed_compiled) + CHECK(rx_fusion_accept_measure(&MC, &R.m_compiled, 50) == 0 && MC.state == AG_MS_MEASURED, + "compiled accepted: fewer reactions, not slower, same outcomes"); R.m_compiled = MC.measure; - measure(&MH, GOAL_EFFECT, &R.m_hybrid, 0, "hybrid"); - rx_fusion_accept_measure(&MH, &R.m_hybrid, 50); + if (measure(&MH, GOAL_EFFECT, &R.m_hybrid, 0, "hybrid")) { + rx_fusion_accept_measure(&MH, &R.m_hybrid, 50); + CHECK(MH.state == AG_MS_MEASURED, "hybrid accepted"); + } R.m_hybrid = MH.measure; R.hybrid_state = MH.state; - CHECK(MH.state == AG_MS_MEASURED, "hybrid accepted"); - measure(&MP, GOAL_PARALLEL, &R.m_parallel, 0, "parallel"); - CHECK(rx_fusion_accept_measure(&MP, &R.m_parallel, 50) != 0 && MP.state == AG_MS_SLOWER, - "parallel fragment refused: fusing it serializes independent work (%.0f -> %.0f us)", - R.m_parallel.median_ns_before / 1e3, R.m_parallel.median_ns_after / 1e3); + g_untimed_parallel = !measure(&MP, GOAL_PARALLEL, &R.m_parallel, 0, "parallel"); + if (!g_untimed_parallel) { + CHECK(rx_fusion_accept_measure(&MP, &R.m_parallel, 50) != 0 && MP.state == AG_MS_SLOWER, + "parallel fragment refused: fusing it serializes independent work (%.0f -> %.0f us)", + R.m_parallel.median_ns_before / 1e3, R.m_parallel.median_ns_after / 1e3); + CHECK(rx_fusion_canary(&MP, 0, 1) == AG_FUSION_E_STATE, "a slower MetaSkill cannot enter canary"); + } R.parallel_state = MP.state; R.m_parallel = MP.measure; - CHECK(rx_fusion_canary(&MP, 0, 1) == AG_FUSION_E_STATE, "a slower MetaSkill cannot enter canary"); unpublished_refused(&MC, "measured"); } @@ -1170,7 +1215,11 @@ static void t_canary(void) { R.poisoned_verified = MQ.state == AG_MS_VERIFIED; CHECK(MQ.state == AG_MS_VERIFIED, "poisoned hybrid passes verification (the entry is never generated)"); AgFusionMeasure mq; - measure(&MQ, GOAL_EFFECT, &mq, 0, "poisoned hybrid"); + g_untimed_poisoned = !measure(&MQ, GOAL_EFFECT, &mq, 0, "poisoned hybrid"); + if (g_untimed_poisoned) { /* unmeasured: its canary and quarantine are not judged */ + unpublished_refused(&MC, "canary-passed"); + return; + } rx_fusion_accept_measure(&MQ, &mq, 50); CHECK(pair_start(p, GOAL_EFFECT, &MQ, 4) == 0, "pair"); /* The divergence here is the point; it is kept out of the fusion totals. */ @@ -1210,6 +1259,10 @@ static char g_store_dir[64]; static void t_promote(void) { printf("[*] promotion through the generation barrier, then publication\n"); + if (g_untimed_compiled) { /* never measured, so never canary-passed */ + printf(" not judged: the compiled MetaSkill was not measured (cpu_busy)\n"); + return; + } static Env e; CHECK(env_start(&e, 1) == 0, "env"); strcpy(g_store_dir, "/tmp/rx-fusion-XXXXXX"); @@ -1226,9 +1279,11 @@ static void t_promote(void) { uint64_t active0 = 0, lineage0 = 0; CHECK(rx_gen_active(store, &active0, &lineage0) == RX_GEN_OK, "store has an active generation"); - CHECK(rx_fusion_promote(&MQ, store, SUBJ_PROPOSER, &req, native_auth, &ac) == AG_FUSION_E_STATE, - "quarantined MetaSkill cannot be promoted"); - R.poisoned_promote_refused = 1; + if (!g_untimed_poisoned) { + CHECK(rx_fusion_promote(&MQ, store, SUBJ_PROPOSER, &req, native_auth, &ac) == AG_FUSION_E_STATE, + "quarantined MetaSkill cannot be promoted"); + R.poisoned_promote_refused = 1; + } int rc = rx_fusion_promote(&MC, store, SUBJ_PROPOSER, &req, native_auth, &ac); R.promote_refused_no_right = rc == RX_GEN_ERR_AUTHORITY && MC.state == AG_MS_CANARY_PASSED; CHECK(R.promote_refused_no_right, "promotion without the promote right refused (%d)", rc); @@ -1441,13 +1496,20 @@ static void t_revoked(void) { /* ---- placement and receipt ---- */ +/* The Cortex-X925 cores of the affinity mask the test started with: a taskset + * or cpuset run is timed only on the cores it was given (as #1002 did for the + * empirical optimizer). With no X925 core in the mask it stays unpinned. */ static void place(void) { - cpu_set_t set; + cpu_set_t set, allowed; CPU_ZERO(&set); + CPU_ZERO(&allowed); + if (sched_getaffinity(0, sizeof allowed, &allowed) != 0) + for (int c = 0; c < CPU_SETSIZE; c++) CPU_SET(c, &allowed); int count = 0; char *p = R.cpus; long n = sysconf(_SC_NPROCESSORS_CONF); - for (long c = 0; c < n; c++) { + for (long c = 0; c < n && c < CPU_SETSIZE; c++) { + if (!CPU_ISSET((int)c, &allowed)) continue; /* taskset/cgroup: not ours to time on */ char path[128]; snprintf(path, sizeof path, "/sys/devices/system/cpu/cpu%ld/regs/identification/midr_el1", c); FILE *fp = fopen(path, "r"); @@ -1520,6 +1582,18 @@ static void measure_json(FILE *fp, const char *name, const AgFusionMeasure *m, i fprintf(fp, "}%s\n", last ? "" : ","); } +/* Everything judged held. A refused measurement takes out only the states + * that need it: the compiled chain (canary, promotion, publication, and the + * poisoned hybrid's canary, which runs after it), the parallel refusal, the + * poisoned quarantine. */ +static int judged_pass(void) { + return g_fail == 0 && R.bypass == 0 && R.evidence_missing == 0 && R.ancestry_mismatch == 0 && + R.eq_mismatch == 0 && R.cross_mismatch == 0 && R.steps_mismatch == 0 && R.det_mismatch == 0 && + R.tamper_caught == R.tamper_cases && (g_untimed_compiled || MC.state == AG_MS_PUBLISHED) && + (g_untimed_parallel || R.parallel_state == AG_MS_SLOWER) && + (g_untimed_compiled || g_untimed_poisoned || R.poisoned_state == AG_MS_QUARANTINED); +} + static void write_receipt(void) { char path[512]; if (omega_evidence_path("WORKFLOW_FUSION/rx_workflow_fusion_receipt.json", path, sizeof path) != 0) return; @@ -1536,10 +1610,6 @@ static void write_receipt(void) { struct utsname u; memset(&u, 0, sizeof u); uname(&u); - int pass = g_fail == 0 && R.bypass == 0 && R.evidence_missing == 0 && R.ancestry_mismatch == 0 && - R.eq_mismatch == 0 && R.cross_mismatch == 0 && R.steps_mismatch == 0 && R.det_mismatch == 0 && - R.tamper_caught == R.tamper_cases && MC.state == AG_MS_PUBLISHED && - R.parallel_state == AG_MS_SLOWER && R.poisoned_state == AG_MS_QUARANTINED; static const char *kinds[4] = { "compiled", "hybrid", "learned", "hardware" }; fprintf(fp, "{\n" @@ -1624,7 +1694,7 @@ static void write_receipt(void) { R.fused_nodes_before, R.fused_nodes_after, R.eq_runs, R.eq_nodes, R.eq_mismatch, R.cross_runs, R.cross_mismatch, R.steps_checked, R.steps_mismatch, R.evidence_checked, R.evidence_missing, R.ancestry_nodes, R.ancestry_mismatch, R.det_mismatch, R.bypass, R.n3_blocked_original, - R.n3_blocked_fused, R.n3_meta_auth_exact, pass ? "PASS" : "FAIL"); + R.n3_blocked_fused, R.n3_meta_auth_exact, rx_busy_verdict(judged_pass())); fclose(fp); printf("receipt: %s\n", path); } @@ -1647,5 +1717,5 @@ int main(void) { R.steps_mismatch, R.ancestry_nodes, R.ancestry_mismatch, R.bypass); printf("checks %d failures %d\n", g_checks, g_fail); write_receipt(); - return g_fail ? 1 : 0; + return rx_busy_exit(g_fail, judged_pass()); } ```