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/aien-sovereign-core-mv/patches/8d2f693f7eaf0474 # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aien-sovereign-core-mv#726 (code only) closed derived `8d2f693f7eaf0474` #726 Imported from GitHub aien-dev/aien-sovereign-core-mv#726 (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 `d38411c38f94b02d9e87beea440d01b42cfc5bd8` · Head `6a299a0241dee998b2ce4828f295033dfb0ca3b0` drakestapleton reviewed (COMMENTED) on 2026-10-30 11:43 UTC Triage: needs changes (draft, conflicting, verification red) - This PR is still a draft, and it conflicts with `main`, so it needs a rebase. - `AIEN Verification` fails on head `6e176de`. CodeQL and Analyze pass. - It depends on Omega #676 (compiler pin `1dffceae…`), which hasn't merged, and it still needs configuration approval. - Its scope is host-only. Full state capture and restore, and serving integration, stay with Core #713 and the storage and runtime owners. Hardware evidence: none committed or claimed ("No signed Spark qualification or waiver is claimed"). No Spark time is needed at this stage. Triage only; no approval or merge implied. — Grokbot drakestapleton reviewed (COMMENTED) on 2026-10-30 11:44 UTC Triage correction: this PR is not blocked on Omega #676. aien-dev/omega-mv#676 merged on Oct 24 (`ea4f5559`), and pin `1dffceae` is already an ancestor of omega-mv `main`. The remaining blockers are the conflicts with `main` (needs a rebase), the red `AIEN Verification` check, and the configuration approval. Triage only; no approval or merge implied. — Grokbot ### Fetch it A git bundle of the pull request's head, 49645 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/8d2f693f7eaf0474.bundle -o 8d2f693f7eaf0474.bundle git fetch 8d2f693f7eaf0474.bundle refs/pull/726/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/aien-sovereign-core-mv 726 6a299a0241dee998b2ce4828f295033dfb0ca3b0 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":726,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/726","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:51Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/evidence/state-reuse-718/compiler-correction/README.md b/evidence/state-reuse-718/compiler-correction/README.md new file mode 100644 index 00000000..184cded2 --- /dev/null +++ b/evidence/state-reuse-718/compiler-correction/README.md @@ -0,0 +1,25 @@ +# Corrected compiler compatibility + +The exact proposed compiler from Omega PR676 head +`1dffceaeb0dd26fb69ea64d367a49a9950c25a62` was consumed from its committed +`seed/out/omc` blob, not from the owner's changing working directory. Its SHA256 +is `9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4`. +Functional source is `078455c9c1862b9145ef892dfba68676204a38da`. The owner's +combined seed reconstruction and branch-safety qualification are recorded in +that PR's `evidence/NATIVE-MAPPING/branch-correction/`; this consumer check +does not claim to repeat the entire compiler bootstrap or independent review. + +All listed programs were freshly compiled from the ordered source units in +receipt.json, using the exact compiler above through quiet-build timeout30. +Each produced executable is byte-identical to the previously tested binary. +The listed test replays were executed again in fresh private directories, +with a30-second timeout (10seconds for the classifier). Expected INVALID65 +is a rejection test, not a process failure counted as a caught control. + +Reconstruct by concatenating each build's source_files in listed order, feed +the result to the pinned compiler on stdin, and require exit0 before executing +its stdout artifact. Compare its SHA256 to both recorded binary digests. +Original qualification/reproduction remains in the parent evidence folders. +No historical receipt was rewritten. Production source and executable digests +are unchanged. GPU, full-model execution, hardware timings and repository +merge gates were not rerun or waived. The compiler remains proposed work. diff --git a/evidence/state-reuse-718/compiler-correction/receipt.json b/evidence/state-reuse-718/compiler-correction/receipt.json new file mode 100644 index 00000000..2a577625 --- /dev/null +++ b/evidence/state-reuse-718/compiler-correction/receipt.json @@ -0,0 +1,120 @@ +{ + "compiler_pr": 676, + "compiler_head": "1dffceaeb0dd26fb69ea64d367a49a9950c25a62", + "compiler_source": "078455c9c1862b9145ef892dfba68676204a38da", + "compiler_sha256": "9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4", + "builds": [ + { + "name": "pages-author", + "repository": "sc-native-reuse-718", + "source_files": [ + { + "path": "native/state_reuse/pages.om", + "sha256": "8b3ca7bffda63099afb930d1f1a59f6604c96652f93d1760c25bbe4483186a43" + }, + { + "path": "native/state_reuse/pages-test.om", + "sha256": "de92e9b8c59b17d240a084502ebcc1c66c07680436c1a0bbc3256af82d56ee24" + } + ], + "source_sha256": "68aec071225e8a661eb90e49f6219f5e75da258c89e16f10ae49bfeb40269dd4", + "compile_exit": 0, + "binary_sha256": "481c8dc16b99cd94da6e20fe721c4eda72860a933fa47d1242bbeeaeb4394eca", + "previous_binary_sha256": "481c8dc16b99cd94da6e20fe721c4eda72860a933fa47d1242bbeeaeb4394eca", + "identical": true + }, + { + "name": "pages-independent", + "repository": "sc-native-reuse-718", + "source_files": [ + { + "path": "native/state_reuse/pages.om", + "sha256": "8b3ca7bffda63099afb930d1f1a59f6604c96652f93d1760c25bbe4483186a43" + }, + { + "path": "native/state_reuse/pages-independent.om", + "sha256": "7e7b9780a951f8a289f575c4a7fffb7043a8eb1260bc365ee3835e648cbeab89" + } + ], + "source_sha256": "dabbf665a260a70940a1c1ca5c5ea6ab8226e1383d42f084c897ce590bd12dfa", + "compile_exit": 0, + "binary_sha256": "4f1c34da171a9bffcf93fdf168df9fedebc742eee6d1c1ba592dc6df9e956f7d", + "previous_binary_sha256": "4f1c34da171a9bffcf93fdf168df9fedebc742eee6d1c1ba592dc6df9e956f7d", + "identical": true + }, + { + "name": "pages-policy", + "repository": "sc-native-reuse-718", + "source_files": [ + { + "path": "native/state_reuse/policy.om", + "sha256": "1fd8ca82867f8c1327129ec615aff09b47391552d52b80327c337ddd0f9d09d1" + }, + { + "path": "native/state_reuse/pages.om", + "sha256": "8b3ca7bffda63099afb930d1f1a59f6604c96652f93d1760c25bbe4483186a43" + }, + { + "path": "native/state_reuse/page-policy.om", + "sha256": "943b23727c4805ee956d1a9b32d0e0005c57afe85aa80d2b7dfacd3816030b9b" + }, + { + "path": "native/state_reuse/page-policy-test.om", + "sha256": "18f5558ca7c8c75c02f548971ee98d8522600de203a5632e791ae623e5c3beed" + } + ], + "source_sha256": "88d5e676035c538bf31c01e08372b5a389a66a852f1445a9e5729bb66f6d505d", + "compile_exit": 0, + "binary_sha256": "6905a0134ae46694eb0d3e48cf3f9d269483bc9e7516ff45d58a73fcf01526f9", + "previous_binary_sha256": "6905a0134ae46694eb0d3e48cf3f9d269483bc9e7516ff45d58a73fcf01526f9", + "identical": true + }, + { + "name": "pages-budget", + "repository": "sc-native-reuse-718", + "source_files": [ + { + "path": "native/state_reuse/pages.om", + "sha256": "8b3ca7bffda63099afb930d1f1a59f6604c96652f93d1760c25bbe4483186a43" + }, + { + "path": "native/state_reuse/pages-budget-test.om", + "sha256": "569d3d826e2d77968dafc7c56d076d090ceb54509cfdd6dc425e447df39c91e7" + } + ], + "source_sha256": "c14387c642dc822b35a18ffafff1870fc3720600fc231331e2a5b223cbf7c670", + "compile_exit": 0, + "binary_sha256": "e5478365805c2e7dbc843c279d5988cac4d2a3753b9fce52f683368d9d0a422b", + "previous_binary_sha256": "e5478365805c2e7dbc843c279d5988cac4d2a3753b9fce52f683368d9d0a422b", + "identical": true + } + ], + "replays": [ + { + "name": "pages-author", + "status": 0, + "signal": null, + "stdout": "37905\n0" + }, + { + "name": "pages-independent", + "status": 0, + "signal": null, + "stdout": "2437621\n0" + }, + { + "name": "pages-policy", + "status": 0, + "signal": null, + "stdout": "40\n0" + }, + { + "name": "pages-budget", + "status": 0, + "signal": null, + "stdout": "" + } + ], + "gpu": false, + "full_model": false +} diff --git a/evidence/state-reuse-718/independent-margin.stdout b/evidence/state-reuse-718/independent-margin.stdout new file mode 100644 index 00000000..29f8a1c5 --- /dev/null +++ b/evidence/state-reuse-718/independent-margin.stdout @@ -0,0 +1,2 @@ +24588 +1704 diff --git a/evidence/state-reuse-718/independent-memory.stdout b/evidence/state-reuse-718/independent-memory.stdout new file mode 100644 index 00000000..dd604853 --- /dev/null +++ b/evidence/state-reuse-718/independent-memory.stdout @@ -0,0 +1,2 @@ +24588 +2 diff --git a/evidence/state-reuse-718/independent.stdout b/evidence/state-reuse-718/independent.stdout new file mode 100644 index 00000000..f96047e1 --- /dev/null +++ b/evidence/state-reuse-718/independent.stdout @@ -0,0 +1,2 @@ +24588 +0 diff --git a/evidence/state-reuse-718/mutations.json b/evidence/state-reuse-718/mutations.json new file mode 100644 index 00000000..eca3fb90 --- /dev/null +++ b/evidence/state-reuse-718/mutations.json @@ -0,0 +1,34 @@ +[ + { + "name": "identity", + "from": "if ne v get rident add mul row 32 i", + "to": "if ne v v", + "compile": 0, + "exit": 1, + "stdout": "16210\n64\n" + }, + { + "name": "memory", + "from": "total = add total v", + "to": "total = total", + "compile": 0, + "exit": 1, + "stdout": "16210\n11\n" + }, + { + "name": "disk-read", + "from": "v = add v rfield row add p 8", + "to": "if ne p 1\nv = add v rfield row add p 8\nend", + "compile": 0, + "exit": 1, + "stdout": "16210\n3\n" + }, + { + "name": "state", + "from": "if ne rfield row 5 31", + "to": "if ne row row", + "compile": 0, + "exit": 1, + "stdout": "16210\n2\n" + } +] \ No newline at end of file diff --git a/evidence/state-reuse-718/native-gate/README.md b/evidence/state-reuse-718/native-gate/README.md new file mode 100644 index 00000000..566fbcfc --- /dev/null +++ b/evidence/state-reuse-718/native-gate/README.md @@ -0,0 +1,24 @@ +# Automatic native state-reuse qualification + +The existing dispatcher tests/gates/run.sh native-state-reuse passes all7 +native suites using the explicit, digest-verified unmerged Omega PR676 +compiler pin. The original legacy omega.lock is unchanged. See author.json +and entry.log for the dispatcher/control runs. The independent report records +fresh reproduction and rejection of corrupted output and invalid source. + +The gate checks exact five count/failure outputs and two empty-output cases. +A reused scratch directory returns91. Wrong exits, signals, the actual +30-second deadline, mismatched output and failed input/compilation refuse99. +This is host-component qualification, not complete-state restore, GPU execution, +model speed, signed Spark qualification or evidence of merged dependencies. + +The actual existing aien-test runner passed SC-NATIVE-STATE-REUSE at +5e03586a8c4953e702c0b18be4a6c98f16d0b848: exit0, observation reuse_groups7, +no cache reuse, clean tree before and after. runner.json is the exact receipt. +The retained runner is Rust infrastructure; no new C/Rust/Python test or runtime +implementation was added. The unmerged compiler is explicitly pinned offline. + +The actual planner reports no unmapped paths and returns +BLOCKED_OPERATOR PIPELINE_CONFIG_CHANGED. Configuration review, prerequisite +integration and all other selected checks remain required. No waiver or +allow-list exemption was added. Raw plan retained in plan.txt. diff --git a/evidence/state-reuse-718/native-gate/author.json b/evidence/state-reuse-718/native-gate/author.json new file mode 100644 index 00000000..3386a98d --- /dev/null +++ b/evidence/state-reuse-718/native-gate/author.json @@ -0,0 +1,77 @@ +{ + "scope": "Native state reuse existing-runner gate, host only", + "gate": "SC-NATIVE-STATE-REUSE", + "compilerSource": "1dffceaeb0dd26fb69ea64d367a49a9950c25a62", + "compilerSha256": "9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4", + "compilerDependency": "Unmerged Omega PR676, separate from omega.lock", + "normal": { + "command": "CARGO_TARGET_DIR=/home/drakestapleton/workspace/targets/L793-reuse-gate quiet-build timeout --kill-after=10 300 tests/gates/run.sh native-state-reuse", + "exit": 0, + "groups": 7, + "log": "/home/drakestapleton/workspace/targets/L793-reuse-gate/gate.log" + }, + "controls": [ + { + "path": "/home/drakestapleton/workspace/targets/L793-reuse-gate/control-0.bt8Y4m", + "exit": 99, + "log": "/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < native/state_reuse/gate-child.om > build/reuse-native-gate/1002 2> build/reuse-native-gate/501002\nexit=0 expected=0\nbuild/reuse-native-gate/1002 < build/reuse-native-gate/1001 > build/reuse-native-gate/1003 2> build/reuse-native-gate/501003\nexit=7 expected=0\nSTATE_REUSE_NATIVE_GATE: FAIL; retain all scratch files and command output\n" + }, + { + "path": "/home/drakestapleton/workspace/targets/L793-reuse-gate/control-1.WsTvZD", + "exit": 99, + "log": "/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < native/state_reuse/gate-child.om > build/reuse-native-gate/1002 2> build/reuse-native-gate/501002\nexit=0 expected=0\nbuild/reuse-native-gate/1002 < build/reuse-native-gate/1001 > build/reuse-native-gate/1003 2> build/reuse-native-gate/501003\nINVALID child wait low-byte=9\nSTATE_REUSE_NATIVE_GATE: FAIL; retain all scratch files and command output\n" + }, + { + "path": "/home/drakestapleton/workspace/targets/L793-reuse-gate/control-2.p88QB6", + "exit": 99, + "log": "/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < native/state_reuse/gate-child.om > build/reuse-native-gate/1002 2> build/reuse-native-gate/501002\nexit=0 expected=0\nbuild/reuse-native-gate/1002 < build/reuse-native-gate/1001 > build/reuse-native-gate/1003 2> build/reuse-native-gate/501003\nINVALID child deadline exceeded; sent SIGKILL; wait low-byte=9\nSTATE_REUSE_NATIVE_GATE: FAIL; retain all scratch files and command output\n" + }, + { + "path": "/home/drakestapleton/workspace/targets/L793-reuse-gate/control-missing.rzIDQa", + "exit": 99, + "log": "STATE_REUSE_NATIVE_GATE: FAIL; retain all scratch files and command output\n" + }, + { + "path": "/home/drakestapleton/workspace/targets/L793-reuse-gate/control-output.jZ7vfJ", + "exit": 99, + "log": "/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1001 > build/reuse-native-gate/1002 2> build/reuse-native-gate/501002\nexit=0 expected=0\nbuild/reuse-native-gate/1002 < /dev/null > build/reuse-native-gate/1003 2> build/reuse-native-gate/501003\nexit=0 expected=0\nSTATE_REUSE_NATIVE_GATE: FAIL; retain all scratch files and command output\n" + } + ], + "staleScratchExit": 91, + "sources": [ + { + "path": "native/state_reuse/gate.om", + "sha256": "273380746bbcb14a142b0927b3327b6c7434a0c4a43d22c254764ef2db04f97c" + }, + { + "path": "native/state_reuse/gate-child.om", + "sha256": "459a60da8e660ee1f433a9679bb41467074fda45997e5168e23e92ebad0d570b" + }, + { + "path": "native/state_reuse/compiler.lock", + "sha256": "3b70520aa9d047e2d8b3074e1101ccf8fde5a93bb06232e6c0edba89c99c29ef" + }, + { + "path": "native/state_reuse/compiler.sha256", + "sha256": "db5f815ceba1a3c9514900c89491510a02934a73236b75cc07fd24ceedf76200" + }, + { + "path": "native/state_reuse/README.md", + "sha256": "3c97536b5ce82b48a6121fa2c5e68ab580ca35a9bac9906e171cd125514497c0" + }, + { + "path": "tests/gates/sc-native-state-reuse.gate", + "sha256": "38e66fec00490926f0d0de09d60586dff3ef3345865013d41ec9e749c7071f27" + }, + { + "path": "tests/gates/run.sh", + "sha256": "8e739982bfba8df4ecd8a530d268c1353234841495b69dd477f42c37681222cb" + } + ], + "limitations": [ + "No GPU/model execution", + "No issue completion or hardware speed claim", + "No commit, push or PR operation", + "Actual manifest parser/runner inspection remains parent-owned" + ] +} diff --git a/evidence/state-reuse-718/native-gate/entry.log b/evidence/state-reuse-718/native-gate/entry.log new file mode 100644 index 00000000..dc5e6c64 --- /dev/null +++ b/evidence/state-reuse-718/native-gate/entry.log @@ -0,0 +1,33 @@ +AIEN-OBS pin_omega_reuse_native "1dffceaeb0dd26fb69ea64d367a49a9950c25a62" +seed/out/omc: OK +seed/omc/omc.om: OK +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1001 > build/reuse-native-gate/1002 2> build/reuse-native-gate/501002 +exit=0 expected=0 +build/reuse-native-gate/1002 < /dev/null > build/reuse-native-gate/1003 2> build/reuse-native-gate/501003 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1004 > build/reuse-native-gate/1005 2> build/reuse-native-gate/501005 +exit=0 expected=0 +build/reuse-native-gate/1005 < /dev/null > build/reuse-native-gate/1006 2> build/reuse-native-gate/501006 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1007 > build/reuse-native-gate/1008 2> build/reuse-native-gate/501008 +exit=0 expected=0 +build/reuse-native-gate/1008 < /dev/null > build/reuse-native-gate/1009 2> build/reuse-native-gate/501009 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1010 > build/reuse-native-gate/1011 2> build/reuse-native-gate/501011 +exit=0 expected=0 +build/reuse-native-gate/1011 < /dev/null > build/reuse-native-gate/1012 2> build/reuse-native-gate/501012 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1013 > build/reuse-native-gate/1014 2> build/reuse-native-gate/501014 +exit=0 expected=0 +build/reuse-native-gate/1014 < /dev/null > build/reuse-native-gate/1015 2> build/reuse-native-gate/501015 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1016 > build/reuse-native-gate/1017 2> build/reuse-native-gate/501017 +exit=0 expected=0 +build/reuse-native-gate/1017 < /dev/null > build/reuse-native-gate/1018 2> build/reuse-native-gate/501018 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-reuse-gate/aien-pins/omega-reuse-native/seed/out/omc < build/reuse-native-gate/1019 > build/reuse-native-gate/1020 2> build/reuse-native-gate/501020 +exit=0 expected=0 +build/reuse-native-gate/1020 < /dev/null > build/reuse-native-gate/1021 2> build/reuse-native-gate/501021 +exit=0 expected=0 +AIEN-OBS reuse_groups 7 +STATE_REUSE_NATIVE_GATE: PASS diff --git a/evidence/state-reuse-718/native-gate/plan.txt b/evidence/state-reuse-718/native-gate/plan.txt new file mode 100644 index 00000000..2e837dcc --- /dev/null +++ b/evidence/state-reuse-718/native-gate/plan.txt @@ -0,0 +1,91 @@ +AIEN PLAN +Repository: aien-sovereign-core +Base: 27b0d670dc996fc7bd4b4570da37bd231816eb28 +Head: 5e03586a8c4953e702c0b18be4a6c98f16d0b848 +Changed files: 44 + evidence/state-reuse-718/compiler-correction/README.md + evidence/state-reuse-718/compiler-correction/receipt.json + evidence/state-reuse-718/independent-margin.stdout + evidence/state-reuse-718/independent-memory.stdout + evidence/state-reuse-718/independent.stdout + evidence/state-reuse-718/mutations.json + evidence/state-reuse-718/native-gate/README.md + evidence/state-reuse-718/native-gate/author.json + evidence/state-reuse-718/native-gate/entry.log + evidence/state-reuse-718/native-gate/review.txt + evidence/state-reuse-718/pages/SHA256SUMS + evidence/state-reuse-718/pages/adapter-control.json + evidence/state-reuse-718/pages/author.stdout + evidence/state-reuse-718/pages/copy-control.stdout + evidence/state-reuse-718/pages/independent.stdout + evidence/state-reuse-718/pages/initial-finding.txt + evidence/state-reuse-718/pages/integration.stdout + evidence/state-reuse-718/pages/layout-readelf.txt + evidence/state-reuse-718/pages/original-policy.stdout + evidence/state-reuse-718/pages/quota-control.json + evidence/state-reuse-718/pages/receipt.json + evidence/state-reuse-718/pages/reproduce.txt + evidence/state-reuse-718/pages/review.txt + evidence/state-reuse-718/preflight-summary.txt + evidence/state-reuse-718/receipt.json + evidence/state-reuse-718/review.txt + evidence/state-reuse-718/tests.stdout + native/state_reuse/README.md + native/state_reuse/compiler.lock + native/state_reuse/compiler.sha256 + native/state_reuse/gate-child.om + native/state_reuse/gate.om + native/state_reuse/independent.om + native/state_reuse/page-policy-test.om + native/state_reuse/page-policy.om + native/state_reuse/pages-budget-test.om + native/state_reuse/pages-independent.om + native/state_reuse/pages-quota.om + native/state_reuse/pages-test.om + native/state_reuse/pages.om + native/state_reuse/policy.om + native/state_reuse/tests.om + tests/gates/run.sh + tests/gates/sc-native-state-reuse.gate +Pins: native/state_reuse/compiler.lock +Graph digest: ec17c15f40cca9c7e5faa2f10a5d780530a317a93b3e4a99ed1052eeda427fb1 +Required: + (none) +Cached: + (none) +Needs Spark: + (none) +Needs GB10: + (none) +Advisory: + (none) +Blocked: + CRUMB-VERIFY pool=host exactness=EXACT check=b9a7640de96b because=always PIPELINE_CONFIG_CHANGED + SC-AGENT-PREFLIGHT pool=host exactness=EXACT check=7776becdc52b because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-AIEN-VERIFY-TESTS pool=host exactness=EXACT check=a4de078f971b because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-ANTI-SLOP pool=host exactness=EXACT check=a38c222da0d0 because=always PIPELINE_CONFIG_CHANGED + SC-CHECK pool=host exactness=EXACT check=851258a82f84 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-CLIPPY pool=host exactness=EXACT check=786a468afd6c because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-CRB1 pool=host exactness=EXACT check=475f77218cc0 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-FMT pool=host exactness=EXACT check=5fd57cf7d030 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-INQUISITOR pool=host exactness=EXACT check=dcfc9b2e9d9b because=always PIPELINE_CONFIG_CHANGED + SC-INSTALL pool=host exactness=EXACT check=ba53d006805c because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-KV-PROPS pool=host exactness=EXACT check=54037e350bbe because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-LINKED-COMPOSE pool=host exactness=EXACT check=7b2f163a8650 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-MIRI pool=host exactness=EXACT check=39ff19635858 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-NATIVE-IDENTITY pool=host exactness=EXACT check=75432a3f508c because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-NATIVE-STATE-REUSE pool=host exactness=EXACT check=00843192dafa because=evidence/state-reuse-718/compiler-correction/README.md PIPELINE_CONFIG_CHANGED + SC-PINS-SELFTEST pool=host exactness=EXACT check=6778c222c2dc because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-PREFLIGHT-GUARD pool=host exactness=EXACT check=4de3ca9d1ca5 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-RELEASE-DRY-RUN pool=host exactness=EXACT check=2fa40ccc7944 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-RELEASE-GATE-NEGATIVES pool=host exactness=EXACT check=fa125b63c8a2 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-SCORING-V5 pool=host exactness=EXACT check=a67b3a89a950 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-STRICT-MODE pool=host exactness=EXACT check=ce43bd0526cc because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-TEST pool=host exactness=EXACT check=0629412801c6 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-TRN1 pool=host exactness=EXACT check=14d6aa5c61e2 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-VERIFY-CLOSURE pool=host exactness=EXACT check=898364e794f2 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-ZERO-CUDA pool=host exactness=EXACT check=c2318b07829d because=always PIPELINE_CONFIG_CHANGED + SC-ZERO-DISK-SECRETS pool=host exactness=EXACT check=545077eddead because=always PIPELINE_CONFIG_CHANGED +UNMAPPED: + (none) +Plan verdict: BLOCKED_OPERATOR PIPELINE_CONFIG_CHANGED diff --git a/evidence/state-reuse-718/native-gate/review.txt b/evidence/state-reuse-718/native-gate/review.txt new file mode 100644 index 00000000..53859015 --- /dev/null +++ b/evidence/state-reuse-718/native-gate/review.txt @@ -0,0 +1,55 @@ +Independent reuse gate verification, 2026-10-23 +PASS:7 groups reproduced; both private negative controls refuse99 without PASS. +No owner-tree edits, commits or publication. + +Gate source SHA256: +273380746bbcb14a142b0927b3327b6c7434a0c4a43d22c254764ef2db04f97c +Independently built gate binary SHA256: +3c86cd5476106c5b4970184f96a6ff15682c34fdf1d38f736d9e1861f2bacf9e +Compiler /tmp/L793-corrected-compiler/omc SHA256: +9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4 +Live gate source rechecked, unchanged and matching frozen copy. + +Mapped suites, inspected source output and observed bytes +policy.om + tests.om:16210 newline0 newline, output1003. +policy.om + independent.om:24588 newline0 newline, output1006. +pages.om + pages-test.om:37905 newline0 newline, output1009. +pages.om + pages-independent.om:2437621 newline0 newline, output1012. +policy.om + pages.om + page-policy.om + page-policy-test.om: +40 newline0 newline, output1015. +pages.om + pages-budget-test.om:empty output1018, exit0. +pages.om + pages-quota.om:empty output1021, exit0. +All names/indices in gate match these source paths. All five counted suites +report their actual assertion count and zero failure count. Both empty +suites communicate failure by nonzero return and have no success print. +The gate requires child exit0 and exact bytes for each; empty expectation +performs a read and requires EOF. Final observation reuse_groups7 and PASS, +gate exit0. Artifact paths are root/build/reuse-native-gate/NUMBER. + +Negative controls +badstdout private tests.om changes only its printed count: +number get checks 0 -> number add get checks 0 1. +Compiled test executes exit0 and prints16211 newline0 newline. Gate rejects +this exact-byte discrepancy with99 and no PASS. +badcompile private policy.om appends deliberately invalid native source. +Compiler exits16; gate rejects99 and no PASS. Scratch/logs remain available. +No repeated timeout experiment: the primary owns those controls, and the +same supervisor control behavior was separately qualified in previous gates. + +Commands +Private workspace:/tmp/L793-reuse-gate-review. +Each root,badstdout,badcompile directory started with its own fresh +native/state_reuse copy and empty build directory. + /tmp/L793-corrected-compiler/omc < gate.om > gate.elf 2> compile.log + chmod 700 gate.elf +From root: + timeout --kill-after=2 120 ../gate.elf /tmp/L793-corrected-compiler/omc +From each private mutation directory invoke the same command with40-second +external safety limit. stdout.txt/stderr.txt and results.txt record outcomes. +SHA256SUMS covers copied sources, executables, outputs and logs. + +Limits +Host native suite/gate qualification only; no GPU, model serving, new +production behavior or inference performance claims. Primary owns manifest +and actual runner testing. No Python, new C/Rust, compiler edits or owner +source changes. No blocking finding in this bounded repetitive verification. diff --git a/evidence/state-reuse-718/native-gate/runner.json b/evidence/state-reuse-718/native-gate/runner.json new file mode 100644 index 00000000..55ee97fb --- /dev/null +++ b/evidence/state-reuse-718/native-gate/runner.json @@ -0,0 +1 @@ +{"core":{"binary_sha256":"8e739982bfba8df4ecd8a530d268c1353234841495b69dd477f42c37681222cb","build_inputs_digest":"3f8d952ca45f0ea101808470defcfb82356fa82e5dd81fbd9c34f75e5ac0bac7","checks":[],"commit":"5e03586a8c4953e702c0b18be4a6c98f16d0b848","commit_unchanged_after":true,"dependencies":[],"derived_verdict":"PASS","env":{"LANG":"C.UTF-8","LC_ALL":"C.UTF-8"},"exit_status":0,"gate":"SC-NATIVE-STATE-REUSE","machine":{"arch":"aarch64","cpu_count":20,"cpu_model":"","gb10_present":true,"kernel_release":"7.0.0-1019-nvidia","mem_total_kib":127598528,"qemu_available":true},"machine_digest":"55574213acb2724f71f4d71cf01ba40d745451e4246c1fbef4fa1d1e97acaf1d","manifest_digest":"38e66fec00490926f0d0de09d60586dff3ef3345865013d41ec9e749c7071f27","mutants":[],"observations":[{"name":"pin_omega_reuse_native","value":"1dffceaeb0dd26fb69ea64d367a49a9950c25a62"},{"name":"reuse_groups","value":7}],"owner":"aien-sovereign-core","pins":[],"reason":"","rules":[{"held":true,"rule":"reuse_groups == 7"}],"stderr_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","stdout_sha256":"712e336c80209981fc75143f20491002b76df83080cfbd28faf34ee82e8d58a4","tree_clean_after":true,"tree_clean_before":true},"schema":"aien-test/EvidenceReceiptV1","volatile":{"cache":{"key":"f9a23f5f2774a147e2e388ec4b81e837b3772a8aab7b476ad9a74fa366fcb4c6","mode":"disabled","reused":false,"reused_from":null},"duration_ms":125,"finished_utc":"2026-10-24T01:13:37Z","gpu_held_ms":null,"gpu_wait":null,"pool":"host","pool_wait_ms":0,"runner":{"impl":"rust","name":"aien-test","version":"0.1.0"},"started_utc":"2026-10-24T01:13:37Z","timeout_exceeded":false}} diff --git a/evidence/state-reuse-718/pages/SHA256SUMS b/evidence/state-reuse-718/pages/SHA256SUMS new file mode 100644 index 00000000..9f4f34a4 --- /dev/null +++ b/evidence/state-reuse-718/pages/SHA256SUMS @@ -0,0 +1,12 @@ +b0f4d5011ad1032ec686f4afd03323e0c270a6bc22b18a92aaaf7b916c348eba adapter-control.json +98aa7d8e6868c5601fd810480020f5bf8a2d93a9dcbdc9d0a8e6dfefda82ffdb author.stdout +eb98150bd987452be13a34952451f933a78b1973d0a068c1b6ff3b9a4a71e457 copy-control.stdout +065c3b153d942bb3bd7552adfc16da225f2ec45705604aabd9bf86b3444e86f1 independent.stdout +ef7d9e338d459ce6d8611ff959876efa09102183c73a00a5df61412e16fc5d91 initial-finding.txt +83f50db5351b46c796c9620346e0e85a52c2df59660bed2f409d22d4e087dbd0 integration.stdout +6a12bbc26e8e6bdcdaf755761c03677f819a6447b323c22cef68a811c958c4a8 layout-readelf.txt +75c289e5cfdf0ce787bc45dc29285340316e7fd5472d499a04066df84c94a79c original-policy.stdout +26b750435dcd91fc408bc92a6db17c6776f8ab2b17bc8edabccfc4135a0ccfba quota-control.json +c6f9fa7f66d7489249da2a54cfc8de42657d9e3c5c43c89c0ce40fe622af7b68 receipt.json +0b93dbc0c73a80edc27324739d9fca4dcc3405e176f94a8c9825f7a131535287 reproduce.txt +efd82551a1771be81eed34a166407306212cf0d6c14232069a0c8db6ed0658eb review.txt diff --git a/evidence/state-reuse-718/pages/adapter-control.json b/evidence/state-reuse-718/pages/adapter-control.json new file mode 100644 index 00000000..49f141f6 --- /dev/null +++ b/evidence/state-reuse-718/pages/adapter-control.json @@ -0,0 +1,7 @@ +{ + "from": "add other pbytes", + "to": "other", + "compile_exit": 0, + "test_exit": 1, + "stdout": "40\n13\n" +} diff --git a/evidence/state-reuse-718/pages/author.stdout b/evidence/state-reuse-718/pages/author.stdout new file mode 100644 index 00000000..e55810cd --- /dev/null +++ b/evidence/state-reuse-718/pages/author.stdout @@ -0,0 +1,2 @@ +37905 +0 diff --git a/evidence/state-reuse-718/pages/copy-control.stdout b/evidence/state-reuse-718/pages/copy-control.stdout new file mode 100644 index 00000000..b3e2a893 --- /dev/null +++ b/evidence/state-reuse-718/pages/copy-control.stdout @@ -0,0 +1,2 @@ +2437621 +224370 diff --git a/evidence/state-reuse-718/pages/independent.stdout b/evidence/state-reuse-718/pages/independent.stdout new file mode 100644 index 00000000..395f0131 --- /dev/null +++ b/evidence/state-reuse-718/pages/independent.stdout @@ -0,0 +1,2 @@ +2437621 +0 diff --git a/evidence/state-reuse-718/pages/initial-finding.txt b/evidence/state-reuse-718/pages/initial-finding.txt new file mode 100644 index 00000000..de24ccb3 --- /dev/null +++ b/evidence/state-reuse-718/pages/initial-finding.txt @@ -0,0 +1,27 @@ +Core718 page allocator independent review, initial source +SHA256 82d468a14507209cf763570be9f857da4ab45f05de692148036c4f8f5bea99c5 + +BLOCKING: fixed allocation accounting undercounts eight bytes. +Compiler d80b428c seed/omc/omc.om s_global rounds each global array to a +16-byte allocation. pconfig[7] occupies64 bytes, not56. Other module globals +already have lengths divisible by16. Correct module pool allocation=17984. +Current pbytes uses17976, admitting budgets eight bytes below the requirement. + +Independent artifact confirmation: existing pages+main smoke.elf RW MemSiz is +8410688 bytes. Subtract8388608 stack and4096 runtime mapping table yields17984. + +Independent tests against original logical assumptions:2437621 checks,0 failures. +Includes multi-chunk real data/COW,128-handle runtime exhaustion and recovery, +1048576 actual balanced refs, quota rollback, stale handles across reinit, final +positive page generation and permanent slot retirement. + +Controls: removing shared-page copy compiled and produced224370 named failures, +exit1. Changing exact-fit comparison to greater-or-equal compiled; focused +unchanged quota-test exited1 versus positive0. Full broad suite on that mutant +trapped103, so only focused named assertion is accepted as control evidence. + +Corrected-budget focused test on original source reproduces padding error as +exit1 at actual pbytes assertion. Broad corrected-budget suite on old source +trapped105 downstream, not accepted as the regression proof. + +No product edits. Product padding correction and final replay pending. diff --git a/evidence/state-reuse-718/pages/integration.stdout b/evidence/state-reuse-718/pages/integration.stdout new file mode 100644 index 00000000..3b721a4a --- /dev/null +++ b/evidence/state-reuse-718/pages/integration.stdout @@ -0,0 +1,2 @@ +40 +0 diff --git a/evidence/state-reuse-718/pages/layout-readelf.txt b/evidence/state-reuse-718/pages/layout-readelf.txt new file mode 100644 index 00000000..ba097823 --- /dev/null +++ b/evidence/state-reuse-718/pages/layout-readelf.txt @@ -0,0 +1,12 @@ + +Elf file type is EXEC (Executable file) +Entry point 0x4000b0 +There are 2 program headers, starting at offset 64 + +Program Headers: + Type Offset VirtAddr PhysAddr + FileSiz MemSiz Flags Align + LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000 + 0x0000000000001374 0x0000000000001374 R E 0x1000 + LOAD 0x0000000000000000 0x0000000010000000 0x0000000010000000 + 0x0000000000000000 0x0000000000805640 RW 0x1000 diff --git a/evidence/state-reuse-718/pages/original-policy.stdout b/evidence/state-reuse-718/pages/original-policy.stdout new file mode 100644 index 00000000..0b02e393 --- /dev/null +++ b/evidence/state-reuse-718/pages/original-policy.stdout @@ -0,0 +1,2 @@ +16210 +0 diff --git a/evidence/state-reuse-718/pages/quota-control.json b/evidence/state-reuse-718/pages/quota-control.json new file mode 100644 index 00000000..fb279ef3 --- /dev/null +++ b/evidence/state-reuse-718/pages/quota-control.json @@ -0,0 +1,18 @@ +{ + "from": "if gt add pbytes get pconfig 0 get pconfig 2", + "to": "if ge add pbytes get pconfig 0 get pconfig 2", + "results": [ + { + "name": "quota-positive", + "compile": 0, + "exit": 0, + "stdout": "" + }, + { + "name": "quota-mutant", + "compile": 0, + "exit": 1, + "stdout": "" + } + ] +} diff --git a/evidence/state-reuse-718/pages/receipt.json b/evidence/state-reuse-718/pages/receipt.json new file mode 100644 index 00000000..f11b5865 --- /dev/null +++ b/evidence/state-reuse-718/pages/receipt.json @@ -0,0 +1,32 @@ +{ + "date": "2026-10-23", + "source_commit": "256ec5376b86a35eac1e22ce10f2f7584d7c2226", + "compiler_sha256": "1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d", + "source_sha256": "8b3ca7bffda63099afb930d1f1a59f6604c96652f93d1760c25bbe4483186a43", + "adapter_sha256": "943b23727c4805ee956d1a9b32d0e0005c57afe85aa80d2b7dfacd3816030b9b", + "fixed_module_bytes": 17984, + "os_page_bytes": 4096, + "author_checks": 37905, + "independent_checks": 2437621, + "integration_checks": 40, + "existing_policy_checks": 16210, + "failures": 0, + "compiled_controls_detected": 3, + "accounting_regression": { + "old_exit": 1, + "corrected_exit": 0, + "old_source_sha256": "82d468a14507209cf763570be9f857da4ab45f05de692148036c4f8f5bea99c5" + }, + "binaries": { + "tests": "481c8dc16b99cd94da6e20fe721c4eda72860a933fa47d1242bbeeaeb4394eca", + "independent": "4f1c34da171a9bffcf93fdf168df9fedebc742eee6d1c1ba592dc6df9e956f7d", + "policy": "6905a0134ae46694eb0d3e48cf3f9d269483bc9e7516ff45d58a73fcf01526f9", + "padding-red": "d1dfa58736db786e75850b957e09adbeb9c44d8503ed2719686f940de120bfbf", + "padding-green": "e5478365805c2e7dbc843c279d5988cac4d2a3753b9fce52f683368d9d0a422b", + "layout": "6f9383aa1138cadef77ca7a1d2604098945b10659c60f888a94f320ba680d1f5" + }, + "gpu": false, + "full_model": false, + "repository_gate": "FAIL retained; no waiver", + "remaining": "Complete-state composition/restore, native serving integration, storage/namespace/overlap and hardware measurements" +} diff --git a/evidence/state-reuse-718/pages/reproduce.txt b/evidence/state-reuse-718/pages/reproduce.txt new file mode 100644 index 00000000..d7741ae1 --- /dev/null +++ b/evidence/state-reuse-718/pages/reproduce.txt @@ -0,0 +1,52 @@ +Native backing pages: qualified host slice, not full issue acceptance. + +Use mapped compiler1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d, +Omega functional source d80b428c6ed9e3864fd7fc02cd7392bd4ad67f56. This is the +existing L788 proposed compiler profile, not merged default-branch capability. +Compilation consumes concatenated source through stdin and produces native ELF +on stdout. Require compiler exit0 before chmod700 and execution. All calls +were bounded with quiet-build timeout30. No model or device was loaded. + +Ordered units below each end in a separate test entrypoint: +- pages.om + pages-test.om:37905checks,0failures,exit0. +- pages.om + pages-independent.om:2437621checks,0failures,exit0; + independently authored and separately rebuilt/replayed by parent. +- policy.om + pages.om + page-policy.om + page-policy-test.om:40checks,0failures. +- policy.om + tests.om:original16210checks,0failures under mapping compiler. +- pages.om + pages-budget-test.om:exit0. Reconstruct initial pages module by + replacing17984 with17976; same unchanged test compiles and exits1 because + it admits a page with a budget one byte below the actual requirement. +- pages.om + pages-quota.om:exit0. Change the strict budget comparison to + greater-or-equal as recorded in quota-control.json:compile0,execution1. + +Initial17976 assumption ignored per-global16-byte compiler alignment. +pconfig7ulong consumes64 bytes, not56. Final17984 charge includes that padding. +An additional final-source binary containing pages.om plus only a main that +calls pinit has RW MemSiz8410688. Subtract8388608 stack and4096 shared compiler +mapping table:17984. layout-readelf.txt records the external readelf observation. +That runtime table, stack, executable and OS page rounding must be counted by +callers separately. The verified host OS page size is4096 (getconf PAGESIZE). + +Other successful compiled controls: +- Remove pclone invocation during shared-page write:independent2437621checks + detect224370 failures,exit1. Exact edit removes the standalone line + `pclone ulong slot ulong dest` from finalpages.om. +- Replace `add other pbytes` with `other` in page-policy.om:integration40checks + detect13failures,exit1. Actual compile/result in adapter-control.json. +Earlier broad quota control trapped103 and broad corrected-budget/old-source +run trapped105; those are explicitly excluded as qualifying controls. +A test helper namedfield initially collided with the existing policy argument; +renamedsetfield before passing integration compilation. No compiler edit. + +All test computation is handwritten seeded Omega. Shell and Node coordinate +compilation, byte hashes and development control variants; they are not runtime +or product dependencies. No Python was used. + +Host actual page copying, COW preservation, quotas and owned lifecycle only. +No complete model snapshot, restore-vs-fresh result, namespace/session authority, +disk sealing/offload, device synchronization, GPU or full-model performance. +Historical Core tree-verify-wire3b2dcd9168d73925d8dc0836adaf9a9e4dca022c was +inspected: Qwen38Snapshot retainspos/tails/states while KV remains live. +Core713 retains complete-state composition/restore ownership;484/485 storage +and nonblocking overlap remain unchanged. Repository preflight remains failed +on samebased691a4dc, as previously recorded; no unchanged broad retry or waiver. diff --git a/evidence/state-reuse-718/pages/review.txt b/evidence/state-reuse-718/pages/review.txt new file mode 100644 index 00000000..9051cf07 --- /dev/null +++ b/evidence/state-reuse-718/pages/review.txt @@ -0,0 +1,56 @@ +Core718 independent native page allocator qualification + +Final product pages.om SHA256: +8b3ca7bffda63099afb930d1f1a59f6604c96652f93d1760c25bbe4483186a43 +Optional page-policy.om adapter SHA256: +943b23727c4805ee956d1a9b32d0e0005c57afe85aa80d2b7dfacd3816030b9b +Existing mapped compiler SHA256: +1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d + +Verdict: PASS for bounded hosted allocator, byte copying, reference accounting, +and reviewed policy-accounting adapter. No remaining blocking source finding. +No full-model state semantics, namespace authentication, GPU, disk persistence, +concurrent synchronization or inference performance is qualified. + +Finding corrected before final qualification: +Initial source82d468a1 charged17976 bytes for module globals. Compiler d80b428c +s_global aligns every global to16 bytes. pconfig[7] occupies64, not56, making +the correct fixed total17984 bytes. Existing emitted pages+main smoke executable +independently confirms this: RW MemSiz8410688 minus stack8388608 and runtime +mapping table4096 equals17984. Parent corrected source, budgets and documentation. +The focused exact-fit accounting regression compiled and exited1 on oldsource, +then compiled and exited0 after correction. Runtime/process/model memory remains +separately charged by the caller, as documented. + +Final independent execution: +probes.om:2437621 checks,0 failures, exit0. Tests include real multi-chunk byte +patterns and COW at4K,8K,12K,24K,64K;128 externally allocated runtime mappings +exhausting the mapping table, graceful allocation/COW refusal, then recovery; +1048576 actual balanced references and cap refusal; exact/undersized quota and +rollback; stale handles across reinit; maximum positive page generation followed +by permanent slot retirement. Each actual allocation was reclaimed. +quota-test.om: named exact-fit allocation/accounting assertions, exit0. + +Final-source compiled negative controls: +- Omit pclone on shared-page write: successful compile, unchanged probes produce + 224370 assertion failures and exit1. +- Change quota comparison from greater-than to greater-or-equal: successful + compile, unchanged focused quota-test produces named assertion failure exit1. +Full broad suite with the quota mutant previously trapped103; it is not counted +as a successful behavioral control. A broad corrected-budget test on oldsource +trapped105 downstream; focused accounting RED is the accepted defect reproducer. +Test-development compile errors are also excluded from successful evidence. + +Adapter source review: rpool combines actual pbytes with caller-accounted other +allocations. Both operands are bounded sufficiently to avoid u64 overflow; an +oversized external value forces normal rselect refusal/output clearing. It does +not own allocator synchronization or authenticate snapshots. No product edit was +made by the reviewer. Parent owns and separately ran adapter integration tests. + +Development reproduction uses existing shell commands only: +cat pages.om probes.om > all.om +quiet-build timeout 30 "$OMC" < all.om > probes.elf 2> compile.log +# Require compiler exit0 before chmod 700 and execution. +quiet-build timeout 30 ./probes.elf +All computational test logic is handwritten .om. No Python, GPU, service, +GitHub publication or compiler change was performed by this reviewer. diff --git a/evidence/state-reuse-718/preflight-summary.txt b/evidence/state-reuse-718/preflight-summary.txt new file mode 100644 index 00000000..e136a87e --- /dev/null +++ b/evidence/state-reuse-718/preflight-summary.txt @@ -0,0 +1,4 @@ +Preflight exit 1. 57 crates: 2 freshly run, 55 stamped, 1 failed. +Failing test: aien-cli browser_mirror::tests::stub_page_screenshot_and_eval. +Eight dependency advisories: ctutils; rustls (four); rustls-webpki; webpki-root-certs; webpki-roots. +No merge qualification or issue closure. Full raw log retained locally with SHA-256 in receipt.json. diff --git a/evidence/state-reuse-718/receipt.json b/evidence/state-reuse-718/receipt.json new file mode 100644 index 00000000..cccd0556 --- /dev/null +++ b/evidence/state-reuse-718/receipt.json @@ -0,0 +1,61 @@ +{ + "schema": "state-reuse-host-policy-v1", + "issue": "https://github.com/aien-dev/aien-sovereign-core-mv/issues/718", + "source_commit": "46f6b43a845c91ae6ffaed9a15d7e52a29d9cebd", + "base": "d691a4dc", + "compiler_sha256": "191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9", + "evidence_class": "synthetic-native-host", + "files": { + "native/state_reuse/policy.om": "1fd8ca82867f8c1327129ec615aff09b47391552d52b80327c337ddd0f9d09d1", + "native/state_reuse/tests.om": "edf653c092fafb3e9226921142d392e242f224263fef55a29f1388b5aa780912", + "native/state_reuse/independent.om": "0a42d3bf6be797ba659849f4333f4604f6a95d132281986089cd9917dd6d1e15", + "native/state_reuse/README.md": "7f760fb16ce467a396aa74098567acadcf90d313c4b6cf71aea298916d409364" + }, + "executables": { + "tests": "8edf3704664d32028cbb6c55a92e18c3a4d3b809405518c7bd5ce6cbae3c68ab", + "independent": "6d722b0bc5930d6a2d262cdebeba467b36aeb52776ad592aa1d308010aaed522" + }, + "tests": { + "author": { + "checks": 16210, + "failures": 0, + "exit": 0 + }, + "independent": { + "checks": 24588, + "failures": 0, + "exit": 0 + }, + "compiled_mutants": { + "author": 4, + "independent": 2, + "all_compile_exit": 0, + "all_test_exit": 1 + } + }, + "repository_preflight": { + "exit": 1, + "command": "quiet-build timeout 180 bash scripts/agent-preflight.sh", + "crates": 57, + "fresh": 2, + "stamped": 55, + "failed": [ + "aien-cli browser_mirror::tests::stub_page_screenshot_and_eval" + ], + "advisories": 8, + "raw_log_sha256": "86235e4f72bc93a6b8a99341f07381c217cbe0fb9a7b04c021a3337cc52fed8e", + "raw_log_location": "retained locally; not published" + }, + "not_run": [ + "native serving integration", + "complete snapshot implementation", + "actual allocation/restore", + "27B hardware measurements", + "issue acceptance" + ], + "development_notes": [ + "Identifier length error13 and local-register pressure error12 corrected before qualification.", + "Initial identity mutant with untyped literals did not compile and is not counted." + ], + "review": "review.txt" +} diff --git a/evidence/state-reuse-718/review.txt b/evidence/state-reuse-718/review.txt new file mode 100644 index 00000000..f594cd0d --- /dev/null +++ b/evidence/state-reuse-718/review.txt @@ -0,0 +1,45 @@ +Core718 independent bounded host-policy review + +Reviewed product policy SHA256: +1fd8ca82867f8c1327129ec615aff09b47391552d52b80327c337ddd0f9d09d1 +Compiler SHA256: +191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9 + +Verdict: no blocking defect found within the documented standalone policy scope. +The module does not validate snapshot contents, allocate memory, restore a model, +implement concurrent ownership or establish any hardware speed benefit. + +Independent probes.om: 24588 checks, zero failures, exit 0. +Checks include exhaustive costs/current-ID/absolute-margin grid; candidate row +permutation; stable retained reference; maximum legal aggregate costs and +margins; memory exact-fit/one-byte-over; clock extrema; zero context; stale +baseline fallback with prediction invalid. + +Compiled behavioral controls: +- Replace `if le saved margin` with `if eq saved 0`: compiled successfully; + unchanged independent tests produced 1704 failures, exit 1. +- Replace `total = get rcontrol 6` with `total = ulong 0`: compiled successfully; + unchanged independent tests produced 2 failures, exit 1. +Neither crash, timeout nor compile error counted as a control kill. + +Source reasoning: memory sums are <=6*2^50 after shared configuration validation; +phase totals are <=7*10^12; relative-margin product <=7*10^18 and fits u64. +Prefix addition is bounded by checking consumed prefix <=131072 before adding +at most one pending token. Duplicate enabled IDs refuse. Selection performs no +external effects. Every output is cleared before configuration admission. + +Integration limitation reviewed: rcalib cannot refresh an expired profile or +bootstrap an under-sampled one because it requires an admitted profile. README +now explicitly assigns new initial calibration to the existing measurement owner. +This is disclosed, not a hidden recovery capability. + +Reproduction: +cat policy.om probes.om > all.om +quiet-build timeout 30 "$OMC" < all.om > probes.elf 2> compile.log +# Require compiler success, then chmod 700 probes.elf. +quiet-build timeout 20 ./probes.elf + +An initial snapshot taken during parent changes did not compile (error12) and +was superseded before qualification. It is not a passing result. All above +results bind the stated final policy SHA. No product files were edited by the +reviewer, and no GPU, service or GitHub action occurred. diff --git a/evidence/state-reuse-718/tests.stdout b/evidence/state-reuse-718/tests.stdout new file mode 100644 index 00000000..0b02e393 --- /dev/null +++ b/evidence/state-reuse-718/tests.stdout @@ -0,0 +1,2 @@ +16210 +0 diff --git a/native/state_reuse/README.md b/native/state_reuse/README.md new file mode 100644 index 00000000..22f715b4 --- /dev/null +++ b/native/state_reuse/README.md @@ -0,0 +1,293 @@ +# Complete-state reuse selection + +## Existing host gate + +`SC-NATIVE-STATE-REUSE` is a narrow host gate in the existing verification +runner. Its inputs cover this directory, `evidence/state-reuse-718/`, its +manifest and the existing dispatcher. It runs seven native suites and requires +`AIEN-OBS reuse_groups 7`, exact output bytes and exit zero. It makes no +hardware, complete-model snapshot or inference speed claim. + +Run through the existing entry point: + +```sh +CARGO_TARGET_DIR=/home/drakestapleton/workspace/targets/L793-reuse-gate quiet-build tests/gates/run.sh native-state-reuse +``` + +The dispatcher reads `compiler.lock` and materializes the existing sibling +Omega repository offline as `aien-pins/omega-reuse-native`. The explicit pin is +`1dffceaeb0dd26fb69ea64d367a49a9950c25a62`, an **unmerged Omega PR676 dependency**, +not the repository's `omega.lock` production dependency. `compiler.sha256` +checks both compiler source and executable, whose SHA-256 is +`9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4`. +No network fetch or compiler substitution is permitted. The older component +receipts below retain their original compiler identities; the gate replays +their expected results using this explicitly pinned process/mapping profile. + +The dispatcher only pins, checks, stages and compiles. `gate.om` concatenates +the existing sources, compiles each program, checks its exit and exact output, +and emits the observation. Its process helpers follow the existing Omega +gate669/W4 gate. Every child has a 30-second deadline; a signal or timeout is +invalid even if another exit was expected. The exclusive scratch directory +prevents a stale output from satisfying a new run. Scratch files, child output +and command traces remain available after refusal. + +For supervisor controls, run the compiled gate in a separate fresh stage with +its compiler path as argument one and control selector `0`, `1` or `2` as +argument two. These respectively inject exit seven, a self-signal, or a +45-second child sleep. All must refuse with exit 99 and no PASS observation. +An already existing scratch directory refuses with exit 91. These controls +are native `.om`; they do not run GPU or model work. + +The native Omega components in this directory advance Core #718. `policy.om` chooses between +fresh prefill, a compatible RAM snapshot and a compatible disk snapshot by +estimated total completion time. It does not implement snapshots, allocate +memory, authenticate files, restore state or execute a model. `pages.om` now +provides bounded host backing pages as described below. Complete-state +composition and restore remain with Core #713; storage identity and offload +remain with #484/#485. Nothing here is wired into production. Hardware +performance and full-model correctness are NOT_RUN. + +Inspected baseline: Core main `d691a4dc`, +`crates/aien-serve-http/src/kv_persist.rs`, `PersistState` storage path. +Its `fetch(prompt, in_ram)` skips disk restoration when the disk prefix is no +longer than the RAM prefix. This component supplies a cost decision for the +future native complete-state owner; it does not change that existing path. + +## Calling contract + +Concatenate `policy.om` before a seeded `.om` caller. All values are unsigned +64-bit integers. Time estimates are microseconds. Calibration timestamps and +the current timestamp must use one monotonic clock in microseconds. There is +one caller-owned policy instance; concurrent calls need separate instances or +the existing scheduler's serialization. No locks or disk waits occur here. + +`rcontrol` has these ten fields: + +| Index | Meaning | +| --- | --- | +| 0 | Candidate count, 1 through 16; row zero is always fresh work | +| 1 | Previously selected stable snapshot ID; zero means fresh work | +| 2 | Current monotonic timestamp | +| 3 | Maximum calibration age | +| 4 | Minimum observed samples, 1 through 1,000,000 | +| 5 | Total allowed memory bytes, at most 2^50 | +| 6 | Already allocated backing and shared references, counted once | +| 7 | Absolute switching margin in microseconds, at most 10^12 | +| 8 | Relative switching margin in millionths, at most 1,000,000 | +| 9 | Current request token boundary, at most 131,072 | + +Each candidate occupies 22 words in `rrows`: + +| Index | Meaning | +| --- | --- | +| 0 | Enabled: exactly one admits the row; other values are skipped | +| 1 | Source kind: zero fresh, one RAM, two disk | +| 2 | Stable snapshot incarnation ID, unique among enabled rows; fresh is zero | +| 3 | Accepted, consumed prefix length; fresh is zero | +| 4 | Emitted but unconsumed token count, zero or one; fresh is zero | +| 5 | Complete-state qualification mask, exactly 31 for reuse | +| 6 | Observed calibration sample count, bounded at 1,000,000 | +| 7 | Last calibration timestamp | +| 8 through 14 | Lookup, read, integrity/decryption/validation, transfer, reconstruction, suffix prefill, and remaining generation time | +| 15 through 19 | Additional backing, metadata, staging, scratch and commit/output reservation bytes | +| 20 | Caller has verified payload integrity, exactly one for reuse | +| 21 | Caller still holds the snapshot and its generation, exactly one for reuse | + +The five state bits mean attention, recurrent state, convolution tails, +position/pending-token/drafter state, and sampler/constraint continuation state +are all either present or explicitly qualified as reconstructible under the +same continuation contract. They are assertions from the qualified owner, +not a substitute for inspection or tests of those states. A model without one +of these state families still needs an explicit not-applicable qualification. + +`rexpect` contains eight nonzero 256-bit identities, four words per identity: +model, tokenizer, template, precision/layout, backend, namespace, continuation +contract and cost-workload profile. The workload profile binds exact context +shape, output-work estimate and calibration environment. `rident` contains +the same 32-word tuple for each candidate. The caller validates the actual +prefix against request tokens separately, authenticates the source and binds +the tuple to it. This module compares all words; it does not create a digest +or interpret an untrusted ID as a capability. + +The owner must include all retained shared backing in control field six, and +all incremental allocations and temporary reservations in each row. Count a +shared allocation once, and never subtract merely freed slots from allocated +backing. The selected reservation must succeed before copying or publishing +tokens. A failed reservation requires a fresh decision with updated accounting. + +## Decisions and errors + +`rselect` returns zero on a decision. `rresult` contains selected row, predicted +total time, predicted saving against fresh work, prediction-valid flag and +stale-or-missing-baseline fallback flag. Output is cleared before validation. +`rreason` gives each row's admission status; unexamined rows stay 77. + +Status 65 means malformed configuration/row, 69 incompatible or missing +identity, 74 missing/stale/future calibration, 75 insufficient memory, 76 an +unqualified state boundary, and 77 disabled or unexamined. Invalid reuse rows +are skipped. An invalid baseline refuses the request, except that missing or +stale calibration selects fresh work with prediction-valid zero. In that +fallback, no predicted time or saving is asserted. The caller can run its +ordinary path only after its own admission checks. + +Every phase is bounded at 10^12 microseconds; sums and margin arithmetic fit +64 bits. A zero total estimate is unknown. The cheapest admitted candidate +wins only when its saving strictly exceeds the absolute plus relative margin. +The reference is the admitted current snapshot if cheaper than fresh work, +otherwise fresh work. Exact ties retain that reference; other ties prefer RAM +to disk, then the smaller stable ID. Row ordering therefore does not determine +which of equally priced reusable snapshots wins. An invalid current snapshot +cannot be retained by the switching margin. + +`rcalib(row, timestamp)` updates an already admitted profile from the seven +actual elapsed phases in `robs`. All fields are validated before any update. +Each estimate becomes `ceil((7 * old + observed) / 8)`; sample counts saturate. +This bounded smoothing is a policy choice, not a statistical confidence claim. +An expired or changed profile requires a new initial calibration from the +existing measurement owner. Do not feed predicted or fabricated measurements +back as observations. Record actual completion cost and the selected source +through the existing measurement owner, without exporting private prompts. + +## Reproduction + +The compiler is the existing independently reconstructed source-built Omega +compiler from omega-bridge `0fc7d8662cb799e7c206b17c18ea4c3ec2b8fea9`, built +with its existing `tools/bootstrap.sh --offline`. Required compiler SHA-256: +`191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`. + +Set `OMC` to that verified executable and `REUSE_OUT` to a private output +directory. Existing shell commands below are development orchestration only. +All new implementation and test logic is handwritten seeded `.om`. + +```sh +cat native/state_reuse/policy.om native/state_reuse/tests.om > "$REUSE_OUT/tests.om" +quiet-build timeout 30 "$OMC" < "$REUSE_OUT/tests.om" > "$REUSE_OUT/tests.elf" +# Require successful compilation before executing the output. +chmod 700 "$REUSE_OUT/tests.elf" +quiet-build timeout 20 "$REUSE_OUT/tests.elf" +``` + +The test prints the check count and failure count, returning one on failure. +Its 8,000 synthetic cost triples independently enumerate the expected cheapest +fresh/RAM/disk choice. Other controls cover all identity words, all timing and +memory phases, stale/future profiles, state boundaries, hysteresis and atomic +calibration rejection. Synthetic timings establish policy behavior only. + +Remaining #718 gates include actual snapshot retention/allocation, integration +with #713 and native serving, observed profiles on the qualified 27B artifact, +corrupt-file and cancellation recovery, storage overlap, actual RAM/page-cache/ +NVMe comparisons, independent final-source review and normal repository gates. +No existing runtime or storage implementation is retired by this component. + +## Owned backing pages and copy-on-write + +`pages.om` implements the bounded host allocation portion of #718, using +existing L788 managed memory operations. It does not define a second snapshot, +cache, scheduler, persistent store, device arena or model-state format. +Historical Core `cascade/tree-verify-wire` at +`3b2dcd9168d73925d8dc0836adaf9a9e4dca022c` stores `pos`, `tails` and `states` +in Qwen38Snapshot while retaining attention rows in the live arena. That +single-conversation technique does not establish independent complete-state +snapshots. Core #713 must determine the complete accepted-state page set and +qualify the restore boundary, including all recurrent layers and continuation +state, before this allocator can back production reuse. + +This code uses the existing proposed Omega compiler extension at functional +source `d80b428c6ed9e3864fd7fc02cd7392bd4ad67f56`, consumed from public draft +PR #676, with compiler SHA256 +`1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d`. +The qualified Linux AArch64 host has 4096-byte OS pages, verified with +`getconf PAGESIZE`. This accounting profile requires that page size; it is +not portable physical-memory qualification for arbitrary hosts or AienOS. +The module makes real anonymous mappings. It does not use GPU memory or copy +whole context arenas for each snapshot. + +`pinit(page_size,slot_limit,budget)` configures an empty pool. Page size is +4096..67108864, a multiple of4096; slot limit is1..64. Budget is17984..2^50. +The17984 fixed bytes account for this module's global allocations, including compiler alignment: +7 configuration words padded to64 bytes, three64-entry tables and two8192-byte copy buffers. +Add compiler mapping-table storage, executable/data page rounding, stack, +other modules, model memory and outstanding reservations separately in the +caller's overall accounting. This component does not claim total process RSS. +All calls require one serialized owner. Internal globals must not be changed +by a consumer, and mappings must not be unmapped outside this module. + +- `pnew` returns one owned reference to a zero-filled page as a positive long + ID, or a negative status. It reserves exactly one page against the budget. +- `phold(id)` adds one reference to the same backing page. The total reference + count is capped at1048576. Sharing does not add backing bytes. +- `pfree(id)` releases one owned reference. Only the final release unmaps the + backing; accounting decreases only after that operation succeeds. A returned + unmap failure preserves the reference and charge for a later retry. +- `pread(id,offset,count)` copies up to8192 bytes into `pio`. It validates + the ID and both range ends first. On failure, scratch bytes are not a result. +- `pwrite(id,offset,count)` writes the first `count` bytes of `pio` and returns + the reference the caller must retain. With one reference it modifies the + owned page and returns the same ID. With shared backing it allocates and + copies exactly one page, applies the write, then transfers one reference + from the old page to the new page. Allocation refusal preserves the original + bytes, references and accounting. A valid zero-length write never copies. +- `pbytes` returns live mapped backing plus17984 fixed module bytes, including + when uninitialized or empty. Freeing one of several references does not + lower this value. + +Status0 is success for status-returning functions. Status65 means invalid +configuration or range,73 uninitialized/busy/stale/invalid ownership ID, +74 returned unmap error,75 quota/capacity/allocation refusal. `pnew` and +`pwrite` return these statuses negated. The underlying compiler traps on +corrupted raw mapping handles; its checked copies return the requested byte +count or trap. Such corruption and concurrent mutation are outside the owned, +serialized module contract. + +IDs encode a slot and generation. Generations survive empty-pool reconfiguration +and increase on reuse. At2^56-1 a slot retires permanently rather than wrapping. +The largest ID remains positive as a signed64-bit value. A released reference +must never be reused, even if other references keep the page alive: the ID +identifies backing, not a distinct session's grant. Callers must balance +references, enforce read-only snapshot semantics and namespace/session +permissions, and update their binding to every successful `pwrite` result. +This primitive does not authenticate those higher-level ownership rules. + +Each page is a separate managed mapping. The compiler's128 mapping slots are +shared with other process allocations, so an allocation can refuse before +this pool's own limit. Linux may lazily commit physical pages; allocation +success does not guarantee immunity from an OS out-of-memory kill. Actual +GPU state lifetime, producer synchronization and host/device transfer remain +with the existing state/runtime owners. + +## Connecting allocation accounting to the selection policy + +Concatenate `policy.om`, `pages.om` and `page-policy.om` for the optional +`rpool(other_allocated_bytes)` entry point. It sets policy control field6 to +`pbytes + other_allocated_bytes`, then runs the unchanged selector. Other +bytes must exclude the pool payload already counted and include every other +retained backing, metadata and reservation. Oversized input refuses through +`rselect`, preserving its cleared-output failure behavior. Serialized use +ensures the measured allocation count remains current during selection. + +The caller still fills candidate incremental memory fields. In particular, +a shared-page write reserves a full additional page before mutation. Neither +the adapter nor a successful selection authenticates the candidate, creates +a complete snapshot, or guarantees a later allocation; the caller must handle +allocation refusal without publishing tokens or discarding the prior state. + +Native `pages-test.om` passes37905 checks. A separately compiled +`page-policy-test.om` passes40 checks, including the actual change in decisions +when backing is released, one-byte-under allocation headroom, copy-on-write +preservation and excessive external-memory refusal. A compiled adapter that +omits live page bytes is rejected. The unchanged original policy also passes +its16210 checks under the mapping compiler. Independent page tests and controls +are recorded in `evidence/state-reuse-718/pages/`. + +Build by concatenating the required module files followed by exactly one test +entrypoint, feeding that source to the pinned compiler, checking compiler +success, then executing the emitted ELF. No source here calls a foreign helper. +Development shell/Node orchestration is disclosed separately from native code. +Model restore-versus-fresh equivalence, namespace/store/cancellation integration, +NVMe timing and full-model improvement remain open issue gates. + +## Corrected compiler compatibility + +The compiler safety correction in Omega PR676 also reproduces this component +without changing its executable bytes. See [evidence/state-reuse-718/compiler-correction](../../evidence/state-reuse-718/compiler-correction/README.md) for the exact compiler/source pins, binary comparisons and fresh host replays. The original qualification remains preserved. diff --git a/native/state_reuse/compiler.lock b/native/state_reuse/compiler.lock new file mode 100644 index 00000000..79d4f8ab --- /dev/null +++ b/native/state_reuse/compiler.lock @@ -0,0 +1 @@ +1dffceaeb0dd26fb69ea64d367a49a9950c25a62 diff --git a/native/state_reuse/compiler.sha256 b/native/state_reuse/compiler.sha256 new file mode 100644 index 00000000..a02483ed --- /dev/null +++ b/native/state_reuse/compiler.sha256 @@ -0,0 +1,2 @@ +9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4 seed/out/omc +a2691c76dfae15e1e8c4503fb22ce483f638824e5ab87146a13e2edb70b5a513 seed/omc/omc.om diff --git a/native/state_reuse/gate-child.om b/native/state_reuse/gate-child.om new file mode 100644 index 00000000..ca94d9b5 --- /dev/null +++ b/native/state_reuse/gate-child.om @@ -0,0 +1,20 @@ +note Supervisor negative controls: known wrong exit, self-signal, deadline overrun. +global mode uchar 1 +fn main to int +if ne read 0 mode 0 1 1 +ret 90 +end +m = get mode 0 +if eq m 0 +ret 7 +end +if eq m 1 +r = killpid int getpid 9 +ret 98 +end +if eq m 2 +r = sleepns 45000000000 +ret 98 +end +ret 90 +end diff --git a/native/state_reuse/gate.om b/native/state_reuse/gate.om new file mode 100644 index 00000000..5b81f721 --- /dev/null +++ b/native/state_reuse/gate.om @@ -0,0 +1,431 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note State reuse host qualification. Process helpers adapted from Omega gate669 at1dffceae. +note No GPU. Exact exits and output bytes; child deadlines30s; scratch exclusive. +text scratch "build/reuse-native-gate" +text prefix "build/reuse-native-gate/" +text names "unused\n/dev/null\nnative/state_reuse/policy.om\nnative/state_reuse/tests.om\nnative/state_reuse/independent.om\nnative/state_reuse/pages.om\nnative/state_reuse/pages-test.om\nnative/state_reuse/pages-independent.om\nnative/state_reuse/page-policy.om\nnative/state_reuse/page-policy-test.om\nnative/state_reuse/pages-budget-test.om\nnative/state_reuse/pages-quota.om\nnative/state_reuse/gate-child.om\n" +text input " < " +text output " > " +text errors " 2> " +text nl "\n" +text statusm "exit=" +text expect " expected=" +text signalm "INVALID child wait low-byte=" +text timeoutm "INVALID child deadline exceeded; sent SIGKILL; wait low-byte=" +text passed "AIEN-OBS reuse_groups 7\nSTATE_REUSE_NATIVE_GATE: PASS\n" +text failed "STATE_REUSE_NATIVE_GATE: FAIL; retain all scratch files and command output\n" +global pathbuf uchar 4096 +global plen ulong 1 +global serial ulong 1 +global argv uchar 4096 +global argc ulong 1 +global apos ulong 1 +global statbuf uchar 4 +global buf uchar 4096 +global other uchar 4096 +global digits uchar 32 +global cases ulong 1 +text wauthor "16210\n0\n" +text wreview "24588\n0\n" +text wresid "37905\n0\n" +text windep "2437621\n0\n" +text wjoined "40\n0\n" +fn stop to void +r = write 2 failed 0 len failed +exit 99 +end +fn decimal v ulong to ulong +x = v +n = ulong 0 +while ge x 10 +put digits n uchar add 48 rem x 10 +x = div x 10 +n = add n 1 +end +put digits n uchar add 48 x +ret add n 1 +end +fn num v ulong to void +n = decimal v +for i ulong n +r = write 1 digits sub sub n i 1 1 +if ne r 1 +stop +end +end +end +fn setpath id ulong to void +if eq id 1 +n = argread 1 pathbuf 0 len pathbuf +if le n 0 +stop +end +put plen 0 ulong n +ret +end +if and ge id 100 lt id 356 +put pathbuf 0 uchar sub id 100 +put plen 0 1 +ret +end +if ge id 1000 +for i ulong len prefix +put pathbuf i get prefix i +end +n = decimal id +for i ulong n +put pathbuf add len prefix i get digits sub sub n i 1 +end +put plen 0 add len prefix n +ret +end +index = ulong 1 +p = ulong 0 +for i ulong len names +b = get names i +if eq b 10 +if eq index id +put plen 0 p +ret +end +index = add index 1 +else +if eq index id +put pathbuf p b +p = add p 1 +end +end +end +stop +end +fn showpath id ulong to void +setpath id +r = write 1 pathbuf 0 get plen 0 +if ne r long get plen 0 +stop +end +end +fn openfile id ulong flags int to int +setpath id +r = fopen pathbuf 0 get plen 0 flags 384 +if lt r 0 +stop +end +ret int r +end +fn fresh to ulong +n = add get serial 0 1 +if ge n 400000 +stop +end +put serial 0 n +ret add 1000 n +end +fn arg id ulong to void +setpath id +p = get apos 0 +n = get plen 0 +if gt add add p n 2 len argv +stop +end +put argv p uchar and n 255 +put argv add p 1 uchar shr n 8 +p = add p 2 +for i ulong n +put argv add p i get pathbuf i +end +put apos 0 add p n +put argc 0 add get argc 0 1 +end +fn command exe ulong to void +put argc 0 0 +put apos 0 2 +arg exe +showpath exe +end +fn argument id ulong to void +put digits 0 32 +r = write 1 digits 0 1 +showpath id +arg id +end +fn close fd int to void +if ne fclose fd 0 +stop +end +end +fn redirect source int dest int to void +if ne source dest +if ne dupfd source dest 0 long dest +stop +end +end +end +fn reap pid int to ulong +start = monons +if lt start 0 +stop +end +while true +r = waitpid pid statbuf 0 len statbuf 1 +if eq r long pid +if ne get statbuf 0 0 +r = write 1 signalm 0 len signalm +num ulong get statbuf 0 +r = write 1 nl 0 1 +stop +end +ret ulong get statbuf 1 +end +if lt r 0 +stop +end +now = monons +if or lt now start gt sub now start 30000000000 +r = killpid pid 9 +r = waitpid pid statbuf 0 len statbuf 0 +r = write 1 timeoutm 0 len timeoutm +num ulong get statbuf 0 +r = write 1 nl 0 1 +stop +end +if ne sleepns 1000000 0 +stop +end +end +exit 99 +end +fn run source ulong wanted ulong to ulong +outid = fresh +errid = add outid 500000 +r = write 1 input 0 len input +showpath source +r = write 1 output 0 len output +showpath outid +r = write 1 errors 0 len errors +showpath errid +r = write 1 nl 0 1 +rd = openfile source 524288 +wr = openfile outid 524481 +er = openfile errid 524481 +put argv 0 uchar get argc 0 +put argv 1 uchar shr get argc 0 8 +pid = fork +if lt pid 0 +stop +end +if eq pid 0 +redirect rd 0 +redirect wr 1 +redirect er 2 +r = execprog argv 0 get apos 0 +exit 98 +end +close rd +close wr +close er +actual = reap int pid +r = write 1 statusm 0 len statusm +num actual +r = write 1 expect 0 len expect +num wanted +r = write 1 nl 0 1 +if ne actual wanted +stop +end +ret outid +end +fn enable id ulong to void +fd = openfile id 524288 +r = read fd buf 0 4 +if ne r 4 +stop +end +if or ne get buf 0 127 ne get buf 1 69 +stop +end +if or ne get buf 2 76 ne get buf 3 70 +stop +end +if ne fchmod fd 448 0 +stop +end +close fd +end +fn empty id ulong to void +fd = openfile id 524288 +r = read fd buf 0 1 +close fd +if ne r 0 +stop +end +end +fn compile cc ulong src ulong wanted ulong to ulong +command cc +outid = run src wanted +if eq wanted 0 +enable outid +else +empty outid +end +ret outid +end +fn append source ulong dest int to void +fd = openfile source 524288 +while true +n = read fd buf 0 len buf +if lt n 0 +stop +end +if eq n 0 +close fd +ret +end +if ne write dest buf 0 ulong n n +stop +end +end +end +fn combine first ulong second ulong to ulong +id = fresh +fd = openfile id 524481 +append first fd +put buf 0 10 +if ne write fd buf 0 1 1 +stop +end +append second fd +close fd +ret compile 1 id 0 +end +fn exact id ulong want ulong to void +if eq want 5 +empty id +ret +end +fd = openfile id 524288 +n = read fd buf 0 len buf +extra = read fd other 0 1 +close fd +size = len wauthor +if eq want 1 +size = len wreview +end +if eq want 2 +size = len wresid +end +if eq want 3 +size = len windep +end +if eq want 4 +size = len wjoined +end +if or ne n long size ne extra 0 +stop +end +for i ulong size +b = uchar 0 +if eq want 0 +b = get wauthor i +end +if eq want 1 +b = get wreview i +end +if eq want 2 +b = get wresid i +end +if eq want 3 +b = get windep i +end +if eq want 4 +b = get wjoined i +end +if ne get buf i b +stop +end +end +end +fn execute exe ulong want ulong to void +command exe +outid = run 2 0 +exact outid want +put cases 0 add get cases 0 1 +end +fn suite first ulong second ulong want ulong to void +exe = combine first second +execute exe want +end +fn joined to void +id = fresh +fd = openfile id 524481 +append 3 fd +put buf 0 10 +if ne write fd buf 0 1 1 +stop +end +append 6 fd +put buf 0 10 +if ne write fd buf 0 1 1 +stop +end +append 9 fd +put buf 0 10 +if ne write fd buf 0 1 1 +stop +end +append 10 fd +close fd +exe = compile 1 id 0 +execute exe 4 +end +fn modefile value uchar to ulong +id = fresh +fd = openfile id 524481 +put buf 0 value +if ne write fd buf 0 1 1 +stop +end +close fd +ret id +end +fn control to void +if ne argread 2 buf 0 1 1 +stop +end +m = get buf 0 +if or lt m 48 gt m 50 +stop +end +id = modefile uchar sub m 48 +child = compile 1 13 0 +command child +result = run id 0 +stop +end +fn main to int +if or lt argcnt 2 gt argcnt 3 +ret 90 +end +if ne makedir scratch 0 len scratch 448 0 +ret 91 +end +if eq argcnt 3 +control +ret 99 +end +suite 3 4 0 +suite 3 5 1 +suite 6 7 2 +suite 6 8 3 +joined +suite 6 11 5 +suite 6 12 5 +if ne get cases 0 7 +stop +end +r = write 1 passed 0 len passed +if ne r long len passed +ret 99 +end +ret 0 +end diff --git a/native/state_reuse/independent.om b/native/state_reuse/independent.om new file mode 100644 index 00000000..ecb34e51 --- /dev/null +++ b/native/state_reuse/independent.om @@ -0,0 +1,172 @@ +global nfails ulong 1 +global nchecks ulong 1 +fn chk a ulong b ulong to void +put nchecks 0 add get nchecks 0 1 +if ne a b +put nfails 0 add get nfails 0 1 +end +end +fn printnum value ulong to void +buf = new uchar 32 0 +n = ulong 0 +v = value +while ge v 10 +put buf n uchar add rem v 10 48 +n = add n 1 +v = div v 10 +end +put buf n uchar add v 48 +n = add n 1 +while gt n 0 +n = sub n 1 +w = write 1 buf n 1 +end +put buf 0 10 +w = write 1 buf 0 1 +end +fn rowset r ulong f ulong v ulong to void +put rrows add mul r 22 f v +end +fn fresh to void +for i ulong 352 +put rrows i 0 +end +for i ulong 10 +put rcontrol i 0 +end +put rcontrol 0 3 +put rcontrol 2 100 +put rcontrol 3 50 +put rcontrol 4 5 +put rcontrol 5 10000 +put rcontrol 6 1000 +put rcontrol 9 100 +for i ulong 32 +put rexpect i add i 1 +end +for r ulong 16 +for i ulong 32 +put rident add mul r 32 i add i 1 +end +end +for r ulong 3 +rowset r 0 1 +rowset r 1 r +rowset r 2 r +rowset r 3 mul r 20 +rowset r 5 31 +rowset r 6 5 +rowset r 7 75 +rowset r 8 100 +rowset r 15 500 +rowset r 20 1 +rowset r 21 1 +end +end +fn permute to void +for f ulong 22 +a = rfield 1 f +rowset 1 f rfield 2 f +rowset 2 f a +end +end +fn main to int +note Exhaustively vary costs, retained ID, switching margin, and row order. +for a ulong 8 +for b ulong 8 +for c ulong 8 +for old ulong 3 +for marg ulong 4 +fresh +rowset 0 8 add a 1 +rowset 1 8 add b 1 +rowset 2 8 add c 1 +put rcontrol 1 old +put rcontrol 7 marg +anchor = ulong 0 +ac = a +if eq old 1 +if lt b a +anchor = 1 +ac = b +end +end +if eq old 2 +if lt c a +anchor = 2 +ac = c +end +end +want = anchor +wc = ac +if lt a wc +want = 0 +wc = a +end +if lt b wc +want = 1 +wc = b +end +if eq b wc +if ne want anchor +if gt want 1 +want = 1 +end +end +end +if lt c wc +want = 2 +wc = c +end +if le sub ac wc marg +want = anchor +end +chk ulong rselect 0 +chk rfield get rresult 0 2 want +permute +chk ulong rselect 0 +chk rfield get rresult 0 2 want +end +end +end +end +end +note Overflow and maximum legal aggregate costs must stay bounded. +fresh +for r ulong 3 +for f ulong 7 +rowset r add f 8 1000000000000 +end +end +put rcontrol 8 1000000 +put rcontrol 7 1000000000000 +chk ulong rselect 0 +chk get rresult 1 7000000000000 +chk get rresult 2 0 +fresh +rowset 0 15 9000 +chk ulong rselect 0 +rowset 0 19 1 +chk ulong rselect 75 +chk get rresult 3 0 +note All clock extrema, zero context and stale baseline. +fresh +put rcontrol 2 18446744073709551615 +put rcontrol 3 18446744073709551615 +chk ulong rselect 0 +fresh +put rcontrol 9 0 +chk ulong rselect 0 +chk get rresult 0 0 +fresh +rowset 0 7 101 +chk ulong rselect 0 +chk get rresult 3 0 +chk get rresult 4 1 +printnum get nchecks 0 +printnum get nfails 0 +if ne get nfails 0 0 +ret 1 +end +ret 0 +end diff --git a/native/state_reuse/page-policy-test.om b/native/state_reuse/page-policy-test.om new file mode 100644 index 00000000..755d8582 --- /dev/null +++ b/native/state_reuse/page-policy-test.om @@ -0,0 +1,95 @@ +global ncheck ulong 2 +fn check yes bool to void +put ncheck 0 add get ncheck 0 1 +if not yes +put ncheck 1 add get ncheck 1 1 +end +end +fn setfield row ulong key ulong val ulong to void +put rrows add mul row 22 key val +end +fn setup to void +put rcontrol 0 2 +put rcontrol 2 1000 +put rcontrol 3 100 +put rcontrol 4 5 +put rcontrol 5 26176 +put rcontrol 9 100 +for i ulong 32 +put rexpect i add i 1 +put rident i add i 1 +put rident add i 32 add i 1 +end +for r ulong 2 +setfield r 0 1 +setfield r 1 r +setfield r 2 r +setfield r 3 mul r 10 +setfield r 5 31 +setfield r 6 5 +setfield r 7 950 +setfield r 8 sub 1000 mul r 900 +setfield r 20 1 +setfield r 21 1 +end +setfield 1 15 4096 +end +fn chosen row ulong other ulong to void +check eq rpool other 0 +check eq get rresult 0 row +check eq get rcontrol 6 add other pbytes +end +fn number value ulong to void +if ge value 10 +number div value 10 +end +put pio 0 uchar add rem value 10 48 +n = write 1 pio 0 1 +end +fn main to int +setup +check eq pinit 4096 2 26176 0 +snapshot = pnew +check gt snapshot 0 +check eq phold snapshot 0 +other = pnew +check gt other 0 +chosen 0 0 +check eq get rreason 1 75 +check eq pfree snapshot 0 +note Releasing one of two references does not release backing. +chosen 0 0 +check eq get rreason 1 75 +check eq pfree other 0 +chosen 1 0 +note Other retained allocations also count; one extra byte prevents the COW reservation. +chosen 0 1 +check eq get rreason 1 75 +chosen 1 0 +check eq phold snapshot 0 +put pio 0 99 +copy = pwrite snapshot 0 1 +check gt copy 0 +check ne copy snapshot +chosen 0 0 +check eq pread snapshot 0 1 0 +check eq get pio 0 0 +check eq pread copy 0 1 0 +check eq get pio 0 99 +check eq pfree snapshot 0 +check eq pfree copy 0 +check eq pbytes 17984 +check eq rpool 18446744073709551615 75 +check eq get rresult 3 0 +check eq rpool 0 0 +number get ncheck 0 +put pio 0 10 +n = write 1 pio 0 1 +number get ncheck 1 +put pio 0 10 +n = write 1 pio 0 1 +if ne get ncheck 1 0 +ret 1 +end +ret 0 +end diff --git a/native/state_reuse/page-policy.om b/native/state_reuse/page-policy.om new file mode 100644 index 00000000..e981d7ca --- /dev/null +++ b/native/state_reuse/page-policy.om @@ -0,0 +1,11 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Combine measured owned page backing with other caller-accounted allocations. +note Caller serializes policy and pool; this does not authenticate snapshot contents. +fn rpool other ulong to int +if gt other 1125899906842624 +put rcontrol 6 1125899906842625 +else +put rcontrol 6 add other pbytes +end +ret rselect +end diff --git a/native/state_reuse/pages-budget-test.om b/native/state_reuse/pages-budget-test.om new file mode 100644 index 00000000..714bf362 --- /dev/null +++ b/native/state_reuse/pages-budget-test.om @@ -0,0 +1,28 @@ +note The pinned ELF's17984-byte static module footprint includes16-byte global padding. +fn main to int +if ne pinit 4096 1 22079 0 +ret 2 +end +id = pnew +if gt id 0 +r = pfree id +ret 1 +end +if ne id neg long 75 +ret 3 +end +if ne pbytes 17984 +ret 4 +end +if ne pinit 4096 1 22080 0 +ret 5 +end +id = pnew +if le id 0 +ret 6 +end +if ne pbytes 22080 +ret 7 +end +ret pfree id +end diff --git a/native/state_reuse/pages-independent.om b/native/state_reuse/pages-independent.om new file mode 100644 index 00000000..07622b92 --- /dev/null +++ b/native/state_reuse/pages-independent.om @@ -0,0 +1,222 @@ +global checks ulong 2 +global extra long 128 +fn ck ok bool to void +put checks 0 add get checks 0 1 +if not ok +put checks 1 add get checks 1 1 +end +end +fn printnum value ulong to void +if ge value 10 +printnum div value 10 +end +put pio 0 uchar add rem value 10 48 +n = write 1 pio 0 1 +end +fn pattern offset ulong salt ulong to uchar +ret uchar rem add mul offset 13 salt 251 +end +fn fill id long size ulong salt ulong to void +off = ulong 0 +while lt off size +amount = sub size off +if gt amount 8192 +amount = 8192 +end +for j ulong amount +put pio j pattern add off j salt +end +ck eq pwrite id off amount id +off = add off amount +end +end +fn verify id long size ulong salt ulong changed ulong to void +off = ulong 0 +while lt off size +amount = sub size off +if gt amount 8192 +amount = 8192 +end +ck eq pread id off amount 0 +for j ulong amount +want = pattern add off j salt +if eq add off j changed +want = 255 +end +ck eq get pio j want +end +off = add off amount +end +end +fn chunk size ulong to void +ck eq pinit size 3 add 17984 mul size 3 0 +a = pnew +ck gt a 0 +fill a size 17 +ck eq phold a 0 +ck eq phold a 0 +put pio 0 255 +b = pwrite a sub size 1 1 +ck gt b 0 +ck ne a b +ck eq get pconfig 5 3 +ck eq get pconfig 4 2 +ck eq pbytes add 17984 mul size 2 +put pio 0 255 +c = pwrite a 8191 1 +if lt size 8192 +ck eq c neg long 65 +ck eq get pconfig 5 3 +ck eq pfree a 0 +else +ck gt c 0 +ck ne a c +ck ne b c +ck eq get pconfig 5 3 +ck eq get pconfig 4 3 +verify c size 17 8191 +ck eq pfree c 0 +end +verify a size 17 18446744073709551615 +verify b size 17 sub size 1 +ck eq pfree a 0 +ck eq pfree b 0 +ck eq pbytes 17984 +ck eq get pconfig 5 0 +ck eq pinit 4096 1 22080 0 +d = pnew +ck gt d 0 +ck eq phold a 73 +ck eq pread b 0 1 73 +ck eq pfree d 0 +end +fn exhaust to void +ck eq pinit 4096 3 30272 0 +for i ulong 128 +h = mapnew neg int 1 0 4096 3 34 +ck gt h 0 +put extra i h +end +ck eq pnew neg long 75 +ck eq get pconfig 4 0 +ck eq get pconfig 5 0 +ck eq pbytes 17984 +ck eq mapdrop get extra 0 0 +a = pnew +ck gt a 0 +put pio 0 42 +ck eq pwrite a 0 1 a +ck eq phold a 0 +put pio 0 43 +ck eq pwrite a 0 1 neg long 75 +ck eq get pconfig 5 2 +ck eq get pconfig 4 1 +ck eq pread a 0 1 0 +ck eq get pio 0 42 +ck eq mapdrop get extra 1 0 +put pio 0 43 +b = pwrite a 0 1 +ck gt b 0 +ck ne b a +ck eq get pconfig 5 2 +ck eq get pconfig 4 2 +ck eq pread a 0 1 0 +ck eq get pio 0 42 +ck eq pread b 0 1 0 +ck eq get pio 0 43 +ck eq pfree a 0 +ck eq pfree b 0 +for i ulong 126 +ck eq mapdrop get extra add i 2 0 +end +ck eq pbytes 17984 +end +fn quota to void +ck eq pinit 4096 3 26176 0 +a = pnew +b = pnew +ck gt a 0 +ck gt b 0 +ck eq pnew neg long 75 +ck eq phold a 0 +put pio 0 77 +ck eq pwrite a 0 1 neg long 75 +ck eq get pconfig 5 3 +ck eq get pconfig 4 2 +ck eq pbytes 26176 +ck eq pread a 0 1 0 +ck eq get pio 0 0 +ck eq pfree b 0 +put pio 0 77 +c = pwrite a 0 1 +ck gt c 0 +ck ne a c +ck eq get pconfig 5 2 +ck eq get pconfig 4 2 +ck eq pfree a 0 +ck eq pfree c 0 +ck eq pbytes 17984 +ck eq pinit 4096 1 22079 0 +ck eq pnew neg long 75 +ck eq get pconfig 4 0 +ck eq pbytes 17984 +end +fn refcap to void +ck eq pinit 4096 2 26176 0 +a = pnew +ck gt a 0 +for i ulong 1048575 +ck eq phold a 0 +end +ck eq get pconfig 5 1048576 +ck eq phold a 75 +ck eq pnew neg long 75 +put pio 0 99 +ck eq pwrite a 0 1 neg long 75 +ck eq pread a 0 1 0 +ck eq get pio 0 0 +for i ulong 1048576 +ck eq pfree a 0 +end +ck eq get pconfig 5 0 +ck eq pbytes 17984 +end +fn lastgen to void +ck eq pinit 4096 1 22080 0 +put pgens 0 72057594037927934 +a = pnew +ck eq a long 9223372036854775681 +ck eq phold a 0 +ck eq pfree a 0 +ck eq pfree a 0 +ck eq pnew neg long 75 +ck eq pinit 8192 1 26176 0 +ck eq pnew neg long 75 +ck eq pfree a 73 +ck eq pinit 4096 2 26176 0 +b = pnew +ck gt b 0 +ck eq and ulong b 127 2 +ck eq pfree b 0 +end +fn main to int +chunk 4096 +chunk 8192 +chunk 12288 +chunk 24576 +chunk 65536 +exhaust +refcap +quota +lastgen +printnum get checks 0 +put pio 0 10 +n = write 1 pio 0 1 +printnum get checks 1 +put pio 0 10 +n = write 1 pio 0 1 +if ne get checks 1 0 +ret 1 +end +ret 0 +end diff --git a/native/state_reuse/pages-quota.om b/native/state_reuse/pages-quota.om new file mode 100644 index 00000000..2345e71b --- /dev/null +++ b/native/state_reuse/pages-quota.om @@ -0,0 +1,23 @@ +fn main to int +if ne pinit 4096 2 22080 0 +ret 2 +end +page = pnew +note Exact-fit allocation is the named assertion under test. +if le page 0 +ret 1 +end +if ne pbytes 22080 +ret 1 +end +if ne pnew neg long 75 +ret 1 +end +if ne pfree page 0 +ret 1 +end +if ne pbytes 17984 +ret 1 +end +ret 0 +end diff --git a/native/state_reuse/pages-test.om b/native/state_reuse/pages-test.om new file mode 100644 index 00000000..2fe2871b --- /dev/null +++ b/native/state_reuse/pages-test.om @@ -0,0 +1,177 @@ +note Native page accounting, lifetime, copy-on-write and rollback checks. +global pchecks ulong 2 +global phand long 64 +fn expect yes bool to void +put pchecks 0 add get pchecks 0 1 +if not yes +put pchecks 1 add get pchecks 1 1 +end +end +fn number v ulong to void +if ge v 10 +number div v 10 +end +put pio 0 uchar add rem v 10 48 +n = write 1 pio 0 1 +end +fn zeros id long bytes ulong to void +expect eq pread id 0 bytes 0 +for i ulong bytes +expect eq get pio i 0 +end +end +fn cowtest to void +expect eq pinit 4096 2 26176 0 +first = pnew +expect gt first 0 +zeros first 4096 +for i ulong 4096 +put pio i uchar rem i 251 +end +expect eq pwrite first 0 4096 first +expect eq phold first 0 +expect eq get pconfig 5 2 +expect eq pbytes 22080 +second = pnew +expect gt second 0 +expect eq pbytes 26176 +expect eq pnew neg long 75 +put pio 0 222 +expect eq pwrite first 0 1 neg long 75 +expect eq pread first 0 1 0 +expect eq get pio 0 0 +expect eq get pconfig 5 3 +expect eq pfree second 0 +expect eq pbytes 22080 +put pio 0 222 +copy = pwrite first 0 1 +expect gt copy 0 +expect ne copy first +expect eq pbytes 26176 +expect eq get pconfig 5 2 +expect eq pread first 0 4096 0 +for i ulong 4096 +expect eq get pio i uchar rem i 251 +end +expect eq pread copy 0 4096 0 +expect eq get pio 0 222 +for i ulong 4095 +expect eq get pio add i 1 uchar rem add i 1 251 +end +expect eq pinit 4096 2 26176 73 +expect eq pfree first 0 +expect eq pbytes 22080 +expect eq pread first 0 1 73 +expect eq pfree first 73 +expect eq pfree copy 0 +expect eq pbytes 17984 +expect eq get pconfig 5 0 +expect eq get pconfig 4 0 +end +fn chunks to void +expect eq pinit 12288 2 42560 0 +id = pnew +expect gt id 0 +for i ulong 8192 +put pio i uchar rem mul i 3 256 +end +expect eq pwrite id 0 8192 id +for i ulong 4096 +put pio i uchar rem add i 29 256 +end +expect eq pwrite id 8192 4096 id +expect eq phold id 0 +put pio 0 17 +changed = pwrite id 12287 1 +expect gt changed 0 +expect ne changed id +for part ulong 2 +current = id +if eq part 1 +current = changed +end +expect eq pread current 0 8192 0 +for i ulong 8192 +expect eq get pio i uchar rem mul i 3 256 +end +expect eq pread current 8192 4096 0 +for i ulong 4095 +expect eq get pio i uchar rem add i 29 256 +end +if eq part 0 +expect eq get pio 4095 28 +else +expect eq get pio 4095 17 +end +end +expect eq pfree id 0 +expect eq pfree changed 0 +end +fn life to void +expect eq pinit 4096 64 280128 0 +for i ulong 64 +id = pnew +expect gt id 0 +put phand i id +end +expect eq pnew neg long 75 +expect eq get pconfig 4 64 +for i ulong 64 +expect eq pfree get phand i 0 +end +expect eq pbytes 17984 +for i ulong 140 +old = pnew +expect gt old 0 +expect eq pfree old 0 +next = pnew +expect gt next old +expect eq phold old 73 +expect eq pwrite old 0 0 neg long 73 +expect eq pfree next 0 +end +expect eq pinit 4096 1 22080 0 +id = pnew +expect gt id 0 +expect eq phold id 0 +expect eq pwrite id 4096 0 id +expect eq pbytes 22080 +expect eq pwrite id 4096 1 neg long 65 +expect eq pwrite id 18446744073709551615 1 neg long 65 +expect eq pread id 0 8193 65 +expect eq pfree id 0 +expect eq pbytes 22080 +expect eq pfree id 0 +expect eq pbytes 17984 +note Simulate last representable generation in an empty slot to test retirement. +put pgens 0 72057594037927935 +expect eq pnew neg long 75 +expect eq pinit 4096 2 26176 0 +last = pnew +expect gt last 0 +expect eq and ulong last 127 2 +expect eq pfree last 0 +end +fn main to int +expect eq pnew neg long 73 +expect eq pbytes 17984 +expect eq pinit 0 2 26176 65 +expect eq pinit 4097 2 26176 65 +expect eq pinit 67112960 2 26176 65 +expect eq pinit 4096 0 26176 65 +expect eq pinit 4096 65 26176 65 +expect eq pinit 4096 2 17983 65 +cowtest +chunks +life +number get pchecks 0 +put pio 0 10 +n = write 1 pio 0 1 +number get pchecks 1 +put pio 0 10 +n = write 1 pio 0 1 +if ne get pchecks 1 0 +ret 1 +end +ret 0 +end diff --git a/native/state_reuse/pages.om b/native/state_reuse/pages.om new file mode 100644 index 00000000..7d05e159 --- /dev/null +++ b/native/state_reuse/pages.om @@ -0,0 +1,184 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Core718 owned host pages. No model-state composition, cache identity, disk or GPU. +note pconfig:size,slots,budget,allocated backing,livepages,total refs,initialized. +note Fixed module globals cost17984 bytes; runtime/process/model memory is separate. +global pconfig ulong 7 +global pmaps long 64 +global pgens ulong 64 +global prefs ulong 64 +global pio uchar 8192 +global pcopy uchar 8192 + +fn pslot id long to long +if le id 0 +ret neg long 1 +end +if ne get pconfig 6 1 +ret neg long 1 +end +slot = and ulong id 127 +if or eq slot 0 gt slot get pconfig 1 +ret neg long 1 +end +slot = sub slot 1 +if eq get prefs slot 0 +ret neg long 1 +end +if ne shr ulong id 7 get pgens slot +ret neg long 1 +end +ret long slot +end + +fn pinit size ulong slots ulong budget ulong to int +if ne get pconfig 4 0 +ret 73 +end +if or lt size 4096 gt size 67108864 +ret 65 +end +if ne rem size 4096 0 +ret 65 +end +if or eq slots 0 gt slots 64 +ret 65 +end +if or lt budget 17984 gt budget 1125899906842624 +ret 65 +end +put pconfig 0 size +put pconfig 1 slots +put pconfig 2 budget +put pconfig 3 0 +put pconfig 4 0 +put pconfig 5 0 +put pconfig 6 1 +ret 0 +end + +fn pbytes to ulong +ret add get pconfig 3 17984 +end + +fn pnew to long +if ne get pconfig 6 1 +ret neg long 73 +end +if ge get pconfig 5 1048576 +ret neg long 75 +end +if gt add pbytes get pconfig 0 get pconfig 2 +ret neg long 75 +end +for i ulong get pconfig 1 +if eq get prefs i 0 +if lt get pgens i 72057594037927935 +h = mapnew neg int 1 0 get pconfig 0 3 34 +if le h 0 +ret neg long 75 +end +put pmaps i h +put pgens i add get pgens i 1 +put prefs i 1 +put pconfig 3 add get pconfig 3 get pconfig 0 +put pconfig 4 add get pconfig 4 1 +put pconfig 5 add get pconfig 5 1 +ret long or shl get pgens i 7 add i 1 +end +end +end +ret neg long 75 +end + +fn phold id long to int +slot = pslot id +if lt slot 0 +ret 73 +end +if ge get pconfig 5 1048576 +ret 75 +end +put prefs ulong slot add get prefs ulong slot 1 +put pconfig 5 add get pconfig 5 1 +ret 0 +end + +fn pfree id long to int +slot = pslot id +if lt slot 0 +ret 73 +end +if eq get prefs ulong slot 1 +if ne mapdrop get pmaps ulong slot 0 +ret 74 +end +put pmaps ulong slot 0 +put pconfig 3 sub get pconfig 3 get pconfig 0 +put pconfig 4 sub get pconfig 4 1 +end +put prefs ulong slot sub get prefs ulong slot 1 +put pconfig 5 sub get pconfig 5 1 +ret 0 +end + +fn prange offset ulong count ulong to bool +if gt count len pio +ret false +end +if gt offset get pconfig 0 +ret false +end +ret le count sub get pconfig 0 offset +end + +fn pread id long offset ulong count ulong to int +slot = pslot id +if lt slot 0 +ret 73 +end +if not prange offset count +ret 65 +end +n = mapread get pmaps ulong slot offset pio 0 count +ret 0 +end + +fn pclone from ulong dest ulong to void +offset = ulong 0 +while lt offset get pconfig 0 +count = sub get pconfig 0 offset +if gt count len pcopy +count = len pcopy +end +n = mapread get pmaps from offset pcopy 0 count +n = mapwrite get pmaps dest offset pcopy 0 count +offset = add offset count +end +end + +fn pwrite id long offset ulong count ulong to long +slot = pslot id +if lt slot 0 +ret neg long 73 +end +if not prange offset count +ret neg long 65 +end +if eq count 0 +ret id +end +result = id +if gt get prefs ulong slot 1 +result = pnew +if lt result 0 +ret result +end +dest = pslot result +pclone ulong slot ulong dest +put prefs ulong slot sub get prefs ulong slot 1 +put pconfig 5 sub get pconfig 5 1 +slot = dest +end +n = mapwrite get pmaps ulong slot offset pio 0 count +ret result +end diff --git a/native/state_reuse/policy.om b/native/state_reuse/policy.om new file mode 100644 index 00000000..644dfc05 --- /dev/null +++ b/native/state_reuse/policy.om @@ -0,0 +1,294 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Core718: bounded cost selection only. No allocation, restore or model execution. +note Caller must authenticate complete snapshots and retain them through commit. +global rcontrol ulong 10 +global rexpect ulong 32 +global rident ulong 512 +global rrows ulong 352 +global rreason ulong 16 +global rresult ulong 5 +global robs ulong 7 + +fn rfield row ulong field ulong to ulong +ret get rrows add mul row 22 field +end + +fn rcost row ulong to ulong +v = ulong 0 +for p ulong 7 +v = add v rfield row add p 8 +end +ret v +end + +fn rmemory row ulong to int +total = get rcontrol 6 +for p ulong 5 +v = rfield row add p 15 +if gt v 1125899906842624 +ret 75 +end +total = add total v +end +if gt total get rcontrol 5 +ret 75 +end +ret 0 +end + +fn rprofile row ulong to int +for d ulong 8 +n = ulong 0 +for j ulong 4 +i = add mul d 4 j +v = get rexpect i +n = or n v +if ne v get rident add mul row 32 i +ret 69 +end +end +if eq n 0 +ret 69 +end +end +if lt rfield row 6 get rcontrol 4 +ret 74 +end +if gt rfield row 6 1000000 +ret 65 +end +stamp = rfield row 7 +now = get rcontrol 2 +if gt stamp now +ret 74 +end +if gt sub now stamp get rcontrol 3 +ret 74 +end +for p ulong 7 +if gt rfield row add p 8 1000000000000 +ret 65 +end +end +if eq rcost row 0 +ret 74 +end +ret 0 +end + +fn rvalid row ulong to int +if ne rfield row 0 1 +ret 77 +end +kind = rfield row 1 +if eq row 0 +if ne kind 0 +ret 65 +end +if ne rfield row 2 0 +ret 65 +end +if ne rfield row 3 0 +ret 65 +end +if ne rfield row 4 0 +ret 65 +end +else +if lt kind 1 +ret 65 +end +if gt kind 2 +ret 65 +end +if eq rfield row 2 0 +ret 65 +end +if ne rfield row 5 31 +ret 76 +end +if ne rfield row 20 1 +ret 76 +end +if ne rfield row 21 1 +ret 76 +end +if eq rfield row 3 0 +ret 76 +end +if gt rfield row 4 1 +ret 76 +end +end +if gt rfield row 3 get rcontrol 9 +ret 76 +end +if gt add rfield row 3 rfield row 4 get rcontrol 9 +ret 76 +end +status = rmemory row +if ne status 0 +ret status +end +ret rprofile row +end + +fn rconfig to int +count = get rcontrol 0 +if lt count 1 +ret 65 +end +if gt count 16 +ret 65 +end +if gt get rcontrol 5 1125899906842624 +ret 65 +end +if gt get rcontrol 6 get rcontrol 5 +ret 75 +end +if lt get rcontrol 4 1 +ret 65 +end +if gt get rcontrol 4 1000000 +ret 65 +end +if gt get rcontrol 7 1000000000000 +ret 65 +end +if gt get rcontrol 8 1000000 +ret 65 +end +if gt get rcontrol 9 131072 +ret 65 +end +note Duplicate enabled snapshot identities make the hysteresis anchor ambiguous. +for i ulong count +if eq rfield i 0 1 +for j ulong i +if eq rfield j 0 1 +if eq rfield i 2 rfield j 2 +ret 65 +end +end +end +end +end +ret 0 +end + +fn rselect to int +note Clear all output on every attempt, including failures. +for i ulong 5 +put rresult i 0 +end +for i ulong 16 +put rreason i 77 +end +base = rconfig +if ne base 0 +ret base +end +count = get rcontrol 0 +base = rvalid 0 +put rreason 0 ulong base +if ne base 0 +note Unknown/stale estimates fall back to fresh work, with no claimed prediction. +if eq base 74 +put rresult 4 1 +ret 0 +end +ret base +end +anchor = ulong 0 +for i ulong count +status = rvalid i +put rreason i ulong status +if eq status 0 +if eq rfield i 2 get rcontrol 1 +if lt rcost i rcost 0 +anchor = i +end +end +end +end +best = anchor +for i ulong count +if eq get rreason i 0 +if lt rcost i rcost best +best = i +else +if eq rcost i rcost best +note Equal-cost alternatives never displace the current anchor. +if ne best anchor +if lt rfield i 1 rfield best 1 +best = i +else +if eq rfield i 1 rfield best 1 +if lt rfield i 2 rfield best 2 +best = i +end +end +end +end +end +end +end +end +saved = sub rcost anchor rcost best +note Sum of seven bounded phases times one million fits unsigned 64 bits. +margin = add get rcontrol 7 div mul rcost anchor get rcontrol 8 1000000 +if le saved margin +best = anchor +end +put rresult 0 best +put rresult 1 rcost best +put rresult 2 sub rcost 0 rcost best +put rresult 3 1 +ret 0 +end + +fn rcalib row ulong stamp ulong to int +note Update only an already admitted identity. Caller supplies real elapsed phases. +base = rconfig +if ne base 0 +ret base +end +if ge row get rcontrol 0 +ret 65 +end +if ge row 16 +ret 65 +end +status = rvalid row +if ne status 0 +ret status +end +if lt stamp rfield row 7 +ret 74 +end +if gt stamp get rcontrol 2 +ret 74 +end +total = ulong 0 +for p ulong 7 +v = get robs p +if gt v 1000000000000 +ret 65 +end +total = add total v +end +if eq total 0 +ret 74 +end +for p ulong 7 +v = div add add mul rfield row add p 8 7 get robs p 7 8 +put rrows add mul row 22 add p 8 v +end +n = rfield row 6 +if lt n 1000000 +put rrows add mul row 22 6 add n 1 +end +put rrows add mul row 22 7 stamp +ret 0 +end diff --git a/native/state_reuse/tests.om b/native/state_reuse/tests.om new file mode 100644 index 00000000..d21e2868 --- /dev/null +++ b/native/state_reuse/tests.om @@ -0,0 +1,235 @@ +note SPDX-License-Identifier: AGPL-3.0-only +global checks ulong 1 +global failures ulong 1 +fn number value ulong to void +b = new uchar 32 0 +n = ulong 0 +v = value +while ge v 10 +put b n uchar add rem v 10 48 +n = add n 1 +v = div v 10 +end +put b n uchar add v 48 +n = add n 1 +while gt n 0 +n = sub n 1 +w = write 1 b n 1 +end +put b 0 10 +w = write 1 b 0 1 +end +fn check actual ulong expected ulong to void +put checks 0 add get checks 0 1 +if ne actual expected +put failures 0 add get failures 0 1 +end +end +fn setfield row ulong field ulong value ulong to void +put rrows add mul row 22 field value +end +fn fixture to void +for i ulong 352 +put rrows i 0 +end +for i ulong 10 +put rcontrol i 0 +end +put rcontrol 0 3 +put rcontrol 2 1000 +put rcontrol 3 100 +put rcontrol 4 5 +put rcontrol 5 10000 +put rcontrol 6 1000 +put rcontrol 9 1000 +for i ulong 32 +put rexpect i add i 1 +end +for r ulong 16 +for i ulong 32 +put rident add mul r 32 i get rexpect i +end +end +for r ulong 3 +setfield r 0 1 +setfield r 1 r +setfield r 2 r +setfield r 3 mul r 200 +setfield r 5 31 +setfield r 6 5 +setfield r 7 950 +setfield r 13 sub 1000 mul r 300 +setfield r 15 1000 +setfield r 20 1 +setfield r 21 1 +end +end +fn selected expected ulong to void +check ulong rselect 0 +check get rresult 0 expected +end +fn main to int +fixture +selected 2 +check get rresult 1 400 +check get rresult 2 600 +note Disk has a longer prefix but actual read cost loses against RAM. +setfield 2 9 400 +selected 1 +setfield 1 13 1100 +selected 2 +setfield 2 9 700 +selected 0 +note Every cost stage must influence the decision. +for phase ulong 7 +fixture +setfield 2 add phase 8 1200 +selected 1 +end +note Every allocation class counts, including transient and shared references. +for phase ulong 5 +fixture +setfield 2 add phase 15 9001 +selected 1 +check get rreason 2 75 +end +fixture +setfield 2 15 9000 +selected 2 +setfield 2 16 1 +selected 1 +note Every identity word, not a single fast hash, must match. +for i ulong 32 +fixture +put rident add 64 i 0 +selected 1 +check get rreason 2 69 +end +for i ulong 8 +fixture +for j ulong 4 +put rexpect add mul i 4 j 0 +put rident add mul i 4 j 0 +end +check ulong rselect 69 +check get rresult 3 0 +end +note Stale reuse candidates are skipped; stale baseline disables cost selection. +fixture +setfield 2 7 899 +selected 1 +check get rreason 2 74 +setfield 0 7 899 +selected 0 +check get rresult 3 0 +check get rresult 4 1 +fixture +setfield 2 7 1001 +selected 1 +fixture +setfield 2 6 4 +selected 1 +fixture +setfield 2 5 30 +selected 1 +check get rreason 2 76 +fixture +setfield 2 20 0 +selected 1 +fixture +setfield 2 21 0 +selected 1 +fixture +setfield 2 3 1001 +selected 1 +fixture +setfield 2 3 1000 +setfield 2 4 1 +selected 1 +fixture +setfield 2 4 2 +selected 1 +fixture +setfield 2 3 999 +setfield 2 4 1 +selected 2 +note Switching requires strictly more than the absolute plus relative margin. +fixture +put rcontrol 1 1 +put rcontrol 7 300 +selected 1 +put rcontrol 7 299 +selected 2 +put rcontrol 7 0 +put rcontrol 8 500000 +selected 1 +setfield 2 13 300 +selected 2 +note An invalid current snapshot cannot be retained by hysteresis. +setfield 1 20 0 +selected 2 +note Duplicate stable IDs refuse instead of depending on enumeration order. +fixture +setfield 2 2 1 +check ulong rselect 65 +check get rresult 3 0 +fixture +put rcontrol 0 17 +check ulong rselect 65 +fixture +put rcontrol 6 10001 +check ulong rselect 75 +fixture +setfield 2 8 18446744073709551615 +selected 1 +fixture +setfield 2 15 18446744073709551615 +selected 1 +note Calibration refuses bad observations atomically and uses ceil EWMA. +fixture +for p ulong 7 +put robs p 0 +end +put robs 5 800 +check ulong rcalib 2 1000 0 +check rfield 2 13 450 +check rfield 2 6 6 +check rfield 2 7 1000 +put robs 6 18446744073709551615 +check ulong rcalib 2 1000 65 +check rfield 2 13 450 +check rfield 2 6 6 +check ulong rcalib 2 999 74 +check ulong rcalib 16 1000 65 +fixture +put rcontrol 6 18446744073709551615 +check ulong rcalib 2 1000 75 +check rfield 2 13 400 +note Exhaustive independent choice oracle on synthetic fresh/RAM/disk costs. +for a ulong 20 +for b ulong 20 +for c ulong 20 +fixture +setfield 0 13 add a 1 +setfield 1 13 add b 1 +setfield 2 13 add c 1 +want = ulong 0 +if lt b a +want = 1 +end +if lt c a +if lt c b +want = 2 +end +end +selected want +end +end +end +number get checks 0 +number get failures 0 +if ne get failures 0 0 +exit 1 +end +ret 0 +end diff --git a/tests/gates/run.sh b/tests/gates/run.sh index cb63fb4a..e14adddd 100755 --- a/tests/gates/run.sh +++ b/tests/gates/run.sh @@ -168,6 +168,25 @@ case "$step" in pin aienos aienos "$(awk 'NF && $1 !~ /^#/ {print $1; exit}' "$PINS/omega/aienos.lock")" bash scripts/test-linked-compose.sh "$PINS/omega" "$PINS/physics" "$PINS/aienos" ;; + native-state-reuse) + # Explicit unmerged PR676 compiler dependency, separate from omega.lock. + # Offline pinned sibling only; no fallback to another compiler/profile. + omega_native_sha="$(tr -d '[:space:]' < native/state_reuse/compiler.lock)" + [[ "$omega_native_sha" =~ ^[0-9a-f]{40}$ ]] || exit 3 + pin omega-reuse-native omega "$omega_native_sha" + compiler_root="$(cd "$PINS/omega-reuse-native" && pwd)" + (cd "$compiler_root" && sha256sum -c "$ROOT/native/state_reuse/compiler.sha256") || exit 3 + [ -x "$compiler_root/seed/out/omc" ] || exit 3 + mkdir -p "$TARGET" + stage="$(mktemp -d "$TARGET/reuse-check.XXXXXX")" + stage="$(cd "$stage" && pwd)" + mkdir -p "$stage/native" "$stage/build" + cp -R native/state_reuse "$stage/native/state_reuse" + timeout --kill-after=2 30 "$compiler_root/seed/out/omc" < "$stage/native/state_reuse/gate.om" > "$stage/gate.elf" + chmod 700 "$stage/gate.elf" + cd "$stage" + exec "$stage/gate.elf" "$compiler_root/seed/out/omc" + ;; # No hosted mirror: GitHub has no GB10. SC-GB10-SERVE-CHAT, the GPU receipt an Alpha needs # (verify-bundle --require-full, NO_GPU_RECEIPT). Same pinned sources as linked-compose, from the # siblings, offline; scripts/pins.sh --gpu reuses them and writes the env.sh install.sh sources. diff --git a/tests/gates/sc-native-state-reuse.gate b/tests/gates/sc-native-state-reuse.gate new file mode 100644 index 00000000..55b2b2e7 --- /dev/null +++ b/tests/gates/sc-native-state-reuse.gate @@ -0,0 +1,21 @@ +# Native host qualification for issue718. No model-state or hardware claim. +gate: SC-NATIVE-STATE-REUSE +manifest_version: 2 +owner: aien-sovereign-core +requires: + - host +inputs: + - native/state_reuse/ + - evidence/state-reuse-718/ + - tests/gates/run.sh + - tests/gates/sc-native-state-reuse.gate +run: + exec: tests/gates/run.sh + args: ["native-state-reuse"] +expects: + exit: 0 + observe: ["reuse_groups == 7"] + verdict: PASS +timeout: 5m +exactness: EXACT +cache_scope: machine ```