From 32af495759065feb542c9460dfe63ecbb2e05c81 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Wed, 28 Oct 2026 07:56:09 -0500 Subject: [PATCH 1/2] feat(learn53): bind canonical joint MoE operation instances --- docs/learn53/CONTRACT.md | 245 ++++++++++++ native/learn53/moe-closure.lock | 15 + native/learn53/moe-closure.om | 578 +++++++++++++++++++++++++++ tests/learn53/moe-export.om | 38 ++ tests/learn53/moe-fixtures.om | 151 +++++++ tests/learn53/moe-host-evidence.json | 203 ++++++++++ tests/learn53/moe-unit.om | 283 +++++++++++++ 7 files changed, 1513 insertions(+) create mode 100644 native/learn53/moe-closure.lock create mode 100644 native/learn53/moe-closure.om create mode 100644 tests/learn53/moe-export.om create mode 100644 tests/learn53/moe-fixtures.om create mode 100644 tests/learn53/moe-host-evidence.json create mode 100644 tests/learn53/moe-unit.om diff --git a/docs/learn53/CONTRACT.md b/docs/learn53/CONTRACT.md index 19e5d1cc..21835583 100644 --- a/docs/learn53/CONTRACT.md +++ b/docs/learn53/CONTRACT.md @@ -70,3 +70,248 @@ Native test construction follows the same concatenation with `tests/learn53/fixt ## Acceptance still pending Omega653 framework attachment and complete attempt/budget record; independent split custody/deduplication/sealing; #15 seeded host qualification; #16 FP/numerical policy migration; #17 real native full-cost collector/paired baselines; one measured hot operator; #10/#35 independent binary/launch admission; #24 runtime memory/session integration; GB10 and full consuming graph; independent judge and production release. No speed reward, candidate generation, training, proof or default selection occurs in this slice. Hardware/consumer tests are NOT_RUN, not NO-GO experiments. + +## Joint resident MoE operation-instance binding v1 + +`native/learn53/moe-closure.om` extends this existing task/evaluator custody +boundary for #35/#53/#159/#26/#17. It is not another benchmark, task catalog, +artifact registry, receipt validator, signer or source of qualification authority. +Its immutable dependencies are in `moe-closure.lock`. The unchanged +`omega653.lock` and `omega-adapter.om` still own public CUL1 observation and +attempt accounting. No MoE numerical oracle or full-cost measurement is +invented here. The caller obtains those outcomes from the existing independent +#16/#17/#53 owners and retains their actual result provenance. + +### Subject versus live instance + +There are two deliberately distinct identities: + +1. The independently frozen **approved joint subject**, already present in + selector `q18..21` and row37..40. One owner-resolved subject binds the approved + complete graph, its alternatives and exact allowed GU/DN partners. It remains + invariant across incumbent/alternative comparison. Equal digests are necessary + metadata, not proof of approved custody. +2. The **operation-instance SHA256** returned by `mc_bind`/`mc_bindctx`, binding + one exact selected pair and one retained live allocation/session snapshot. + It is consumption-time metadata, never a replacement for q18, workload, + policy, applicability or qualification identity. New allocations can change + it without rewriting immutable qualification records. + +All embedded identity groups are independently frozen inputs. None is defined +as a hash of this instance wire or of a receipt containing its instance digest. +Terminal result custody is outside the preimage. In particular applicability +and qualification-context groups must not be made recursively self-referential. + +The expected wire belongs to the existing immutable owner-resolved bundle. +The observed wire is independently assembled from actual selected artifacts, +actual canonical Quant/Composer metadata and launch, and retained allocation +owner state under the existing graph/session lock. Copying expected metadata +into observed metadata does not establish observation. Allocation ownership, +directory/tensor coherence, immutable template validation, protected evaluator +execution and authentication remain their existing owners' obligations. + +### One canonical wire + +Capacity is `uchar16384`. Exact active length is11264 bytes. Integers are +unsigned64, explicitly little-endian. There are no native structs or alternate +encodings. Byte0..1023 contains scalar128. Byte1024..3071 contains64 raw SHA256 +groups. Byte3072..11263 contains128 ordered window rows of eight LE64 cells. +Unused window cells, reserved scalars and bytes11264..16383 must be zero. +Both expected and observed descriptors are validated before exact comparison. +Even two byte-equal malformed descriptors refuse. + +| Scalar cell | Meaning and required value | +| --- | --- | +|0,1,2|Version1, domain159, exact active length11264| +|3,4|Complete window count1..128, selected zero-based ordinal less than count| +|5,6,7,8|Total tokens1..128; selected window token0, token count and R| +|9,10|H2048, EI512| +|11,12,13,14,15|Routed expert count256, routed picks8, contributions9, shared expert256, incumbent window capacity128| +|16|Actual router byte stride, u32 range, multiple16, at least144| +|17,18,19,20|Actual session epoch (zero valid), exact admitted profile121, live buffer-owner generation, frozen lifecycle identity (nonzero)| +|21,22|Layer index, tensor/directory owner generation| +|23|Alias policy0; exact permitted lifetimes/aliases also bound by group58| +|24..31|Effects, router, stable ordering, permutation, SwiGLU, combine, numerical, completion revisions: each1| +|32..63|Resources0..7, four cells each as below| +|64..72|Explicit original contribution order0,1,2,3,4,5,6,7,8. Shared slot8 is mandatory, including zero-weight contributions| +|73,74|Full map entry capacity exactly total_tokens*9+8; segment capacity128 including trailing zero descriptors| +|75,76|flush_each0; exact original head8 mode0 or1| +|77,78,79|Layer count positive; last-layer flag exactly `(layer+1==layer_count)`; incumbent combine variant1| +|80..111|Resources8..15, four cells each| +|112..115|GU input mapX1/output mapY2; DN input mapY2/output mapY2| +|116..121|Map padding8; duplicate-preserving sort1, mandatory shared1, barrier-reuse policy1, window-local maps1, original weight-slot policy1| +|122,123|Exact GU and DN final code byte lengths, positive/multiple16/at most16384| +|124..127|Reserved0| + +Each resource is `{baseVA, actual_allocation_extent_bytes, owner_generation, +row_or_element_stride_bytes}`. All VAs are nonzero/eight-byte aligned; extents +must cover their required full-operation footprint and not wrap the address +domain; resource generation matches scalar19 except tensor resources14/15 +which match scalar22. Ownership is not inferred from alignment or a claimed VA. + +|Resource|Role|Stride| +|---|---|---| +|0,1,2,3|Router IDs, original weights, GU directory, DN directory|Actual scalar16| +|4,5|GU/DN Seg32 descriptors|32| +|6,7|X/Y maps|4| +|8|XP activation|H*4| +|9|GU output|9*EI*8| +|10,11|SwiGLU activation and permuted activation|9*EI*4| +|12|DN contribution output|9*H*4| +|13|Original combine output|H*4| +|14,15|Corresponding GU/DN tensor allocations|Actual positive physical stride, interpreted by canonical Quant/directory owner| + +The existing `moe_windows` is the only window planner. `mc_windows` compares the +entire table against its exact output, including ragged final rows and byte +offsets; arbitrary contiguous repartitions are not accepted. Each row is +`{token0,tokens,R,XPbytes,GUbytes,ACTbytes,DNbytes,routerbytes}`. Selected scalar6..8 +must match that exact ordinal. GROUP uses window-local X=t,Y=t*9+slot; global +token0 is represented by shifted bases, never added twice to map values. +Both GU/DN use M=R and R descriptors including zero-count trailing descriptors. +The existing `moe_alias` independently checks GROUP read/write and write/write +bounding spans at the selected offsets. Broader graph alias/lifetime rules +remain the owner-validated policy bound in group58 and the retained snapshot. + +Runtime router ID/weight values are device-produced inputs, **not host readback +or code identity**. The producer/domain/ABI, live allocations/generations and +paired tensor directories are bound. Routed IDs must remain in0..255; duplicate +expert picks retain distinct original slots; shared256/slot8 remains explicit. +The live owner checks table/directory coherence, not this host byte predicate. +Weight contents do not become code identity unless they actually alter emitted +code. Tensor/checkpoint identities remain separate. + +### SHA256 group dictionary + +Every group is required and nonzero. These are raw32-byte digests, not printed +hex or caller-selected short IDs. + +|Groups|Ordered identities| +|---|---| +|0..8|Model, config, checkpoint, exact source, compiler, encoder source, semantic spec, independent evaluator executable/source closure, numerical contract| +|9|Router semantic contract| +|10..21|GROUP code/launch, router code/launch, PERM_XO code/launch, SwiGLU code/launch, PERM_ACT code/launch, combine code/launch| +|22..29|GU canonical1152, final code, launch256, existing full manifest, parameter ABI, immutable cbank template, zero-VA QMD template, canonical Quant384| +|30..37|DN identities in the same order| +|38..43|Workload equivalence, approved joint subject, policy, measurement protocol, GU incumbent canonical artifact, GU applicability| +|44|Independently frozen joint qualification-context/bundle identity| +|45,46,47|GU/DN tensor-directory identities, live allocation-owner snapshot identity| +|48..52|Lifecycle protocol, router ABI/domain, permutation tables, barrier dependency DAG, original scale/head8/last-layer combine protocol| +|53,54|DN incumbent canonical artifact, DN applicability (may differ from GU)| +|55..60|Evaluation protocol, paired transformation lineage, original quant/numerical profile, alias/lifetime policy, completion/recovery policy, complete router allowed-domain contract| +|61,62,63|GU operation semantic digest, DN operation semantic digest, evaluator result-custody protocol| + +Group44 is an **input context identity**, not a new trusted-record claim. The +parent alone determines whether an existing independent qualification bundle is +accepted. Host fixture hashes never populate production records. No gate masks, +qualification bits or signed receipts are created or modified by these APIs. + +### Integration API + +All functions are native seeded Omega, nonconcurrent fixed-array calls. Exported +roots return `long`, supported by existing omega-bridge ABI1; no global scratch. + +``` +mc_pack(scalars view ulong128, hashes view uchar2048, + windows view ulong1024, wire edit uchar16384) -> long +mc_valid(wire view uchar16384, n ulong) -> long +mc_bind(expected view uchar16384, observed view uchar16384, n ulong, + instanceSHA edit uchar32) -> long +mc_context(wire view uchar16384, q view ulong64, + selectedRow view ulong64, role ulong) -> long +mc_bindctx(expected view uchar16384, observed view uchar16384, + q view ulong64, selectedRow view ulong64, + role ulong, instanceSHA edit uchar32) -> long +mc_blob(wire view uchar16384, canonical view uchar4096, + code view uchar16384, codeLength ulong, + launch view uchar256, role ulong) -> long +mc_custody(wire view uchar16384, retainedInstanceSHA view uchar32, + frozenExecutorContext view ulong32, + observedExecutorContext view ulong32) -> long +``` + +Role0 is GU; role1 DN. Other roles refuse. `mc_context` requires selected family3, +binds q3..6/row17..20 and six q14/18/22/26/30/34 digest groups against +row33/37/41/45/49/53 and this wire. DN uses groups53/54 for its incumbent and +applicability, not GU42/43. It also binds selected row21..24 artifact, +row25..28 launch, row29..32 bundle and row57..60 final code to the correct +paired role. It does **not** run selection, accept row gate masks as authority, +authenticate records, or make an ineligible row eligible. + +`mc_bindctx` is the one combined integration root: clear output, check context, +validate both wires, exact-compare bytes, hash actual active11264 with the +unchanged cache SHA256. Failure clears all32 digest bytes. `mc_pack` is the +only field serializer; failure clears the whole output. Status0 means only +binding succeeded;1 malformed/canonicality,2 unsupported semantic/table +contract,3 resource extent/stride/generation/alias,4 unequal valid wires, +5 owner context/custody mismatch,6 canonical payload binding refused. + +`mc_blob` uses unchanged Composer validation/launch validation and unchanged +cache SHA256 over actual canonical1152/codeLength/launch256 bytes. It checks +role-specific shapes, exact code lengths, compiler/encoder/spec and operation +semantic digests, canonical embedded code/launch digests, launch15..26 ABI/cbank/ +QMD digests and Quant384. The existing full manifest and actual ABI/template +payload validation remain the artifact owner's admission API, never replaced +by matching claimed hashes. Mapped family3 remains refused by the pinned +Composer; this component does not weaken that gate. + +`mc_custody` extends #53's result identity boundary without accepting a claimed +PASS or outcome. The32 executor context cells are version1, evidence class1 +HOST_ONLY, instanceSHA4, evaluatorSHA4, sourceSHA4, result-protocolSHA4, +approved-joint-subjectSHA4, qualification-contextSHA4, reserved6zero. All SHA +limbs are explicitly LE64. Frozen and observed contexts must match exactly and +match the validated wire and retained instance SHA. Class2/device claims +refuse even when the two supplied arrays agree. This is not a protected executor +or numerical result evaluator; same-process hostile callers remain outside its +custody guarantee, as for `aobserve`/`aattempt`. + +The existing integration owner must select once, resolve by immutable ordinal, +independently collect actual metadata/payloads, validate actual manifest/ABI/ +templates and paired graph subject, call the byte/context predicates, and retain +that exact selection and snapshot through existing record/submit/completion +leases. No second shape-based lookup or independently selected DN is permitted. +Do not copy the instance hash into q/row identities or overwrite accepted +qualification history. Production record count remains zero until real +independent accepted hardware/full-workload records exist. + +### Host controls and remaining gates + +`tests/learn53/moe-fixtures.om` is explicitly synthetic HOST_ONLY metadata. +`moe-unit.om` checks every scalar and SHA role, every window cell, reserved +capacity, invalid length, identical malformed wires, GU/DN role mixing, all +selector identity limbs, session context, stale digest clearing, serializer +roundtrip/refusal clearing and executor-custody substitution. Independent literal +one-token and ragged two-window oracles are not a second planner. `moe-export.om` +emits the one-token wire/hash for mode0/1, or the15-token two-window wire/hash +for mode2/3. Read-only external `sha256sum` independently checks both results. + +The mounted Wolfram evaluator verified the source-derived layout, without +warnings. These are synthetic layout calculations, not measurements: + +``` +WolframLanguageEvaluator: +{Expand[32*(9*t)],9*n+8,3072+8*i,128*8+64*32+128*8*8} +-> {288*t,8+9*n,3072+8*i,11264} + +WolframLanguageEvaluator: +({#[[1]],#[[2]],9 #[[2]],#[[1]]2048 4,#[[1]]9 512 8, + #[[1]]9 512 4,#[[1]]9 2048 4,#[[1]]256}& /@ {{0,14},{14,1}}) +-> {{0,14,126,0,0,0,0,0},{14,1,9,114688,516096,258048,1032192,3584}} +``` + +`tests/learn53/moe-host-evidence.json` records the actual native controls, +external SHA oracle, verifier mutants, compiler/source identities and limits. +The three verifier mutants remove exact wire comparison, result-custody +comparison and selected paired-artifact comparison respectively; each must +compile successfully and make the unit executable fail. + +To construct either native test: export the exact Git objects listed in +`moe-closure.lock`, verify each source SHA, concatenate in listed order followed +by `native/learn53/moe-closure.om`, `tests/learn53/moe-fixtures.om`, then +`moe-unit.om` or `moe-export.om`. Compile with the lock's independently pinned +compiler, never execute failed/stale output. No production build/runtime, +source registry or new host-language implementation is introduced. + +Actual protected evaluator execution, independent finite-FP/numerical/model +quality results, measured full-cost comparison, accepted hardware receipts, +full consuming graph qualification and GPU execution are **NOT_RUN** here. +Matching byte metadata is not a hardware-qualified receipt or graph authority. diff --git a/native/learn53/moe-closure.lock b/native/learn53/moe-closure.lock new file mode 100644 index 00000000..35a82382 --- /dev/null +++ b/native/learn53/moe-closure.lock @@ -0,0 +1,15 @@ +{ + "schema": "cudapp-learn53-moe-closure-source-lock-v1", + "repository": "https://github.com/aien-dev/CUDApp.git", + "baseline": "b759afc3f5e46f152ffb06b39882ffa28cacaf96", + "compiler": {"repository": "https://github.com/aien-dev/omega-mv.git", "revision": "e5b32567a7aff3ce594e3254a622a846a6cd190b", "sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f"}, + "sources": [ + {"revision": "fe25929ce71b11703eafa72395df2dd495aa61f2", "path": "om/quant/quant.om", "sha256": "44bce96f3c274401e19a71b835814d69caf2bea8c2b1f4f43616c7c121232f09"}, + {"revision": "2e93f998b70852abcd425f8865d842a05dad76ea", "path": "om/components/realize.om", "sha256": "2edff07a46c79c39a264dde9e5d6dfa02ed2f6dda677da8cc8a178f60c9a1c9d"}, + {"revision": "693464cfcff678a9278fe4586f8a24b07ce45fb2", "path": "om/cache/digest.om", "sha256": "b0e49da9e6c146da0d040476d84bff8d93486c563e19ef8f1d731b1ffb15c051"}, + {"revision": "966213fe14e37f39c94e4b57f140b19dd78af210", "path": "om/moe/moe_windows.om", "sha256": "b7aef37b135a1ffbe5ba32fd54d9c619b0552c1b87885afbde71c9cc1c1293b7"}, + {"revision": "966213fe14e37f39c94e4b57f140b19dd78af210", "path": "om/moe/moe_group.om", "sha256": "2296030f59ae8aabb4b1dd37e8c05fb09bf5e02e8ef5d71f408f4aef11966170"} + ], + "construction": "export exact Git objects, verify each source digest, concatenate in listed order then moe-closure.om; do not vendor another implementation", + "qualification": "HOST_ONLY synthetic controls; actual accepted hardware receipts absent; no production registration" +} diff --git a/native/learn53/moe-closure.om b/native/learn53/moe-closure.om new file mode 100644 index 00000000..6180561b --- /dev/null +++ b/native/learn53/moe-closure.om @@ -0,0 +1,578 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note #35/#53/#159 joint operation instance binding, NOT qualification or authentication. +note Dependencies: authoritative moe_windows/moe_alias, compose_check/launchread and kc SHA. +note Canonical LE64 scalar128, SHA256 groups64, ordered window LE64 cells1024. +note Exact active11264 in capacity16384; all reserved/inactive/capacity bytes zero. +fn mc_word b view uchar 16384 i ulong to ulong +v = ulong 0 +for j ulong 8 +v = or v shl ulong get b add mul i 8 j mul j 8 +end +ret v +end +fn mc_put b edit uchar 16384 i ulong v ulong to void +for j ulong 8 +put b add mul i 8 j uchar and shr v mul j 8 255 +end +end +fn mc_hash b view uchar 16384 i ulong h view uchar 32 to bool +if ge i 64 +ret false +end +for j ulong 32 +if ne get b add add 1024 mul i 32 j get h j +ret false +end +end +ret true +end +fn mc_base i ulong to ulong +if lt i 8 +ret add 32 mul i 4 +end +ret add 80 mul sub i 8 4 +end +fn mc_need b view uchar 16384 i ulong to ulong +n = mc_word b 5 +if lt i 4 +width = ulong 144 +if lt i 2 +width = 32 +end +ret add mul sub n 1 mc_word b 16 width +end +if lt i 6 +ret mul mc_word b 74 32 +end +if lt i 8 +ret mul mc_word b 73 4 +end +if eq i 8 +ret mul mul n mc_word b 9 4 +end +if eq i 9 +ret mul mul mul n 9 mc_word b 10 8 +end +if lt i 12 +ret mul mul mul n 9 mc_word b 10 4 +end +if eq i 12 +ret mul mul mul n 9 mc_word b 9 4 +end +if eq i 13 +ret mul mul n mc_word b 9 4 +end +note Tensor extents come from immutable tensor/directory owner, not a guessed packing. +ret 1 +end +fn mc_ranges b view uchar 16384 to long +r = new ulong 16 0 +for i ulong 16 +p = mc_base i +va = mc_word b p +size = mc_word b add p 1 +if or eq va 0 ne rem va 8 0 +ret 3 +end +if lt size mc_need b i +ret 3 +end +if gt va sub ulong 18446744073709551615 size +ret 3 +end +wantgen = mc_word b 19 +if ge i 14 +wantgen = mc_word b 22 +end +if ne mc_word b add p 2 wantgen +ret 3 +end +if eq mc_word b add p 3 0 +ret 3 +end +end +note GROUP's existing span/alias checker is authoritative; no alternate overlap algorithm. +put r 0 add mc_word b 32 mul mc_word b 6 mc_word b 16 +put r 1 add mc_word b 40 mul mc_word b 6 mc_word b 16 +put r 2 add mc_word b 44 mul mc_word b 6 mc_word b 16 +put r 3 mc_word b 48 +put r 4 mc_word b 52 +put r 5 mc_word b 56 +put r 6 mc_word b 60 +put r 7 mc_word b 16 +put r 8 mc_word b 7 +if moe_alias r +ret 3 +end +for i ulong 4 +if ne mc_word b add mc_base i 3 mc_word b 16 +ret 3 +end +end +for i ulong 2 +if ne mc_word b add mc_base add i 4 3 32 +ret 3 +end +if ne mc_word b add mc_base add i 6 3 4 +ret 3 +end +end +if ne mc_word b 83 mul mc_word b 9 4 +ret 3 +end +if ne mc_word b 87 mul mul ulong 9 mc_word b 10 8 +ret 3 +end +for i ulong 2 +if ne mc_word b add 91 mul i 4 mul mul ulong 9 mc_word b 10 4 +ret 3 +end +end +if ne mc_word b 99 mul mul ulong 9 mc_word b 9 4 +ret 3 +end +if ne mc_word b 103 mul mc_word b 9 4 +ret 3 +end +ret 0 +end +fn mc_windows b view uchar 16384 to long +cfg = new ulong 8 0 +rows = new ulong 1024 0 +meta = new ulong 4 0 +put cfg 0 1 +put cfg 1 mc_word b 5 +put cfg 2 mc_word b 9 +put cfg 3 mc_word b 10 +put cfg 4 mc_word b 13 +put cfg 5 mc_word b 16 +put cfg 6 mc_word b 15 +put cfg 7 mc_word b 75 +if ne moe_windows cfg edit rows edit meta 0 +ret 2 +end +if ne get meta 0 mc_word b 3 +ret 2 +end +for i ulong 1024 +if ne mc_word b add 384 i get rows i +ret 2 +end +end +p = mul mc_word b 4 8 +for i ulong 3 +if ne mc_word b add 6 i get rows add p i +ret 2 +end +end +ret 0 +end +fn mc_valid b view uchar 16384 n ulong to long +if ne n 11264 +ret 1 +end +if or ne mc_word b 0 1 ne mc_word b 1 159 +ret 1 +end +if ne mc_word b 2 n +ret 1 +end +if or eq mc_word b 3 0 gt mc_word b 3 128 +ret 1 +end +if ge mc_word b 4 mc_word b 3 +ret 1 +end +if or eq mc_word b 5 0 gt mc_word b 5 128 +ret 1 +end +if or ne mc_word b 9 2048 ne mc_word b 10 512 +ret 2 +end +if or ne mc_word b 11 256 ne mc_word b 12 8 +ret 2 +end +if or ne mc_word b 13 9 ne mc_word b 14 256 +ret 2 +end +if ne mc_word b 15 128 +ret 2 +end +if or lt mc_word b 16 144 gt mc_word b 16 4294967295 +ret 2 +end +if ne rem mc_word b 16 16 0 +ret 2 +end +note Epoch0 is valid; identities match owner context separately. +if ne mc_word b 18 121 +ret 2 +end +if eq mc_word b 20 0 +ret 1 +end +if or eq mc_word b 77 0 ge mc_word b 21 mc_word b 77 +ret 1 +end +lastly = ulong 0 +if eq add mc_word b 21 1 mc_word b 77 +lastly = 1 +end +if ne mc_word b 78 lastly +ret 2 +end +if ne mc_word b 23 0 +ret 2 +end +for i ulong 8 +if ne mc_word b add 24 i 1 +ret 2 +end +end +for i ulong 9 +if ne mc_word b add 64 i i +ret 2 +end +end +if or ne mc_word b 73 add mul mc_word b 5 9 8 ne mc_word b 74 128 +ret 2 +end +if or ne mc_word b 75 0 gt mc_word b 76 1 +ret 2 +end +if ne mc_word b 79 1 +ret 2 +end +note Window-local X/Y, GU X/Y, DN Y/Y, padding8, duplicate-preserving sort. +if or ne mc_word b 112 1 ne mc_word b 113 2 +ret 2 +end +if or ne mc_word b 114 2 ne mc_word b 115 2 +ret 2 +end +if ne mc_word b 116 8 +ret 2 +end +for i ulong 5 +if ne mc_word b add 117 i 1 +ret 2 +end +end +for i ulong 2 +v = mc_word b add 122 i +if or eq v 0 gt v 16384 +ret 1 +end +if ne rem v 16 0 +ret 1 +end +end +for i ulong 4 +if ne mc_word b add 124 i 0 +ret 1 +end +end +for i ulong 64 +nz = uchar 0 +for j ulong 32 +nz = or nz get b add add 1024 mul i 32 j +end +if eq nz 0 +ret 1 +end +end +for i ulong 5120 +if ne get b add 11264 i 0 +ret 1 +end +end +s = mc_windows b +if ne s 0 +ret s +end +ret mc_ranges b +end +fn mc_bind want view uchar 16384 got view uchar 16384 n ulong out edit uchar 32 to long +for i ulong 32 +put out i 0 +end +s = mc_valid want n +if ne s 0 +ret s +end +s = mc_valid got n +if ne s 0 +ret s +end +for i ulong 11264 +if ne get want i get got i +ret 4 +end +end +if ne kc_codesha got n edit out 0 +ret 1 +end +ret 0 +end +fn mc_limb b view uchar 16384 group ulong limb ulong to ulong +ret mc_word b add add 128 mul group 4 limb +end +fn mc_context b view uchar 16384 q view ulong 64 row view ulong 64 role ulong to long +if ne mc_valid b 11264 0 +ret 1 +end +if or gt role 1 ne get q 0 1 +ret 5 +end +if ne get row 0 3 +ret 5 +end +for i ulong 4 +if ne get q add i 3 mc_word b add i 17 +ret 5 +end +if ne get row add i 17 get q add i 3 +ret 5 +end +end +for i ulong 6 +group = add i 38 +if and eq role 1 ge i 4 +group = add i 49 +end +for j ulong 4 +v = mc_limb b group j +if ne get q add add 14 mul i 4 j v +ret 5 +end +if ne get row add add 33 mul i 4 j v +ret 5 +end +end +end +for i ulong 4 +if ne get row add 21 i mc_limb b add 22 mul role 8 i +ret 5 +end +if ne get row add 25 i mc_limb b add 24 mul role 8 i +ret 5 +end +if ne get row add 29 i mc_limb b 44 i +ret 5 +end +if ne get row add 57 i mc_limb b add 23 mul role 8 i +ret 5 +end +end +ret 0 +end +fn mc_bindctx want view uchar 16384 got view uchar 16384 q view ulong 64 row view ulong 64 role ulong out edit uchar 32 to long +for i ulong 32 +put out i 0 +end +s = mc_context got q row role +if ne s 0 +ret s +end +ret mc_bind want got 11264 edit out +end +fn mc_chashes b view uchar 16384 c view uchar 4096 role ulong to long +h = new uchar 32 0 +q = new uchar 4096 0 +for k ulong 3 +pos = add 544 mul k 32 +for i ulong 32 +put h i get c add pos i +end +if not mc_hash b add k 4 h +ret 6 +end +end +for i ulong 32 +put h i get c add 512 i +end +if not mc_hash b add 61 role h +ret 6 +end +if ne kc_sha c 1152 edit h 0 +ret 6 +end +if not mc_hash b add 22 mul role 8 h +ret 6 +end +for i ulong 384 +put q i get c add 768 i +end +if ne kc_sha q 384 edit h 0 +ret 6 +end +if not mc_hash b add 29 mul role 8 h +ret 6 +end +ret 0 +end +fn mc_codeblob b view uchar 16384 c view uchar 4096 code view uchar 16384 n ulong role ulong to long +h = new uchar 32 0 +if ne kc_codesha code n edit h 0 +ret 6 +end +if not compose_codeid c h +ret 6 +end +if not mc_hash b add 23 mul role 8 h +ret 6 +end +ret 0 +end +fn mc_launchblob b view uchar 16384 c view uchar 4096 l view uchar 256 role ulong to long +h = new uchar 32 0 +lw = new uchar 4096 0 +for i ulong 256 +put lw i get l i +end +if ne compose_launchread c lw 256 0 +ret 6 +end +if ne kc_sha lw 256 edit h 0 +ret 6 +end +if not compose_launchid c h +ret 6 +end +if not mc_hash b add 24 mul role 8 h +ret 6 +end +for k ulong 3 +pos = add 120 mul k 32 +for i ulong 32 +put h i get l add pos i +end +group = add add 26 mul role 8 k +if not mc_hash b group h +ret 6 +end +end +ret 0 +end +fn mc_blob b view uchar 16384 c view uchar 4096 code view uchar 16384 n ulong l view uchar 256 role ulong to long +if gt role 1 +ret 1 +end +if ne mc_valid b 11264 0 +ret 1 +end +note Preserve canonical family3 refusal. No host result can replace that gate. +if ne compose_word c 19 3 +ret 6 +end +if ne compose_check c 1152 0 +ret 6 +end +if or eq n 0 gt n 16384 +ret 6 +end +if ne rem n 16 0 +ret 6 +end +if ne n mc_word b add 122 role +ret 6 +end +if ne compose_word c 4 mc_word b 8 +ret 6 +end +if eq role 0 +if or ne compose_word c 5 mul mc_word b 10 2 ne compose_word c 6 mc_word b 9 +ret 6 +end +else +if or ne compose_word c 5 mc_word b 9 ne compose_word c 6 mc_word b 10 +ret 6 +end +end +if ne mc_chashes b c role 0 +ret 6 +end +if ne mc_codeblob b c code n role 0 +ret 6 +end +ret mc_launchblob b c l role +end +note Custody identities are frozen executor metadata, not candidate claims or signed receipts. +note ctx/got32: version1,class1HOST_ONLY,instance4,evaluator4,source4,resultprotocol4, +note approved subject4,independently frozen qualification-context4,reserved6zero. +note No device class accepted here; existing independent owner handles actual qualification. +fn mc_custody b view uchar 16384 held view uchar 32 ctx view ulong 32 got view ulong 32 to long +h = new uchar 32 0 +if ne mc_valid b 11264 0 +ret 1 +end +if ne kc_codesha b 11264 edit h 0 +ret 1 +end +for i ulong 32 +if ne get held i get h i +ret 5 +end +end +if or ne get ctx 0 1 ne get ctx 1 1 +ret 5 +end +for i ulong 32 +if ne get ctx i get got i +ret 5 +end +end +for i ulong 4 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get h add mul i 8 j mul j 8 +end +if ne get ctx add i 2 v +ret 5 +end +if ne get ctx add i 6 mc_limb b 7 i +ret 5 +end +if ne get ctx add i 10 mc_limb b 3 i +ret 5 +end +end +for i ulong 4 +if ne get ctx add i 14 mc_limb b 63 i +ret 5 +end +if ne get ctx add i 18 mc_limb b 39 i +ret 5 +end +if ne get ctx add i 22 mc_limb b 44 i +ret 5 +end +end +for i ulong 6 +if ne get ctx add i 26 0 +ret 5 +end +end +ret 0 +end +fn mc_pack scalars view ulong 128 hashes view uchar 2048 windows view ulong 1024 out edit uchar 16384 to long +for i ulong 16384 +put out i 0 +end +for i ulong 128 +mc_put edit out i get scalars i +end +for i ulong 2048 +put out add 1024 i get hashes i +end +for i ulong 1024 +mc_put edit out add 384 i get windows i +end +s = mc_valid out 11264 +if ne s 0 +for i ulong 16384 +put out i 0 +end +end +ret s +end diff --git a/tests/learn53/moe-export.om b/tests/learn53/moe-export.om new file mode 100644 index 00000000..32512b92 --- /dev/null +++ b/tests/learn53/moe-export.om @@ -0,0 +1,38 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY synthetic byte emitter; mode0 exact wire, mode1 native digest. +fn main to int +b = new uchar 16384 0 +h = new uchar 32 0 +mode = new uchar 1 0 +last = new uchar 1 0 +if ne read 0 mode 0 1 1 +ret 65 +end +if ne read 0 last 0 1 0 +ret 65 +end +mf_fill edit b +if ge get mode 0 2 +mf_fifteen edit b +put mode 0 sub get mode 0 2 +end +if ne mc_valid b 11264 0 +ret 65 +end +if eq get mode 0 0 +if ne write 1 b 0 11264 11264 +ret 74 +end +ret 0 +end +if eq get mode 0 1 +if ne kc_codesha b 11264 edit h 0 +ret 65 +end +if ne write 1 h 0 32 32 +ret 74 +end +ret 0 +end +ret 65 +end diff --git a/tests/learn53/moe-fixtures.om b/tests/learn53/moe-fixtures.om new file mode 100644 index 00000000..6adc8484 --- /dev/null +++ b/tests/learn53/moe-fixtures.om @@ -0,0 +1,151 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY synthetic metadata. No accepted records, candidate execution or q=true. +fn mf_fill b edit uchar 16384 to void +for i ulong 16384 +put b i 0 +end +mc_put edit b 0 1 +mc_put edit b 1 159 +mc_put edit b 2 11264 +mc_put edit b 3 1 +mc_put edit b 5 1 +mc_put edit b 7 1 +mc_put edit b 8 9 +mc_put edit b 9 2048 +mc_put edit b 10 512 +mc_put edit b 11 256 +mc_put edit b 12 8 +mc_put edit b 13 9 +mc_put edit b 14 256 +mc_put edit b 15 128 +mc_put edit b 16 256 +mc_put edit b 18 121 +mc_put edit b 19 5 +mc_put edit b 20 7 +mc_put edit b 22 11 +for i ulong 8 +mc_put edit b add 24 i 1 +end +for i ulong 9 +mc_put edit b add 64 i i +end +mc_put edit b 73 17 +mc_put edit b 74 128 +mc_put edit b 77 2 +mc_put edit b 79 1 +mc_put edit b 112 1 +mc_put edit b 113 2 +mc_put edit b 114 2 +mc_put edit b 115 2 +mc_put edit b 116 8 +for i ulong 5 +mc_put edit b add 117 i 1 +end +mc_put edit b 122 16 +mc_put edit b 123 16 +for i ulong 16 +p = mc_base i +mc_put edit b p mul add i 1 16777216 +mc_put edit b add p 1 10485760 +gen = ulong 5 +if ge i 14 +gen = 11 +end +mc_put edit b add p 2 gen +stride = ulong 1 +if lt i 4 +stride = 256 +end +if and ge i 4 lt i 6 +stride = 32 +end +if and ge i 6 lt i 8 +stride = 4 +end +if or eq i 8 eq i 13 +stride = mul ulong 2048 4 +end +if eq i 9 +stride = mul mul ulong 9 512 8 +end +if or eq i 10 eq i 11 +stride = mul mul ulong 9 512 4 +end +if eq i 12 +stride = mul mul ulong 9 2048 4 +end +mc_put edit b add p 3 stride +end +for i ulong 64 +for j ulong 32 +put b add add 1024 mul i 32 j uchar add i 1 +end +end +note Independent literal one-token oracle row: start0,count1,R9,all byte offsets0. +mc_put edit b 385 1 +mc_put edit b 386 9 +end +fn mf_context b view uchar 16384 q edit ulong 64 row edit ulong 64 to void +for i ulong 64 +put q i 0 +put row i 0 +end +put q 0 1 +put q 1 1 +put row 0 3 +for i ulong 4 +put q add i 3 mc_word b add i 17 +put row add i 17 mc_word b add i 17 +end +for i ulong 6 +for j ulong 4 +v = mc_limb b add i 38 j +put q add add 14 mul i 4 j v +put row add add 33 mul i 4 j v +end +end +for i ulong 4 +put row add 21 i mc_limb b 22 i +put row add 25 i mc_limb b 24 i +put row add 29 i mc_limb b 44 i +put row add 57 i mc_limb b 23 i +end +end +fn mf_cust b view uchar 16384 h view uchar 32 ctx edit ulong 32 to void +for i ulong 32 +put ctx i 0 +end +put ctx 0 1 +put ctx 1 1 +for i ulong 4 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get h add mul i 8 j mul j 8 +end +put ctx add i 2 v +put ctx add i 6 mc_limb b 7 i +put ctx add i 10 mc_limb b 3 i +put ctx add i 14 mc_limb b 63 i +put ctx add i 18 mc_limb b 39 i +put ctx add i 22 mc_limb b 44 i +end +end +fn mf_fifteen b edit uchar 16384 to void +mf_fill edit b +mc_put edit b 3 2 +mc_put edit b 4 1 +mc_put edit b 5 15 +mc_put edit b 6 14 +mc_put edit b 73 add mul ulong 15 9 8 +note Independent Wolfram literal oracle; exact query/result recorded in CONTRACT. +mc_put edit b 385 14 +mc_put edit b 386 126 +mc_put edit b 392 14 +mc_put edit b 393 1 +mc_put edit b 394 9 +mc_put edit b 395 114688 +mc_put edit b 396 516096 +mc_put edit b 397 258048 +mc_put edit b 398 1032192 +mc_put edit b 399 3584 +end diff --git a/tests/learn53/moe-host-evidence.json b/tests/learn53/moe-host-evidence.json new file mode 100644 index 00000000..e9b4c30f --- /dev/null +++ b/tests/learn53/moe-host-evidence.json @@ -0,0 +1,203 @@ +{ + "schema": "cudapp-learn53-moe-closure-host-evidence-v1", + "evidence_class": "HOST_ONLY_SYNTHETIC", + "baseline": "b759afc3f5e46f152ffb06b39882ffa28cacaf96", + "recorded_utc": "2026-10-28T12:55:59.336238+00:00", + "compiler": { + "repository": "https://github.com/aien-dev/omega-mv.git", + "revision": "e5b32567a7aff3ce594e3254a622a846a6cd190b", + "sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" + }, + "sources": { + "native/learn53/moe-closure.om": "b1061e65ffdf69fe071ef357d5bf346bfb065b81414c63c466d228fe2fa76847", + "native/learn53/moe-closure.lock": "3b6db1cf0702276fb5a614326a13b4f96d0e22a6a20bd7748c7c689ec0075cc6", + "tests/learn53/moe-fixtures.om": "3c6bdd787d87ec759d30163a759d71141cceb5dfe2da28c3051f48a516aaf091", + "tests/learn53/moe-unit.om": "3bd1d4fe4035790e0417d210b00abde5fed923ab354a484ff859f423b56490d8", + "tests/learn53/moe-export.om": "fca0b88b1b0f106a2d7142f3cafff7e24a98acd9a5fa298c1f60361420b33213" + }, + "construction": "Export and SHA-verify each immutable Git object in moe-closure.lock, concatenate in lock order, append closure, fixtures and chosen test; no mutable imports or vendored duplicate implementations.", + "unit_command": { + "tool": "omega.run", + "source_composition": [ + "moe-closure.lock sources in order", + "native/learn53/moe-closure.om", + "tests/learn53/moe-fixtures.om", + "tests/learn53/moe-unit.om" + ], + "source_sha256": "40ecbda8d9b731d5241808f6603d836c123e72f6e2a9ffa09042cd184bfd7000", + "timeout_ms": 20000 + }, + "unit_result": { + "compile": { + "ok": true, + "binary_bytes": 57792, + "sha256": "461c0a55c469bc789813d14a42c2742e21fc51435d1700843150038db2565357", + "compiler_sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" + }, + "exit": { + "kind": "normal", + "code": 0 + }, + "stdout": "MOE-CLOSURE HOST_ONLY PASS\n", + "stdout_bytes": 27, + "stdout_truncated": false, + "stderr": "", + "stderr_bytes": 0, + "stderr_truncated": false, + "limits": { + "timeout_ms": 20000, + "cpu_seconds": 10, + "address_space_bytes": 268435456, + "file_size_bytes": 1048576, + "processes": 5 + }, + "isolation": "bwrap+prlimit: no network, no host files, cleared environment, cpu/as/fsize/nproc limits, server wall clock" + }, + "verifier_mutants": { + "wire-equality-removed": { + "compile": { + "ok": true, + "binary_bytes": 57760, + "sha256": "0104a644b4e4f6194bf9dcfe58944a9a9abd8dbc2a6ccf0df77f68e9cf1c4dbf", + "compiler_sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" + }, + "exit": { + "kind": "normal", + "code": 15 + }, + "stdout": "", + "stdout_bytes": 0, + "stdout_truncated": false, + "stderr": "", + "stderr_bytes": 0, + "stderr_truncated": false, + "limits": { + "timeout_ms": 20000, + "cpu_seconds": 10, + "address_space_bytes": 268435456, + "file_size_bytes": 1048576, + "processes": 5 + }, + "isolation": "bwrap+prlimit: no network, no host files, cleared environment, cpu/as/fsize/nproc limits, server wall clock" + }, + "result-custody-equality-removed": { + "compile": { + "ok": true, + "binary_bytes": 57768, + "sha256": "44b4a4df4c5c497f94274c88ef862299ec17bcf83aeff26d8a761efac0a2dc95", + "compiler_sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" + }, + "exit": { + "kind": "normal", + "code": 13 + }, + "stdout": "", + "stdout_bytes": 0, + "stdout_truncated": false, + "stderr": "", + "stderr_bytes": 0, + "stderr_truncated": false, + "limits": { + "timeout_ms": 20000, + "cpu_seconds": 10, + "address_space_bytes": 268435456, + "file_size_bytes": 1048576, + "processes": 5 + }, + "isolation": "bwrap+prlimit: no network, no host files, cleared environment, cpu/as/fsize/nproc limits, server wall clock" + }, + "paired-artifact-check-removed": { + "compile": { + "ok": true, + "binary_bytes": 57632, + "sha256": "5f613caa60a5ec194fb65727dcaca34863557214fb2bf85be54267fb26562941", + "compiler_sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" + }, + "exit": { + "kind": "normal", + "code": 23 + }, + "stdout": "", + "stdout_bytes": 0, + "stdout_truncated": false, + "stderr": "", + "stderr_bytes": 0, + "stderr_truncated": false, + "limits": { + "timeout_ms": 20000, + "cpu_seconds": 10, + "address_space_bytes": 268435456, + "file_size_bytes": 1048576, + "processes": 5 + }, + "isolation": "bwrap+prlimit: no network, no host files, cleared environment, cpu/as/fsize/nproc limits, server wall clock" + } + }, + "external_oracle": { + "compile_command": "pinned omc < exact export composition > export; require compile exit0 before chmod700 and execution", + "source_sha256": "a339dfef34867620b67b48d2e7c739d574c6160d4964b5b498f0e83d640c16e8", + "binary_sha256": "0c6a18f05b8f5ac94f23499dd7f36964e7d8b301ee075120e2c0722cbcd3aa00", + "commands": [ + "printf byte0 | export -> one-token.wire", + "printf byte1 | export -> one-token.native-sha256", + "sha256sum one-token.wire; compare to native raw32 bytes", + "printf byte2 | export -> fifteen-token-two-window.wire", + "printf byte3 | export -> fifteen-token-two-window.native-sha256", + "sha256sum fifteen-token-two-window.wire; compare to native raw32 bytes" + ], + "results": [ + { + "label": "one-token", + "wire_bytes": 11264, + "native_sha256": "2ce28d4b14114eeed27afbc49531349e1b4a98f56954584e60897aa83b43eef1", + "external_sha256sum": "2ce28d4b14114eeed27afbc49531349e1b4a98f56954584e60897aa83b43eef1", + "match": true + }, + { + "label": "fifteen-token-two-window", + "wire_bytes": 11264, + "native_sha256": "ea482a3a504e4bf76c8b492836e0f0359c6f7017be4502e36587ab6dc9f15d3a", + "external_sha256sum": "ea482a3a504e4bf76c8b492836e0f0359c6f7017be4502e36587ab6dc9f15d3a", + "match": true + } + ] + }, + "wolfram": [ + { + "query": "{Expand[32*(9*t)],9*n+8,3072+8*i,128*8+64*32+128*8*8}", + "result": "{288*t,8+9*n,3072+8*i,11264}", + "warnings": false + }, + { + "query": "({#[[1]],#[[2]],9 #[[2]],#[[1]]2048 4,#[[1]]9 512 8,#[[1]]9 512 4,#[[1]]9 2048 4,#[[1]]256}& /@ {{0,14},{14,1}})", + "result": "{{0,14,126,0,0,0,0,0},{14,1,9,114688,516096,258048,1032192,3584}}", + "warnings": false + } + ], + "controls": [ + "every scalar/order/resource/stride/generation/length field changed independently", + "every SHA identity role changed independently", + "every table cell and unused row changed independently", + "identical malformed expected/observed refused", + "wrong GU/DN partner/role and every selector digest limb refused", + "session epoch0 accepted as exact context; altered context refused", + "binding refusal clears stale instance SHA", + "serializer refusal clears wire", + "every result-custody cell substitution refused; equal device-class2 claims refused", + "literal one-token and ragged two-window oracle tables", + "family3 canonical payload refusal preserved" + ], + "qualification": { + "accepted_hardware_receipts": [], + "production_record_count": 0, + "device_execution": "NOT_RUN", + "parent_consumer_integration": "NOT_RUN", + "protected_evaluator": "NOT_RUN", + "MoE_numerical_and_full_cost": "NOT_RUN", + "mapped_family3_payload_hash_positive": "NOT_RUN; canonical owner refuses family3, downstream blob-hash logic static-reviewed only" + }, + "consultation": { + "design": "subject versus instance, acyclic identity graph, exact-byte validation before comparison, independently observed metadata and retained snapshots required", + "final_static_review": "No blocking issue found; downstream family3 payload hash positive not exercised; fixed Wolfram contract evidence pointer discrepancy." + } +} diff --git a/tests/learn53/moe-unit.om b/tests/learn53/moe-unit.om new file mode 100644 index 00000000..166ef659 --- /dev/null +++ b/tests/learn53/moe-unit.om @@ -0,0 +1,283 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY synthetic controls; this does not execute a GPU/evaluator/candidate. +text mf_ok "MOE-CLOSURE HOST_ONLY PASS\n" +fn mf_zero h view uchar 32 to bool +for i ulong 32 +if ne get h i 0 +ret false +end +end +ret true +end +fn mf_copy a view uchar 16384 b edit uchar 16384 to void +for i ulong 16384 +put b i get a i +end +end +fn mf_mutant a view uchar 16384 b edit uchar 16384 h edit uchar 32 pos ulong to bool +mf_copy a edit b +put b pos xor get b pos 1 +s = mc_bind a b 11264 edit h +if eq s 0 +ret false +end +ret mf_zero h +end +fn mf_scalars a view uchar 16384 b edit uchar 16384 h edit uchar 32 to bool +note Every scalar, semantic/order field, address, extent, stride, generation and length. +for i ulong 128 +if not mf_mutant a edit b edit h mul i 8 +ret false +end +end +ret true +end +fn mf_digests a view uchar 16384 b edit uchar 16384 h edit uchar 32 to bool +note All64 roles: GU/DN pairing, code/launch/manifest/ABI/QMD/quant, source/context. +for i ulong 64 +if not mf_mutant a edit b edit h add 1024 mul i 32 +ret false +end +end +ret true +end +fn mf_table a view uchar 16384 b edit uchar 16384 h edit uchar 32 to bool +note All table cells, including unused rows, plus capacity tail canonicality. +for i ulong 1024 +if not mf_mutant a edit b edit h add 3072 mul i 8 +ret false +end +end +ret mf_mutant a edit b edit h 16383 +end +fn mf_contexts a view uchar 16384 to bool +q = new ulong 64 0 +row = new ulong 64 0 +mf_context a edit q edit row +if ne mc_context a q row 0 0 +ret false +end +for i ulong 24 +v = get q add 14 i +put q add 14 i xor v 1 +if ne mc_context a q row 0 5 +ret false +end +put q add 14 i v +v = get row add 33 i +put row add 33 i xor v 1 +if ne mc_context a q row 0 5 +ret false +end +put row add 33 i v +end +for i ulong 4 +v = get q add i 3 +put q add i 3 xor v 1 +if ne mc_context a q row 0 5 +ret false +end +put q add i 3 v +end +note A DN row cannot consume the GU half, even with matching joint subject. +if ne mc_context a q row 1 5 +ret false +end +for i ulong 8 +v = mc_limb a add 53 div i 4 rem i 4 +put q add 30 i v +put row add 49 i v +end +for i ulong 4 +put row add 21 i mc_limb a 30 i +put row add 25 i mc_limb a 32 i +put row add 57 i mc_limb a 31 i +end +if ne mc_context a q row 1 0 +ret false +end +note Distinct paired artifacts cannot be interchanged after the role is fixed. +put row 21 mc_limb a 22 0 +if ne mc_context a q row 1 5 +ret false +end +ret true +end +fn mf_custody a view uchar 16384 h view uchar 32 to bool +ctx = new ulong 32 0 +got = new ulong 32 0 +mf_cust a h edit ctx +for i ulong 32 +put got i get ctx i +end +if ne mc_custody a h ctx got 0 +ret false +end +for i ulong 32 +v = get got i +put got i xor v 1 +if ne mc_custody a h ctx got 5 +ret false +end +put got i v +end +note Even mutually matching synthetic inputs cannot request device evidence class. +put ctx 1 2 +put got 1 2 +if ne mc_custody a h ctx got 5 +ret false +end +ret true +end +fn mf_pack a view uchar 16384 b edit uchar 16384 to bool +s = new ulong 128 0 +h = new uchar 2048 0 +w = new ulong 1024 0 +for i ulong 128 +put s i mc_word a i +end +for i ulong 2048 +put h i get a add 1024 i +end +for i ulong 1024 +put w i mc_word a add 384 i +end +if ne mc_pack s h w edit b 0 +ret false +end +for i ulong 16384 +if ne get a i get b i +ret false +end +end +put s 13 8 +if ne mc_pack s h w edit b 2 +ret false +end +for i ulong 16384 +if ne get b i 0 +ret false +end +end +ret true +end +fn mf_boundroot a view uchar 16384 to bool +b = new uchar 16384 0 +q = new ulong 64 0 +row = new ulong 64 0 +h = new uchar 32 0 +mf_copy a edit b +mf_context a edit q edit row +if ne mc_bindctx a b q row 0 edit h 0 +ret false +end +if mf_zero h +ret false +end +put row 21 xor get row 21 1 +if ne mc_bindctx a b q row 0 edit h 5 +ret false +end +ret mf_zero h +end +fn mf_payload a view uchar 16384 to bool +c = new uchar 4096 0 +code = new uchar 16384 0 +l = new uchar 256 0 +if ne mc_blob a c code 16 l 2 1 +ret false +end +compose_put edit c 19 3 +note Correct role cannot bypass the existing canonical family3 admission refusal. +if ne mc_blob a c code 16 l 0 6 +ret false +end +if ne mc_blob a c code 16 l 1 6 +ret false +end +ret true +end +fn main to int +a = new uchar 16384 0 +b = new uchar 16384 0 +h = new uchar 32 0 +mf_fill edit a +if ne mc_valid a 11264 0 +ret 10 +end +if not mf_boundroot a +ret 23 +end +if not mf_payload a +ret 24 +end +mf_copy a edit b +if ne mc_bind a b 11264 edit h 0 +ret 11 +end +if mf_zero h +ret 12 +end +if not mf_custody a h +ret 13 +end +if not mf_contexts a +ret 14 +end +if not mf_scalars a edit b edit h +ret 15 +end +if not mf_digests a edit b edit h +ret 16 +end +if not mf_table a edit b edit h +ret 17 +end +if not mf_pack a edit b +ret 18 +end +note Equally malformed expected+observed must refuse, not compare equal and succeed. +mc_put edit a 13 8 +mf_copy a edit b +if ne mc_bind a b 11264 edit h 2 +ret 19 +end +if not mf_zero h +ret 20 +end +mf_fill edit a +mf_copy a edit b +if ne mc_bind a b 11263 edit h 1 +ret 21 +end +if not mf_zero h +ret 22 +end +mf_fifteen edit a +if ne mc_valid a 11264 0 +ret 25 +end +if not mf_boundroot a +ret 26 +end +if not mf_table a edit b edit h +ret 27 +end +note Explicit ordered table reorder, duplicate and global-map base shift controls. +mf_copy a edit b +mc_put edit b 384 14 +mc_put edit b 392 0 +if ne mc_bind a b 11264 edit h 2 +ret 28 +end +mf_copy a edit b +mc_put edit b 112 2 +if ne mc_bind a b 11264 edit h 2 +ret 29 +end +wrote = write 1 mf_ok 0 len mf_ok +if ne wrote long len mf_ok +ret 74 +end +ret 0 +end From 4aef070f207f849e1672103e9edd0be21600e1a3 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Wed, 28 Oct 2026 09:27:46 -0500 Subject: [PATCH 2/2] feat(learn53): bind complete ordered MoE live observations Extend the canonical native closure with exact code, consumed launch, directory, allocation and ordered role-series preimages. Version2 refuses Version1 direct leaves; code-only series exclude live context. Keep qualification authority outside the payload. Refs #35, #53, #159, #26, #17 --- docs/learn53/CONTRACT.md | 207 ++++++++++- native/learn53/moe-closure.om | 359 ++++++++++++++++++- tests/learn53/moe-fixtures.om | 2 +- tests/learn53/moe-observe-export.om | 50 +++ tests/learn53/moe-observe-fixtures.om | 105 ++++++ tests/learn53/moe-observe-host-evidence.json | 235 ++++++++++++ tests/learn53/moe-observe-unit.om | 227 ++++++++++++ tests/learn53/moe-series-export.om | 27 ++ tests/learn53/moe-series-unit.om | 128 +++++++ tests/learn53/moe-unit.om | 11 + 10 files changed, 1334 insertions(+), 17 deletions(-) create mode 100644 tests/learn53/moe-observe-export.om create mode 100644 tests/learn53/moe-observe-fixtures.om create mode 100644 tests/learn53/moe-observe-host-evidence.json create mode 100644 tests/learn53/moe-observe-unit.om create mode 100644 tests/learn53/moe-series-export.om create mode 100644 tests/learn53/moe-series-unit.om diff --git a/docs/learn53/CONTRACT.md b/docs/learn53/CONTRACT.md index 21835583..dd174e69 100644 --- a/docs/learn53/CONTRACT.md +++ b/docs/learn53/CONTRACT.md @@ -71,7 +71,7 @@ Native test construction follows the same concatenation with `tests/learn53/fixt Omega653 framework attachment and complete attempt/budget record; independent split custody/deduplication/sealing; #15 seeded host qualification; #16 FP/numerical policy migration; #17 real native full-cost collector/paired baselines; one measured hot operator; #10/#35 independent binary/launch admission; #24 runtime memory/session integration; GB10 and full consuming graph; independent judge and production release. No speed reward, candidate generation, training, proof or default selection occurs in this slice. Hardware/consumer tests are NOT_RUN, not NO-GO experiments. -## Joint resident MoE operation-instance binding v1 +## Joint resident MoE operation-instance binding v2 `native/learn53/moe-closure.om` extends this existing task/evaluator custody boundary for #35/#53/#159/#26/#17. It is not another benchmark, task catalog, @@ -122,7 +122,7 @@ Even two byte-equal malformed descriptors refuse. | Scalar cell | Meaning and required value | | --- | --- | -|0,1,2|Version1, domain159, exact active length11264| +|0,1,2|Version2, domain159, exact active length11264| |3,4|Complete window count1..128, selected zero-based ordinal less than count| |5,6,7,8|Total tokens1..128; selected window token0, token count and R| |9,10|H2048, EI512| @@ -189,7 +189,7 @@ hex or caller-selected short IDs. |---|---| |0..8|Model, config, checkpoint, exact source, compiler, encoder source, semantic spec, independent evaluator executable/source closure, numerical contract| |9|Router semantic contract| -|10..21|GROUP code/launch, router code/launch, PERM_XO code/launch, SwiGLU code/launch, PERM_ACT code/launch, combine code/launch| +|10..21|Ordered code/launch **series** for GROUP, router, PERM_XO, SwiGLU, PERM_ACT and combine; mandatory even for one entry| |22..29|GU canonical1152, final code, launch256, existing full manifest, parameter ABI, immutable cbank template, zero-VA QMD template, canonical Quant384| |30..37|DN identities in the same order| |38..43|Workload equivalence, approved joint subject, policy, measurement protocol, GU incumbent canonical artifact, GU applicability| @@ -205,6 +205,10 @@ parent alone determines whether an existing independent qualification bundle is accepted. Host fixture hashes never populate production records. No gate masks, qualification bits or signed receipts are created or modified by these APIs. +Version2 replaces direct entry hashes in groups10..21 with complete ordered +role-series hashes. Version1 is refused; there is no direct-leaf compatibility +path. Nested preimages retain their own version1/domain159 subtype tags. + ### Integration API All functions are native seeded Omega, nonconcurrent fixed-array calls. Exported @@ -273,6 +277,171 @@ Do not copy the instance hash into q/row identities or overwrite accepted qualification history. Production record count remains zero until real independent accepted hardware/full-workload records exist. +### Canonical nested live-observation preimages + +The following pure Omega roots define groups10..21,45..47 in this same owner. +These are **live-instance** identities. They are not Composer launch256 +identities, synthesized parameter ABIs, zero-VA templates, qualification +subjects, or new authority. No existing incumbent-glue address normalizer was +found: admitted native templates remain exact admitted bytes under their +existing owner. Live code, bank, QMD, directory and allocation VAs stay live +here. Never zero pointers or hash weight contents to manufacture code identity. +All input arrays and each output32 must be disjoint. + +``` +mc_code(code view uchar16384, n ulong, out edit uchar32) -> long +mc_launch(meta view ulong32, bank view uchar1024, + qmdslot view uchar1024, submit view ulong16, + out edit uchar32) -> long +mc_dir(meta view ulong8, entries view ulong1024, out edit uchar32) -> long +mc_alloc(meta view ulong8, records view ulong1024, out edit uchar32) -> long +``` + +Every refusal clears output32. `mc_code` requires positive exact encoded +length, multiple16 and at most16384. It hashes exactly that prefix through +the existing `kc_codesha`, excluding the allocation's instruction-prefetch +tail. This bound follows existing `BW_MAX_IR_INSNS=1024`; exceeding it refuses +instead of truncating. Actual code residency/VA-to-byte membership is the +existing allocation owner's responsibility. + +`mc_launch` binds the **already emitted command-list entry**, not requested +launch fields or a reimplementation of QMD/default policy: + +|Meta cell|Actual retained observation| +|---|---| +|0,1,2|Version1, domain159, live-entry subtype1| +|3|Kernel role0 GROUP,1 router,2 PERM_XO,3 SwiGLU,4 PERM_ACT,5 combine| +|4,5|Active argument-word count1..32; exact encoded code byte length| +|6,7|Entry ordinal; positive command-list record generation| +|8,9|Actual independent flag0/1; actual pending-wait VA0 or eight-byte aligned| +|10|Actual resident code VA, nonzero/16-byte aligned; must equal PROGRAM_ADDRESS decoded from actual QMD1 words32/33| +|11..31|Reserved0| + +|Submit cell|Actual consumed submission configuration| +|---|---| +|0,1,2|Version1, domain159, submission subtype4| +|3|Positive record generation, equal launch meta7| +|4,5|Mode0 PCAS/1 INLINE; barrier enum0..4| +|6,7|Resolved timeout in ms, positive; resolved marker spin in us, at most1000000| +|8,9,10|Stamps0/1; skip-launch exactly0; first-barrier-none0/1| +|11|Final recorded launch count1..4096; launch ordinal must be below it| +|12..15|Reserved0| + +Canonical preimage order is all32 meta cells as LE64, all16 submit cells as +LE64, actual bank bytes `[0,896+4*nargs)`, actual QMD1 slot bytes `[0,384)`, +then actual QMD0 slot bytes `[512,896)`. This includes the existing224-word +driver bank and actual32-bit argument words; it cannot truncate widened +argument values because it consumes their actual retained bytes. Bank +padding after active arguments and QMD slot gaps are deliberately excluded. +Effective GPR/thread dimensions/shared allocation/grid/code/context pointers +are the actual emitted QMD bytes, not independently recomputed rounded +requested values. These raw snapshots do not independently validate a QMD; +the existing command-list builder/validator remains its owner. + +The snapshot must contain the **mode-final representation actually emitted**, +not an earlier retained QMD. The existing emitter patches QMD1 words10/12: +PCAS zeros them, whereas INLINE installs its dependent-QMD fields in a local +copy. In particular, retained storage after PCAS is not the later INLINE +representation. The consuming owner must prepare/capture those same final +bytes before binding and must consume them unchanged. Observe every entry and +every chunk before the **first** queue commit; a refusal after an earlier +chunk was submitted is not an unsubmitted-list refusal. + +This preimage binds recorded independence, pending wait, consumed options and +entry QMD/bank bytes. It does not alone bind the complete effective method +stream or chunk schedule: effective barriers also depend on ring capacity, +platform prefix and chunk boundaries. Group51 remains the owning dependency-DAG +contract; callers must not inflate this helper into effective-barrier evidence. + +`OmegaGpuLaunch.timeout_ms` and `.spin_us` are ignored by command-list add. +The live digest instead binds the **same resolved submission values actually +consumed**. Observing a global spin default separately, even under the session +lock, is not enough: its original setter did not take that lock. The consuming +owner must capture once and consume unchanged, or invoke binding at the exact +consumption point with the already resolved values. Actual final-list +observation/binding follows recording but precedes any queue commit; refusal +aborts the unsubmitted list without incumbent fallback. This is not terminal +completion evidence, a post-submit receipt, or permission to submit. + +`mc_dir` metadata is `{1,159,2,role,count,owner_generation,layer,0}`. +Role0 GU/1 DN, count exactly257, owner generation positive and layer a u32 +including zero. Entries0..513 contain all257 ordered `{W_VA,S_VA}` pairs; +each VA is positive/eight-byte aligned. Entries514..1023 must be zero. +SHA256 covers the8 LE64 metadata cells followed by the514 LE64 address cells, +exactly4176 bytes. No weight/scale data or invented contiguous W+S envelope +is included. The existing directory owner supplies and retains this complete +actual snapshot, including mutations through its existing setter. + +`mc_alloc` metadata is +`{1,159,3,active_count,graph_owner_gen,tensor_owner_gen,lifecycle_gen,0}`. +Count is1..64; the three owner generations are positive. There are64 records, +each16 LE64 cells: + +``` +{role,index,handle_generation,kind,allocation_VA,physical_bytes, + resource_VA,available_bytes,owner_generation,0,0,0,0,0,0,0} +``` + +Active roles are strictly ascending and below64; role coverage belongs to +the complete operation observer, not a generic invented required-role list. +Index0 is valid; index/generation are u32 and generation is nonzero. Kind2 +means data buffer,3 code buffer,4 queue/push **buffer**, never a submission +queue/channel handle. All VAs are positive/eight-byte aligned, extents +positive/nonwrapping; each resource is a real contained allocation subspan. +The same buffer index cannot claim differing generations, kinds, backing +VAs or physical extents. Multiple roles/subranges sharing the same handle +are legitimate and preserved. Unused record cells are zero. SHA256 covers +the8 metadata cells and all1024 record cells as LE64, exactly8256 bytes. + +Resource-role generations in the outer wire remain owner-lease generations, +not individual handle generations. This snapshot separately binds the latter. +The observer must cover actual separate W/S allocations, enclosing buffers, +router/glue/leased code and command-list-owned buffers where applicable. +Unused graph buffers are not invented reads. These structural checks do not +attest registry membership, current ownership or lifetime: the existing owner +retains that responsibility under the same observed lease/snapshot. + +### Complete ordered code and launch series + +``` +mc_series(meta view ulong8, leafSHAs view uchar4096, + ordinals view ulong128, out edit uchar32) -> long +``` + +This is the only aggregation format for groups10..21, including singleton +roles. Metadata is `{1,159,5,role,kind,count,record_generation,full_count}`. +Roles0..5 have the same order as `mc_launch`; kind0 is encoded-code identity, +kind1 is launch identity; count is1..128. This covers the complete existing +operation bound, not a new64-token limit. Router recording can require multiple +64-row entries, and combine can require a separate entry for every token. +The observer must cover **all** such occurrences; it may not pick first/last, +deduplicate identical code, or truncate. More than128 occurrences is refused. +The full command list can still have4096 entries and actual ordinal4095. + +Code metadata requires generation/full_count both0 and all ordinals0. Its +preimage is all8 metadata cells as LE64 followed by all4096 leaf-digest bytes. +Code occurrences retain their actual execution order and count, but do not +acquire runtime addresses, generations or weight data as encoded-code identity. +Launch metadata requires positive actual record generation and full_count +1..4096. Active ordinals must be strictly increasing and below full_count; +inactive ordinals must be0. Its preimage is all8 metadata cells as LE64, all128 +ordinals as LE64, then all4096 digest bytes. Each active32-byte digest must be +nonzero and every inactive digest byte must be0 for both kinds. Refusal clears +out; status1 is malformed metadata/reserved data,3 is a zero active digest, +6 is hashing refusal. + +The owner gathers both arrays in **one actual-entry traversal**. Code slot +`i` and launch slot `i` must refer to the same actual entry, in ascending actual +ordinal order, with identical series role and count. A launch leaf's role, +ordinal, generation and final-list count must agree with its series metadata +and ordinal. Each code leaf comes from `mc_code` over the actual exact code +bytes; each launch leaf comes from `mc_launch` over that same observed entry. +Code series goes to group`10+2*role`, launch series to`11+2*role`. These +correspondence/provenance obligations cannot be recovered from opaque digests +by `mc_series`, nor does hashing two supplied lists establish them. A valid +leaf from another ordinal/generation must be refused by the observer before +aggregation. No caller qualification flag substitutes for these checks. + ### Host controls and remaining gates `tests/learn53/moe-fixtures.om` is explicitly synthetic HOST_ONLY metadata. @@ -298,18 +467,26 @@ WolframLanguageEvaluator: -> {{0,14,126,0,0,0,0,0},{14,1,9,114688,516096,258048,1032192,3584}} ``` -`tests/learn53/moe-host-evidence.json` records the actual native controls, -external SHA oracle, verifier mutants, compiler/source identities and limits. -The three verifier mutants remove exact wire comparison, result-custody -comparison and selected paired-artifact comparison respectively; each must -compile successfully and make the unit executable fail. - -To construct either native test: export the exact Git objects listed in -`moe-closure.lock`, verify each source SHA, concatenate in listed order followed -by `native/learn53/moe-closure.om`, `tests/learn53/moe-fixtures.om`, then -`moe-unit.om` or `moe-export.om`. Compile with the lock's independently pinned -compiler, never execute failed/stale output. No production build/runtime, -source registry or new host-language implementation is introduced. +`tests/learn53/moe-host-evidence.json` remains the immutable historical +Version1 source receipt at commit32af495. The separate +`moe-observe-host-evidence.json` records the Version2 replay, nested preimages, +ordered-series controls, independent byte/SHA oracles and verifier mutants. +The original three mutants removed exact wire, result-custody and selected +paired-artifact comparison. New controls challenge both QMD regions, consumed +options, all257 W/S pairs, buffer aliases/backing, and every series digest/ +ordinal cell, including128 occurrences and ordinal4095. These are synthetic +HOST_ONLY tests, not snapshots of actual recorded or submitted GPU work. + +To construct a native test, export exact Git objects listed in +`moe-closure.lock`, verify each source SHA and concatenate in listed order, +followed by `native/learn53/moe-closure.om`. For the outer closure, append +`moe-fixtures.om` then `moe-unit.om` or `moe-export.om`. For nested observations, +append `moe-observe-fixtures.om` then `moe-observe-unit.om` or +`moe-observe-export.om`; for ordered series use that same observation fixture +followed by `moe-series-unit.om` or `moe-series-export.om`. Paths are relative to +`tests/learn53/`. Compile with the lock's independently pinned compiler; never +execute failed/stale output. No production build/runtime, source registry or +new host-language implementation is introduced. Actual protected evaluator execution, independent finite-FP/numerical/model quality results, measured full-cost comparison, accepted hardware receipts, diff --git a/native/learn53/moe-closure.om b/native/learn53/moe-closure.om index 6180561b..e06bcf69 100644 --- a/native/learn53/moe-closure.om +++ b/native/learn53/moe-closure.om @@ -171,7 +171,7 @@ fn mc_valid b view uchar 16384 n ulong to long if ne n 11264 ret 1 end -if or ne mc_word b 0 1 ne mc_word b 1 159 +if or ne mc_word b 0 2 ne mc_word b 1 159 ret 1 end if ne mc_word b 2 n @@ -576,3 +576,360 @@ end end ret s end +note Nested live-instance preimages, not admitted native artifact template identities. +note All input arrays and out32 MUST be disjoint; existing owner supplies actual retained snapshots. +fn mc_clear out edit uchar 32 to void +for i ulong 32 +put out i 0 +end +end +fn mc_code code view uchar 16384 n ulong out edit uchar 32 to long +mc_clear edit out +if or eq n 0 or gt n 16384 ne rem n 16 0 +ret 1 +end +if ne kc_codesha code n edit out 0 +ret 6 +end +ret 0 +end +fn mc_submit m view ulong 32 s view ulong 16 to long +if or ne get s 0 1 or ne get s 1 159 ne get s 2 4 +ret 1 +end +if or eq get s 3 0 ne get s 3 get m 7 +ret 1 +end +if or gt get s 4 1 gt get s 5 4 +ret 2 +end +if or eq get s 6 0 gt get s 7 1000000 +ret 1 +end +if or gt get s 8 1 or ne get s 9 0 gt get s 10 1 +ret 2 +end +if or eq get s 11 0 or gt get s 11 4096 ge get m 6 get s 11 +ret 1 +end +for i ulong 4 +if ne get s add 12 i 0 +ret 1 +end +end +ret 0 +end +fn mc_qword q view uchar 1024 off ulong to ulong +v = ulong 0 +for i ulong 4 +v = or v shl ulong get q add off i mul i 8 +end +ret v +end +fn mc_qcode q view uchar 1024 to ulong +low = shl mc_qword q 128 4 +high = and mc_qword q 132 sub shl ulong 1 21 1 +ret or low shl high 36 +end +fn mc_lmeta m view ulong 32 qmd view uchar 1024 to long +if or ne get m 0 1 or ne get m 1 159 ne get m 2 1 +ret 1 +end +if or gt get m 3 5 or eq get m 4 0 gt get m 4 32 +ret 1 +end +n = get m 5 +if eq n 0 +ret 1 +end +if gt n 16384 +ret 1 +end +if ne rem n 16 0 +ret 1 +end +if or eq get m 7 0 gt get m 8 1 +ret 1 +end +if ne rem get m 9 8 0 +ret 3 +end +if eq get m 10 0 +ret 3 +end +if ne rem get m 10 16 0 +ret 3 +end +if ne mc_qcode qmd get m 10 +ret 3 +end +for i ulong 21 +if ne get m add 11 i 0 +ret 1 +end +end +ret 0 +end +fn mc_lbytes bank view uchar 1024 qmd view uchar 1024 n ulong b edit uchar 16384 to ulong +off = ulong 384 +for i ulong add 896 mul n 4 +put b add off i get bank i +end +off = add off add 896 mul n 4 +for i ulong 384 +put b add off i get qmd i +end +off = add off 384 +for i ulong 384 +put b add off i get qmd add 512 i +end +ret add off 384 +end +fn mc_launch m view ulong 32 bank view uchar 1024 qmd view uchar 1024 s view ulong 16 out edit uchar 32 to long +mc_clear edit out +st = mc_lmeta m qmd +if ne st 0 +ret st +end +st = mc_submit m s +if ne st 0 +ret st +end +b = new uchar 16384 0 +for i ulong 32 +mc_put edit b i get m i +end +for i ulong 16 +mc_put edit b add 32 i get s i +end +n = mc_lbytes bank qmd get m 4 edit b +if ne kc_codesha b n edit out 0 +ret 6 +end +ret 0 +end +fn mc_dir m view ulong 8 entries view ulong 1024 out edit uchar 32 to long +mc_clear edit out +if or ne get m 0 1 or ne get m 1 159 ne get m 2 2 +ret 1 +end +if or gt get m 3 1 or ne get m 4 257 eq get m 5 0 +ret 1 +end +if or gt get m 6 4294967295 ne get m 7 0 +ret 1 +end +b = new uchar 16384 0 +for i ulong 8 +mc_put edit b i get m i +end +for i ulong 1024 +if lt i 514 +if or eq get entries i 0 ne rem get entries i 8 0 +ret 3 +end +mc_put edit b add 8 i get entries i +else +if ne get entries i 0 +ret 1 +end +end +end +if ne kc_codesha b 4176 edit out 0 +ret 6 +end +ret 0 +end +fn mc_record r view ulong 1024 i ulong to long +p = mul i 16 +if ge get r p 64 +ret 1 +end +if ne i 0 +if le get r p get r sub p 16 +ret 1 +end +end +if or gt get r add p 1 4294967295 or eq get r add p 2 0 gt get r add p 2 4294967295 +ret 1 +end +if or lt get r add p 3 2 gt get r add p 3 4 +ret 1 +end +va = get r add p 4 +size = get r add p 5 +rv = get r add p 6 +avail = get r add p 7 +if or eq va 0 ne rem va 8 0 +ret 3 +end +if or eq size 0 gt va sub ulong 18446744073709551615 size +ret 3 +end +if or lt rv va ge rv add va size +ret 3 +end +if or eq avail 0 gt avail sub add va size rv +ret 3 +end +if or ne rem rv 8 0 eq get r add p 8 0 +ret 3 +end +for j ulong 7 +if ne get r add add p 9 j 0 +ret 1 +end +end +ret 0 +end +fn mc_backing r view ulong 1024 i ulong to long +p = mul i 16 +for j ulong i +q = mul j 16 +if eq get r add p 1 get r add q 1 +if ne get r add p 2 get r add q 2 +ret 3 +end +for k ulong 3 +if ne get r add add p 3 k get r add add q 3 k +ret 3 +end +end +end +end +ret 0 +end +fn mc_alloc m view ulong 8 r view ulong 1024 out edit uchar 32 to long +mc_clear edit out +if or ne get m 0 1 or ne get m 1 159 ne get m 2 3 +ret 1 +end +if or eq get m 3 0 gt get m 3 64 +ret 1 +end +for i ulong 3 +if eq get m add 4 i 0 +ret 1 +end +end +if ne get m 7 0 +ret 1 +end +for i ulong get m 3 +st = mc_record r i +if ne st 0 +ret st +end +st = mc_backing r i +if ne st 0 +ret st +end +end +base = mul get m 3 16 +for i ulong sub ulong 1024 base +if ne get r add base i 0 +ret 1 +end +end +b = new uchar 16384 0 +for i ulong 8 +mc_put edit b i get m i +end +for i ulong 1024 +mc_put edit b add 8 i get r i +end +if ne kc_codesha b 8256 edit out 0 +ret 6 +end +ret 0 +end +note Every occurrence is retained; code and launch series share the owner's actual-entry order. +fn mc_smeta m view ulong 8 ord view ulong 128 to long +if or ne get m 0 1 or ne get m 1 159 ne get m 2 5 +ret 1 +end +if or gt get m 3 5 gt get m 4 1 +ret 1 +end +if or eq get m 5 0 gt get m 5 128 +ret 1 +end +if eq get m 4 0 +if or ne get m 6 0 ne get m 7 0 +ret 1 +end +for i ulong 128 +if ne get ord i 0 +ret 1 +end +end +ret 0 +end +if or eq get m 6 0 or eq get m 7 0 gt get m 7 4096 +ret 1 +end +for i ulong 128 +if lt i get m 5 +if ge get ord i get m 7 +ret 1 +end +if gt i 0 +if le get ord i get ord sub i 1 +ret 1 +end +end +else +if ne get ord i 0 +ret 1 +end +end +end +ret 0 +end +fn mc_sdigs hashes view uchar 4096 n ulong to long +for i ulong 128 +v = uchar 0 +for j ulong 32 +if lt i n +v = or v get hashes add mul i 32 j +else +if ne get hashes add mul i 32 j 0 +ret 1 +end +end +end +if and lt i n eq v 0 +ret 3 +end +end +ret 0 +end +fn mc_series m view ulong 8 hashes view uchar 4096 ord view ulong 128 out edit uchar 32 to long +mc_clear edit out +if ne mc_smeta m ord 0 +ret 1 +end +st = mc_sdigs hashes get m 5 +if ne st 0 +ret st +end +b = new uchar 16384 0 +for i ulong 8 +mc_put edit b i get m i +end +off = ulong 64 +if eq get m 4 1 +for i ulong 128 +mc_put edit b add 8 i get ord i +end +off = ulong 1088 +end +for i ulong 4096 +put b add off i get hashes i +end +if ne kc_codesha b add off 4096 edit out 0 +mc_clear edit out +ret 6 +end +ret 0 +end diff --git a/tests/learn53/moe-fixtures.om b/tests/learn53/moe-fixtures.om index 6adc8484..3abce4f1 100644 --- a/tests/learn53/moe-fixtures.om +++ b/tests/learn53/moe-fixtures.om @@ -4,7 +4,7 @@ fn mf_fill b edit uchar 16384 to void for i ulong 16384 put b i 0 end -mc_put edit b 0 1 +mc_put edit b 0 2 mc_put edit b 1 159 mc_put edit b 2 11264 mc_put edit b 3 1 diff --git a/tests/learn53/moe-observe-export.om b/tests/learn53/moe-observe-export.om new file mode 100644 index 00000000..ccb0da6c --- /dev/null +++ b/tests/learn53/moe-observe-export.om @@ -0,0 +1,50 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY SYNTHETIC; emit four native digests challenged by an independent byte oracle. +fn mo_emit h view uchar 32 to bool +ret eq write 1 h 0 32 32 +end +fn main to int +h = new uchar 32 0 +code = new uchar 16384 51 +if ne mc_code code 16 edit h 0 +ret 1 +end +if not mo_emit h +ret 74 +end +m = new ulong 32 0 +s = new ulong 16 0 +bank = new uchar 1024 17 +qmd = new uchar 1024 34 +mo_launch edit m edit s +mo_qmd m edit qmd +if ne mc_launch m bank qmd s edit h 0 +ret 2 +end +if not mo_emit h +ret 74 +end +dm = new ulong 8 0 +r = new ulong 1024 0 +mo_dir edit dm edit r +if ne mc_dir dm r edit h 0 +ret 3 +end +if not mo_emit h +ret 74 +end +for i ulong 8 +put dm i 0 +end +for i ulong 1024 +put r i 0 +end +mo_alloc edit dm edit r +if ne mc_alloc dm r edit h 0 +ret 4 +end +if not mo_emit h +ret 74 +end +ret 0 +end diff --git a/tests/learn53/moe-observe-fixtures.om b/tests/learn53/moe-observe-fixtures.om new file mode 100644 index 00000000..9a64d559 --- /dev/null +++ b/tests/learn53/moe-observe-fixtures.om @@ -0,0 +1,105 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY SYNTHETIC hash-preimage fixtures; not actual GPU QMDs or hardware receipts. +fn mo_launch m edit ulong 32 s edit ulong 16 to void +put m 0 1 +put m 1 159 +put m 2 1 +put m 3 2 +put m 4 6 +put m 5 16 +put m 7 7 +put m 10 16777216 +put s 0 1 +put s 1 159 +put s 2 4 +put s 3 7 +put s 6 20000 +put s 7 50 +put s 11 1 +end +fn mo_dir m edit ulong 8 r edit ulong 1024 to void +put m 0 1 +put m 1 159 +put m 2 2 +put m 4 257 +put m 5 11 +for i ulong 514 +put r i 16777216 +end +end +fn mo_alloc m edit ulong 8 r edit ulong 1024 to void +put m 0 1 +put m 1 159 +put m 2 3 +put m 3 2 +put m 4 5 +put m 5 11 +put m 6 7 +for i ulong 2 +p = mul i 16 +put r p i +put r add p 2 1 +put r add p 3 2 +put r add p 4 16777216 +put r add p 5 4096 +put r add p 6 add ulong 16777216 mul i 8 +put r add p 7 sub ulong 4096 mul i 8 +put r add p 8 5 +end +end +fn mo_equal a view uchar 32 b view uchar 32 to bool +for i ulong 32 +if ne get a i get b i +ret false +end +end +ret true +end +fn mo_zero a view uchar 32 to bool +for i ulong 32 +if ne get a i 0 +ret false +end +end +ret true +end +fn mo_qmd m view ulong 32 q edit uchar 1024 to void +low = shr get m 10 4 +high = or shr get m 10 36 shl ulong 10 21 +for i ulong 4 +put q add 128 i uchar and shr low mul i 8 255 +put q add 132 i uchar and shr high mul i 8 255 +end +end +fn mo_flip b edit uchar 1024 i ulong to void +put b i xor get b i 1 +end +fn ms_fill m edit ulong 8 hashes edit uchar 4096 ord edit ulong 128 n ulong kind ulong to void +for i ulong 8 +put m i 0 +end +for i ulong 4096 +put hashes i 0 +end +for i ulong 128 +put ord i 0 +end +put m 0 1 +put m 1 159 +put m 2 5 +put m 3 1 +put m 4 kind +put m 5 n +if eq kind 1 +put m 6 7 +put m 7 4096 +end +for i ulong 128 +if lt i n +put hashes mul i 32 uchar add i 1 +if eq kind 1 +put ord i add ulong 3968 i +end +end +end +end diff --git a/tests/learn53/moe-observe-host-evidence.json b/tests/learn53/moe-observe-host-evidence.json new file mode 100644 index 00000000..cfef3411 --- /dev/null +++ b/tests/learn53/moe-observe-host-evidence.json @@ -0,0 +1,235 @@ +{ + "schema": "cudapp-learn53-moe-observe-host-evidence-v1", + "classification": "HOST_ONLY_SYNTHETIC", + "outer_wire_version": 2, + "prior_version1_receipt": { + "commit": "32af495759065feb542c9460dfe63ecbb2e05c81", + "path": "tests/learn53/moe-host-evidence.json", + "unchanged": true + }, + "compiler": { + "repository": "https://github.com/aien-dev/omega-mv.git", + "revision": "e5b32567a7aff3ce594e3254a622a846a6cd190b", + "sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" + }, + "dependency_source_lock": "native/learn53/moe-closure.lock", + "source_files_sha256": { + "native/learn53/moe-closure.om": "e123a9bcf91ac2011db1378eab8e3396e477b5841fe79b7caa67fb56e1511c70", + "native/learn53/moe-closure.lock": "3b6db1cf0702276fb5a614326a13b4f96d0e22a6a20bd7748c7c689ec0075cc6", + "docs/learn53/CONTRACT.md": "6766188f1db200d97ccccfec25319f1448841a408d1b5a40281940b887ad0c9b", + "tests/learn53/moe-fixtures.om": "133139616b4feddc0f892078dd989ae99616f81601956e786863e5f11bd4c5a2", + "tests/learn53/moe-unit.om": "47fcbe800f7b9efc8904a7ece4c34b8e089a0131f715d4a40ff40bb3e2b9b6f6", + "tests/learn53/moe-export.om": "fca0b88b1b0f106a2d7142f3cafff7e24a98acd9a5fa298c1f60361420b33213", + "tests/learn53/moe-observe-fixtures.om": "bbc92602ee42301cbf8c3ba61dd97e954107a3f5526e844b3ec66ec6f2c1608f", + "tests/learn53/moe-observe-unit.om": "09eb6030779fa32790b3ae7e1bc78ec84b66d100af8335b9aa7458c7471427b9", + "tests/learn53/moe-observe-export.om": "0dd8635d859bfb2a13a2944466576e806e53082a18f0ecb43bee4021f7dc8de3", + "tests/learn53/moe-series-unit.om": "16b548b4abd60997c83427a20e9ff00a63dfbc1162830f070f51dacd1b2fabc6", + "tests/learn53/moe-series-export.om": "0aaa6c0c8038bf57a40207d196ec499238d8780540b1dfbf5fcae126e1211c00" + }, + "execution": { + "executor": "omega MCP run", + "isolation": "bwrap+prlimit: no network, no host files, cleared environment", + "timeout_ms": 20000, + "cpu_seconds": 10, + "address_space_bytes": 268435456 + }, + "positive_native_runs": { + "closure-v2": { + "source_sha256": "64d7e126a118f8af5b3c8d64bc700fd397038dc5b2512ab5afa94286dd7f19e9", + "compile_ok": true, + "binary_sha256": "c1540094dee0491ffab25aab72decbee49295158ef49950a414eb42ab31e7001", + "binary_bytes": 65332, + "exit_code": 0, + "stdout": "MOE-CLOSURE HOST_ONLY PASS\n", + "stderr": "" + }, + "nested-observation": { + "source_sha256": "460f2039f8ff9a7ce5d75c74cc287afad29835babfc250ab302a02c788b6b5dc", + "compile_ok": true, + "binary_sha256": "29d447146543df8b0e5ed6b2a43ec43f7b3d60b442dc4778f6ca09f06ef7b16b", + "binary_bytes": 60812, + "exit_code": 0, + "stdout": "MOE-OBSERVE HOST_ONLY PASS\n", + "stderr": "" + }, + "ordered-series": { + "source_sha256": "c33d6f3d1ca1d70a93948f5df286379336766483de9ca113e0f0d01ac8b2e182", + "compile_ok": true, + "binary_sha256": "7c2b4aa56e2ca0efdea9913035cb84c7fa3a275cb7fc6ed86656904d782d2bda", + "binary_bytes": 57884, + "exit_code": 0, + "stdout": "MOE-SERIES HOST_ONLY PASS\n", + "stderr": "" + } + }, + "verifier_mutants": { + "closure-byte-equality-removed": { + "source_sha256": "20f922d48ebd4567aea55896354e064ddac96a51f3c39cfebfc844f0317ae260", + "transform": {"before": "if ne get want i get got i\nret 4\nend", "after": ""}, + "expected_failure_exit": 15, + "compile_ok": true, + "binary_sha256": "7f9f1bd2e5c6a5c292435d167aaf62ab8e4ac43299bb9655ec83e1e0acf3d9b5", + "binary_bytes": 65284, + "exit_code": 15, + "stdout": "", + "stderr": "" + }, + "custody-observed-equality-removed": { + "source_sha256": "ff760c24504773a7e50473a10b78630d20552e69bdc49e3c67b719a5e50d99a5", + "transform": {"before": "if ne get ctx i get got i\nret 5\nend", "after": ""}, + "expected_failure_exit": 13, + "compile_ok": true, + "binary_sha256": "c1fba24e835ebfdb57ba3d5ddacb3b98529f2f5749f9c2e3663a07aa41bd9c59", + "binary_bytes": 65288, + "exit_code": 13, + "stdout": "", + "stderr": "" + }, + "selected-paired-artifact-check-removed": { + "source_sha256": "dfee1468f980ea9a02995fde6dc98d1553088de712632ce26897c378d52adae0", + "transform": {"before": "if ne get row add 21 i mc_limb b add 22 mul role 8 i\nret 5\nend", "after": ""}, + "expected_failure_exit": 23, + "compile_ok": true, + "binary_sha256": "468e685a8e1bf65179252f3460af58986a1a7852737a379c1c9a28ea92dbf8c4", + "binary_bytes": 65156, + "exit_code": 23, + "stdout": "", + "stderr": "" + }, + "QMD0-not-bound": { + "source_sha256": "bc1cc3946af63904640e6672216ed3bf81c05b926ea071e604bb615c3c3ca881", + "transform": {"before": "put b add off i get qmd add 512 i", "after": "put b add off i get qmd i"}, + "expected_failure_exit": 31, + "compile_ok": true, + "binary_sha256": "dfc29761ce7d6dc878e3fd8dc1aed8b012fb4863c3a2cb118e2051c1390bca00", + "binary_bytes": 60804, + "exit_code": 31, + "stdout": "", + "stderr": "" + }, + "shared-directory-slot-not-bound": { + "source_sha256": "491e8ec17be87a1ea9bf726a169dacc958dc775e32bd973c59e56cada81ebc71", + "transform": {"before": "mc_put edit b add 8 i get entries i", "after": "if lt i 512\nmc_put edit b add 8 i get entries i\nend"}, + "expected_failure_exit": 32, + "compile_ok": true, + "binary_sha256": "d7c4df36a19b98f3801c80b8ece1918432ce3026fc8f10de8fe8db46b0b717c2", + "binary_bytes": 60820, + "exit_code": 32, + "stdout": "", + "stderr": "" + }, + "conflicting-backing-check-removed": { + "source_sha256": "c3f0658a6b9c15547d58ef7fa20e417eb0038bf71cb560fb079ffdb0cd2aebf2", + "transform": {"before": "st = mc_backing r i", "after": "st = long 0"}, + "expected_failure_exit": 33, + "compile_ok": true, + "binary_sha256": "ee3e1af1473b0137c0454469029e298914d18a79e0e592b12de02c5dbfd6fdb3", + "binary_bytes": 60716, + "exit_code": 33, + "stdout": "", + "stderr": "" + }, + "consumed-completion-not-bound": { + "source_sha256": "4a5e0b3fd1d4ac03a64dbc8441dee50ff999571d631c748c76d63c556ef3158e", + "transform": {"before": "mc_put edit b add 32 i get s i", "after": "if or lt i 6 gt i 7\nmc_put edit b add 32 i get s i\nend"}, + "expected_failure_exit": 31, + "compile_ok": true, + "binary_sha256": "2661b7771283697cff0f880ac399705d98d48696786fe18292971d4add14350a", + "binary_bytes": 60836, + "exit_code": 31, + "stdout": "", + "stderr": "" + }, + "series-order-check-removed": { + "source_sha256": "25851ed21428b70728cd835a1d7d53e527d2623c5311f5d1072be5109fd2c287", + "transform": {"before": "if le get ord i get ord sub i 1\nret 1\nend", "after": ""}, + "expected_failure_exit": 42, + "compile_ok": true, + "binary_sha256": "7c66ab2373f08d2906da26dfd8b9434456b851ac80786fa5f660bd5282453ed0", + "binary_bytes": 57840, + "exit_code": 42, + "stdout": "", + "stderr": "" + }, + "series-last-occurrence-not-bound": { + "source_sha256": "ba73b71bb9ee1358a5a516c02a1b5174a16bb81d1065ba5cd7e1402bb670166c", + "transform": {"before": "for i ulong 4096\nput b add off i get hashes i\nend", "after": "for i ulong 4064\nput b add off i get hashes i\nend"}, + "expected_failure_exit": 41, + "compile_ok": true, + "binary_sha256": "47b48bb4ba3797666f137de1dbbd01d56f9e1256cdab7ad9c6f5955115f9779f", + "binary_bytes": 57880, + "exit_code": 41, + "stdout": "", + "stderr": "" + }, + "code-series-context-check-removed": { + "source_sha256": "350061310249c79e456c84554b25aacdece49c7438854165b997bac9fc1e4e76", + "transform": {"before": "if or ne get m 6 0 ne get m 7 0\nret 1\nend", "after": ""}, + "expected_failure_exit": 41, + "compile_ok": true, + "binary_sha256": "4c44f4555f0eb54f6da9c99e6bbcf1e762942a26868f992b0a9535484a6d0040", + "binary_bytes": 57836, + "exit_code": 41, + "stdout": "", + "stderr": "" + } + }, + "independent_oracles": { + "method": "Pinned omc compiles exporter after SHA-checked exact Git object composition. One-shot read-only Python struct.pack LE byte assembly for nested/series preimages; external sha256sum computes expected digests. Outer wire is exported separately and checked by sha256sum. No permanent host serializer or runtime introduced.", + "closure_v2": { + "source_sha256": "595a10d002e82b1b3724fa9721fd0480a19c121b6eedc994db4055de4638bafd", + "binary_sha256": "31dbc84eac96b58f30bcf34bae8439a52a7d18341d59400905ed9999d4d2a967", + "exit": 0, + "results": [ + {"label": "one-token-v2", "wire_bytes": 11264, "native_sha256": "2ad4ce40deb03dba48f8215655d3248ac7efed582c35ef525b902a22d20ec9da", "external_sha256sum": "2ad4ce40deb03dba48f8215655d3248ac7efed582c35ef525b902a22d20ec9da", "match": true}, + {"label": "fifteen-token-two-window-v2", "wire_bytes": 11264, "native_sha256": "8cab0e1c131a42d8f2222fb274590f887eb3d446458315a874ca118e2f6df4ea", "external_sha256sum": "8cab0e1c131a42d8f2222fb274590f887eb3d446458315a874ca118e2f6df4ea", "match": true} + ] + }, + "nested_observation": { + "source_sha256": "8ab35b2a3b4cfb74fae2e94f9067afab157d3de875adf9d4b3969883eca1c71c", + "binary_sha256": "eaf6c0e193c977a200d40da096b6b86b578cb6efdeb200d7182db890885ab509", + "exit": 0, + "stdout_bytes": 128, + "oracles": [ + {"kind": "code", "preimage_bytes": 16, "native_sha256": "a088eff91e38dff1bbed9bacdb1522671eabab26b8ec76130efba0dbb9e67c6a", "independent_sha256sum": "a088eff91e38dff1bbed9bacdb1522671eabab26b8ec76130efba0dbb9e67c6a", "match": true}, + {"kind": "launch", "preimage_bytes": 2072, "native_sha256": "25f0dd447c2d6565e44f25f660aea71a5b9855a375bad142d487ad17bbb27e62", "independent_sha256sum": "25f0dd447c2d6565e44f25f660aea71a5b9855a375bad142d487ad17bbb27e62", "match": true}, + {"kind": "directory", "preimage_bytes": 4176, "native_sha256": "e41673b521b20e708a549cdf9927e8186ec4c86765f4e2e1915183e7b0e47716", "independent_sha256sum": "e41673b521b20e708a549cdf9927e8186ec4c86765f4e2e1915183e7b0e47716", "match": true}, + {"kind": "allocation", "preimage_bytes": 8256, "native_sha256": "8686ba3fee15841452ae6d40390d25f8fd71a32dcc068f80be125f92882b968a", "independent_sha256sum": "8686ba3fee15841452ae6d40390d25f8fd71a32dcc068f80be125f92882b968a", "match": true} + ] + }, + "ordered_series": { + "source_sha256": "7390c2ab22a4b2e8f51f2d803e073fe8cb0553a81f6405a623eba9836b6116d4", + "binary_sha256": "052867e63c46f8ceb81e854ce938d56b16655ddfb4df9bd8168b361ee34d1dc0", + "exit": 0, + "stdout_bytes": 128, + "results": [ + {"role": 1, "kind": 0, "active_count": 2, "preimage_bytes": 4160, "native_sha256": "da0296601fb6353b2aa9a265d16121ef8e504076f92b748842482745d0cc8b9c", "independent_sha256sum": "da0296601fb6353b2aa9a265d16121ef8e504076f92b748842482745d0cc8b9c", "match": true}, + {"role": 1, "kind": 1, "active_count": 2, "preimage_bytes": 5184, "native_sha256": "41fe82ec5d53647c1c2b46aaf1b979dc4aff7a52f34cb9318650990c53d54d4c", "independent_sha256sum": "41fe82ec5d53647c1c2b46aaf1b979dc4aff7a52f34cb9318650990c53d54d4c", "match": true}, + {"role": 5, "kind": 0, "active_count": 128, "preimage_bytes": 4160, "native_sha256": "052e2fe833f7edb2f8a2bb25d4548f18f626d971a6523c9561d96828e4093c8b", "independent_sha256sum": "052e2fe833f7edb2f8a2bb25d4548f18f626d971a6523c9561d96828e4093c8b", "match": true}, + {"role": 5, "kind": 1, "active_count": 128, "preimage_bytes": 5184, "native_sha256": "1f993155a522f9499216b87e8de3a3a4bc38583732a9ebecaaeb9cb9b61633d7", "independent_sha256sum": "1f993155a522f9499216b87e8de3a3a4bc38583732a9ebecaaeb9cb9b61633d7", "match": true} + ] + } + }, + "controls": [ + "Version2 accepts canonical synthetic wire; identical Version1 wires refuse and clear stale SHA", + "Every outer scalar/SHA role/window/reserved byte, GU/DN mix, selector context and custody substitution challenged", + "Every launch metadata/consumed-option cell and active bank/QMD byte challenged; inactive bank tail/QMD gaps excluded", + "Synthetic QMD PROGRAM_ADDRESS agrees with independently supplied synthetic code-VA metadata", + "All257 ordered W/S pairs including shared contribution and reserved directory entries challenged", + "All allocation metadata/record cells challenged; index0 accepted; contradictory same-index generation/backing refused", + "Every series metadata/digest/ordinal cell challenged for both code and launch kinds", + "Two router-role occurrences and full128 combine-role occurrences independently hashed; last occurrence and ordinal4095 included", + "Code-only series refuses live record generation/full-count/ordinals; preserves count and ordered repeated occurrences", + "All10 verifier mutants compiled successfully and were rejected by the corresponding executable" + ], + "limits": { + "actual_owner_snapshot_and_consumption": "NOT_RUN: NativeIntegrate/ObserverFixture own mode-final QMD preparation, once-resolved options, same-traversal code/launch correspondence and all-entry precommit refusal", + "complete_effective_method_or_chunk_barrier_stream": "NOT_BOUND by mc_launch; owning group51 dependency contract remains separate", + "actual_protected_evaluator_execution": "NOT_RUN", + "independent_numerical_model_quality_and_full_cost": "NOT_RUN", + "accepted_hardware_receipts": "ABSENT in this slice", + "GPU_execution": "NOT_RUN", + "canonical_native_GU_DN_family3_positive": "NOT_RUN; existing compose_check family3 refusal preserved", + "production_registration_or_new_authority": "NONE; no q=true production or signed qualification receipts" + } +} diff --git a/tests/learn53/moe-observe-unit.om b/tests/learn53/moe-observe-unit.om new file mode 100644 index 00000000..57cbcd37 --- /dev/null +++ b/tests/learn53/moe-observe-unit.om @@ -0,0 +1,227 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY SYNTHETIC; no device qualification or owner-snapshot authentication. +text mo_ok "MOE-OBSERVE HOST_ONLY PASS\n" +fn mo_launchtest to bool +m = new ulong 32 0 +s = new ulong 16 0 +bank = new uchar 1024 17 +qmd = new uchar 1024 34 +h = new uchar 32 0 +g = new uchar 32 0 +mo_launch edit m edit s +mo_qmd m edit qmd +if ne mc_launch m bank qmd s edit h 0 +ret false +end +for i ulong 32 +put m i xor get m i 1 +st = ulong mc_launch m bank qmd s edit g +if eq st 0 +if mo_equal h g +ret false +end +else +if not mo_zero g +ret false +end +end +put m i xor get m i 1 +end +for i ulong 16 +put s i xor get s i 1 +st = ulong mc_launch m bank qmd s edit g +if eq st 0 +if mo_equal h g +ret false +end +else +if not mo_zero g +ret false +end +end +put s i xor get s i 1 +end +for i ulong add 896 mul get m 4 4 +mo_flip edit bank i +if ne mc_launch m bank qmd s edit g 0 +ret false +end +if mo_equal h g +ret false +end +mo_flip edit bank i +end +for i ulong 1024 +mo_flip edit qmd i +st = ulong mc_launch m bank qmd s edit g +if or lt i 384 and ge i 512 lt i 896 +if eq st 0 +if mo_equal h g +ret false +end +else +if not mo_zero g +ret false +end +end +else +if or ne st 0 not mo_equal h g +ret false +end +end +mo_flip edit qmd i +end +note Padding outside the driver and active arguments is not consumed by this identity. +for i ulong 104 +st = add ulong 920 i +mo_flip edit bank st +if ne mc_launch m bank qmd s edit g 0 +ret false +end +if not mo_equal h g +ret false +end +mo_flip edit bank st +end +ret true +end +fn mo_dirtest to bool +m = new ulong 8 0 +r = new ulong 1024 0 +h = new uchar 32 0 +g = new uchar 32 0 +mo_dir edit m edit r +if ne mc_dir m r edit h 0 +ret false +end +for i ulong 8 +put m i xor get m i 1 +st = mc_dir m r edit g +if eq st 0 +if mo_equal h g +ret false +end +else +if not mo_zero g +ret false +end +end +put m i xor get m i 1 +end +for i ulong 1024 +put r i xor get r i 8 +st = mc_dir m r edit g +if lt i 514 +if or ne st 0 mo_equal h g +ret false +end +else +if or ne st 1 not mo_zero g +ret false +end +end +put r i xor get r i 8 +end +put r 513 0 +if or ne mc_dir m r edit g 3 not mo_zero g +ret false +end +ret true +end +fn mo_alloctest to bool +m = new ulong 8 0 +r = new ulong 1024 0 +h = new uchar 32 0 +g = new uchar 32 0 +mo_alloc edit m edit r +if ne mc_alloc m r edit h 0 +ret false +end +for i ulong 8 +put m i xor get m i 1 +st = mc_alloc m r edit g +if eq st 0 +if mo_equal h g +ret false +end +else +if not mo_zero g +ret false +end +end +put m i xor get m i 1 +end +for i ulong 1024 +put r i xor get r i 1 +st = mc_alloc m r edit g +if eq st 0 +if mo_equal h g +ret false +end +else +if not mo_zero g +ret false +end +end +put r i xor get r i 1 +end +note Same buffer index cannot simultaneously name conflicting generations or backing allocations. +put r 18 2 +if or ne mc_alloc m r edit g 3 not mo_zero g +ret false +end +put r 18 1 +put r 21 8192 +if or ne mc_alloc m r edit g 3 not mo_zero g +ret false +end +ret true +end +fn mo_codetest to bool +code = new uchar 16384 51 +h = new uchar 32 0 +g = new uchar 32 0 +if ne mc_code code 16 edit h 0 +ret false +end +for i ulong 16 +put code i xor get code i 1 +if or ne mc_code code 16 edit g 0 mo_equal h g +ret false +end +put code i xor get code i 1 +end +put code 16 0 +if or ne mc_code code 16 edit g 0 not mo_equal h g +ret false +end +if or ne mc_code code 0 edit g 1 not mo_zero g +ret false +end +if or ne mc_code code 17 edit g 1 not mo_zero g +ret false +end +if or ne mc_code code 16385 edit g 1 not mo_zero g +ret false +end +ret true +end +fn main to int +if not mo_launchtest +ret 31 +end +if not mo_dirtest +ret 32 +end +if not mo_alloctest +ret 33 +end +if not mo_codetest +ret 34 +end +wrote = write 1 mo_ok 0 len mo_ok +if ne wrote long len mo_ok +ret 74 +end +ret 0 +end diff --git a/tests/learn53/moe-series-export.om b/tests/learn53/moe-series-export.om new file mode 100644 index 00000000..db8b46b6 --- /dev/null +++ b/tests/learn53/moe-series-export.om @@ -0,0 +1,27 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY raw digests: router code/launch count2, combine code/launch count128. +fn main to int +m = new ulong 8 0 +hashes = new uchar 4096 0 +ord = new ulong 128 0 +h = new uchar 32 0 +for i ulong 2 +n = ulong 2 +if eq i 1 +n = 128 +end +for j ulong 2 +ms_fill edit m edit hashes edit ord n j +if eq i 1 +put m 3 5 +end +if ne mc_series m hashes ord edit h 0 +ret 2 +end +if ne write 1 h 0 32 32 +ret 74 +end +end +end +ret 0 +end diff --git a/tests/learn53/moe-series-unit.om b/tests/learn53/moe-series-unit.om new file mode 100644 index 00000000..1d30f134 --- /dev/null +++ b/tests/learn53/moe-series-unit.om @@ -0,0 +1,128 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note HOST_ONLY synthetic digest occurrences; no recorded device entries or qualification. +text ms_ok "MOE-SERIES HOST_ONLY PASS\n" +fn ms_flip b edit uchar 4096 i ulong to void +put b i xor get b i 1 +end +fn ms_check kind ulong to bool +m = new ulong 8 0 +h = new uchar 4096 0 +ord = new ulong 128 0 +a = new uchar 32 0 +g = new uchar 32 0 +ms_fill edit m edit h edit ord 2 kind +if ne mc_series m h ord edit a 0 +ret false +end +for i ulong 8 +put m i xor get m i 1 +st = mc_series m h ord edit g +if eq st 0 +if mo_equal a g +ret false +end +else +if not mo_zero g +ret false +end +end +put m i xor get m i 1 +end +for i ulong 4096 +ms_flip edit h i +st = mc_series m h ord edit g +if ge i 64 +if or ne st 1 not mo_zero g +ret false +end +else +if eq i 0 +if or ne st 3 not mo_zero g +ret false +end +else +if or ne st 0 mo_equal a g +ret false +end +end +end +ms_flip edit h i +end +for i ulong 128 +put ord i xor get ord i 1 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +put ord i xor get ord i 1 +end +if eq kind 1 +put ord 1 4095 +if or ne mc_series m h ord edit g 0 mo_equal a g +ret false +end +put ord 1 4096 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +else +put m 6 7 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +put m 6 0 +put m 7 4096 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +end +ms_fill edit m edit h edit ord 128 kind +if ne mc_series m h ord edit a 0 +ret false +end +ms_flip edit h 4095 +if or ne mc_series m h ord edit g 0 mo_equal a g +ret false +end +ms_flip edit h 4095 +if eq kind 1 +put ord 127 4096 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +put ord 127 4095 +end +put m 5 129 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +put m 5 0 +if or ne mc_series m h ord edit g 1 not mo_zero g +ret false +end +note Identical code occurrences remain separate, ordered entries; no deduplication. +ms_fill edit m edit h edit ord 2 kind +put h 32 1 +if ne mc_series m h ord edit a 0 +ret false +end +put m 5 1 +put h 32 0 +put ord 1 0 +if or ne mc_series m h ord edit g 0 mo_equal a g +ret false +end +ret true +end +fn main to int +if not ms_check 0 +ret 41 +end +if not ms_check 1 +ret 42 +end +wrote = write 1 ms_ok 0 len ms_ok +if ne wrote long len ms_ok +ret 74 +end +ret 0 +end diff --git a/tests/learn53/moe-unit.om b/tests/learn53/moe-unit.om index 166ef659..d94cb763 100644 --- a/tests/learn53/moe-unit.om +++ b/tests/learn53/moe-unit.om @@ -236,6 +236,17 @@ end if not mf_pack a edit b ret 18 end +note Version1 direct-leaf wires are never accepted by the Version2 consumer. +mc_put edit a 0 1 +mf_copy a edit b +put h 0 255 +if ne mc_bind a b 11264 edit h 1 +ret 27 +end +if not mf_zero h +ret 28 +end +mf_fill edit a note Equally malformed expected+observed must refuse, not compare equal and succeed. mc_put edit a 13 8 mf_copy a edit b