CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / docs / learn53 / CONTRACT.md
| 1 | # CUL1 public native-host task contract |
| 2 | |
| 3 | Scope: the bounded CUDA++ domain adapter for #53. **NOT full #53 acceptance, a new benchmark service, or a GPU execution path.** All newly delivered executable logic/tests are seeded `.om`. Existing Linux/shell commands still assemble/build the modules; replacing that inherited host glue belongs to Omega #635/#636 and CUDA++ #15. No retirement claim. |
| 4 | |
| 5 | ## Authority and interface |
| 6 | |
| 7 | `task.om` exports `kvalid(n:ulong)->int` and `keval(n:ulong,c:ulong)->int`, using single-threaded fixed scratch arrays `kt:uchar[4096]` (trusted frozen task) and `ko:uchar[1032]` (observed candidate output). It never writes either array. `wire.om` exposes `kframe(n:ulong)->int` over `packet:uchar[5137]`, copying a complete public developer frame into those arrays before checking. Buffers must not be used concurrently. |
| 8 | |
| 9 | The eventual Omega #653 caller must bind the manifest, compiler, evaluator, actual candidate/launch and output acquisition to immutable identities and keep the task inaccessible to candidate modification. No such framework attachment is qualified here. The data-only stdin entry can be given any public task by its caller; it does **not authenticate** that task and is not a sandbox or promotion authority. Its `HOST_ONLY 0` text is a diagnostic, not a signed receipt. Candidate bytes are never interpreted as code, claimed timing, policy, tolerances or a PASS flag. Tests of fake result bytes do not qualify protection against substituting the evaluator executable or recorder. |
| 10 | |
| 11 | ## Canonical serialization |
| 12 | |
| 13 | One manifest is 24 little-endian unsigned 32-bit header words (96 bytes), followed by A's complete physical footprint and then B's, in little-endian u32 words. Exact length only, no optional/trailing fields, whitespace or alternate serialization. Serialization is this fixed byte layout, not JSON. Headers and all unused flags are validated before any payload access. |
| 14 | |
| 15 | | Word | Field | Accepted values | |
| 16 | |---:|---|---| |
| 17 | | 0 | magic | ASCII `CUL1`, LE value827086147 | |
| 18 | | 1 | schema | 1 | |
| 19 | | 2 | operation | 1 add; 2 left-to-right sum; 3 matmul | |
| 20 | | 3 | scalar profile | 1 unsigned32 modular | |
| 21 | | 4 | numerical mode | 0 exact integer, no floating tolerance | |
| 22 | | 5,6,7 | M,N,K | registered shapes below | |
| 23 | | 8,9,10 | A,B,output element/row strides | bounded0..32 and checked footprints; zero B stride only for sum | |
| 24 | | 11,12,13 | A,B,output physical word counts | each <=256; A/output nonempty by shape; B zero only for sum | |
| 25 | | 14 | pool | 1 public development; 2 validation and3 final refused with77 | |
| 26 | | 15 | normalized shape/operation family | derived from actual dimensions, not a caller-selected family | |
| 27 | | 16 | display task ID | nonzero u32, **not** a deduplication or content identity | |
| 28 | | 17 | reference semantics revision | 1 | |
| 29 | | 18 | alias rights | 0 disjoint inputs/output only | |
| 30 | | 19 | effects | 1 output-only writes, inputs unchanged | |
| 31 | | 20 | target/evidence class | 1 native-host reference; 121/other targets unsupported | |
| 32 | | 21,22 | absolute/relative tolerances | both exactly0, changing either is invalid | |
| 33 | | 23 | reserved | exactly0 | |
| 34 | |
| 35 | A manifest's immutable identity is its exact bytes, externally hashed by the framework. Semantic fields/input bytes, provenance/task label/pool and performance context must remain separately identified in that framework. This module does not invent an abbreviated hash or a second identity registry. A renamed task is not declared novel. Family tags are necessary metadata, not a completed family-split/deduplication service. |
| 36 | |
| 37 | Registered families: |
| 38 | - Add: `(M,N,K)=(3,1,1),(8,1,1),(17,1,1)`, families101/102/103. Each operand/output footprint is `(M-1)*stride+1`, positive strides. |
| 39 | - Sum: same shapes, families201/202/203. A has that footprint; B count/stride0, output count/stride1. |
| 40 | - Matmul: `(2,3,2),(3,2,3)`, families301/302. A is MxK, B is KxN, output MxN. Respective row strides >=K, >=N, >=N. Footprint is `(rows-1)*stride+columns` with no unused trailing row padding. |
| 41 | - All products/offsets are bounded after shape/stride/count admission; unsupported shape is never a GPU capability claim. |
| 42 | |
| 43 | The scalar reference is independent of CUDA++'s generator, encoder and candidate implementations. Add/multiply/sum retain the low32 bits. Sum and matmul traverse the reduction dimension in increasing order. For this modular integer domain different summation orders are mathematically equivalent; these tests **cannot detect or prove floating-point reduction-order preservation**. NaN/Inf/signed-zero/subnormal semantics and FP conversion/approximation are unsupported, not covered as floats by integer bit patterns. This implements the exact-integer branch required by #16's addendum, not a replacement for its finite-FP comparator, model-quality authority or trace format. |
| 44 | |
| 45 | ## Observed output layout |
| 46 | |
| 47 | Candidate output is `(output_count+2)*4` bytes: leading canary, complete physical output footprint, trailing canary. Canaries and internal padding equal `0xA5A5A5A5`. Every logical word is independently recomputed from the trusted task, every padding/canary checked. Exact output size is mandatory. Correct initial bytes cannot prove a write occurred; skipped-write controls poison the output and demonstrate detection of omitted observable results, not arbitrary memory-effect tracing. The future acquisition owner must also observe protected inputs and actual device memory. |
| 48 | |
| 49 | Statuses:0 checked match in this public native-host domain;1 mismatch/canary corruption;65 malformed record, counts, policy or output length;69 unsupported version/profile/op/shape/effects/target;77 non-public pool access refused;74 stream I/O failure. Input-length bounds precede field reads; structural checks precede semantic support, pool, shape/stride and output checks. No cached PASS survives another call. |
| 50 | |
| 51 | ## Native developer replay |
| 52 | |
| 53 | Build only with the explicit, source-reconstructed compiler SHA256 |
| 54 | `191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`. |
| 55 | Qualified source import: omega-bridge `0fc7d8662cb799e7c206b17c18ea4c3ec2b8fea9`, seed origin omega-mv `29b12760f4c962606411d6bf25032aedef063301`. |
| 56 | |
| 57 | Existing development commands on Linux AArch64, with a private fresh output directory and `OMC` pointing to that verified compiler: |
| 58 | |
| 59 | ```sh |
| 60 | cat native/learn53/task.om native/learn53/wire.om native/learn53/stream.om > "$OUT/stream.om" |
| 61 | "$OMC" < "$OUT/stream.om" > "$OUT/stream" |
| 62 | # Require successful compilation, nonempty static AArch64 EXEC, then chmod700. |
| 63 | timeout 10 "$OUT/stream" < public-frame.bin |
| 64 | ``` |
| 65 | |
| 66 | A frame is `u32le(task_length) || manifest || u32le(output_length) || observed_output`. EOF is required. The reader handles fragmented reads, refuses truncation/trailing bytes and reads at most5137 bytes. It never opens a file or launches a process. An open pipe can stall: the caller's existing deadline/isolation is required; no native wall-clock/process supervisor is claimed. |
| 67 | |
| 68 | Native test construction follows the same concatenation with `tests/learn53/fixtures.om` plus `unit.om`. The frame tests add `wire.om`, `stream-fixtures.om`, `stream-unit.om`. The public emitter substitutes `stream-input.om` and reads one mode byte:0 valid,1 wrong result,2 truncated,3 extra byte,4 forged length,5 final-pool refusal. `stream-check.om` independently checks the exact success diagnostic. No test runner or compiler wrapper in another implementation language was added. |
| 69 | |
| 70 | ## Acceptance still pending |
| 71 | |
| 72 | 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. |
| 73 | |
| 74 | ## Joint resident MoE operation-instance binding v2 |
| 75 | |
| 76 | `native/learn53/moe-closure.om` extends this existing task/evaluator custody |
| 77 | boundary for #35/#53/#159/#26/#17. It is not another benchmark, task catalog, |
| 78 | artifact registry, receipt validator, signer or source of qualification authority. |
| 79 | Its immutable dependencies are in `moe-closure.lock`. The unchanged |
| 80 | `omega653.lock` and `omega-adapter.om` still own public CUL1 observation and |
| 81 | attempt accounting. No MoE numerical oracle or full-cost measurement is |
| 82 | invented here. The caller obtains those outcomes from the existing independent |
| 83 | #16/#17/#53 owners and retains their actual result provenance. |
| 84 | |
| 85 | ### Subject versus live instance |
| 86 | |
| 87 | There are two deliberately distinct identities: |
| 88 | |
| 89 | 1. The independently frozen **approved joint subject**, already present in |
| 90 | selector `q18..21` and row37..40. One owner-resolved subject binds the approved |
| 91 | complete graph, its alternatives and exact allowed GU/DN partners. It remains |
| 92 | invariant across incumbent/alternative comparison. Equal digests are necessary |
| 93 | metadata, not proof of approved custody. |
| 94 | 2. The **operation-instance SHA256** returned by `mc_bind`/`mc_bindctx`, binding |
| 95 | one exact selected pair and one retained live allocation/session snapshot. |
| 96 | It is consumption-time metadata, never a replacement for q18, workload, |
| 97 | policy, applicability or qualification identity. New allocations can change |
| 98 | it without rewriting immutable qualification records. |
| 99 | |
| 100 | All embedded identity groups are independently frozen inputs. None is defined |
| 101 | as a hash of this instance wire or of a receipt containing its instance digest. |
| 102 | Terminal result custody is outside the preimage. In particular applicability |
| 103 | and qualification-context groups must not be made recursively self-referential. |
| 104 | |
| 105 | The expected wire belongs to the existing immutable owner-resolved bundle. |
| 106 | The observed wire is independently assembled from actual selected artifacts, |
| 107 | actual canonical Quant/Composer metadata and launch, and retained allocation |
| 108 | owner state under the existing graph/session lock. Copying expected metadata |
| 109 | into observed metadata does not establish observation. Allocation ownership, |
| 110 | directory/tensor coherence, immutable template validation, protected evaluator |
| 111 | execution and authentication remain their existing owners' obligations. |
| 112 | |
| 113 | ### One canonical wire |
| 114 | |
| 115 | Capacity is `uchar16384`. Exact active length is11264 bytes. Integers are |
| 116 | unsigned64, explicitly little-endian. There are no native structs or alternate |
| 117 | encodings. Byte0..1023 contains scalar128. Byte1024..3071 contains64 raw SHA256 |
| 118 | groups. Byte3072..11263 contains128 ordered window rows of eight LE64 cells. |
| 119 | Unused window cells, reserved scalars and bytes11264..16383 must be zero. |
| 120 | Both expected and observed descriptors are validated before exact comparison. |
| 121 | Even two byte-equal malformed descriptors refuse. |
| 122 | |
| 123 | | Scalar cell | Meaning and required value | |
| 124 | | --- | --- | |
| 125 | |0,1,2|Version2, domain159, exact active length11264| |
| 126 | |3,4|Complete window count1..128, selected zero-based ordinal less than count| |
| 127 | |5,6,7,8|Total tokens1..128; selected window token0, token count and R| |
| 128 | |9,10|H2048, EI512| |
| 129 | |11,12,13,14,15|Routed expert count256, routed picks8, contributions9, shared expert256, incumbent window capacity128| |
| 130 | |16|Actual router byte stride, u32 range, multiple16, at least144| |
| 131 | |17,18,19,20|Actual session epoch (zero valid), exact admitted profile121, live buffer-owner generation, frozen lifecycle identity (nonzero)| |
| 132 | |21,22|Layer index, tensor/directory owner generation| |
| 133 | |23|Alias policy0; exact permitted lifetimes/aliases also bound by group58| |
| 134 | |24..31|Effects, router, stable ordering, permutation, SwiGLU, combine, numerical, completion revisions: each1| |
| 135 | |32..63|Resources0..7, four cells each as below| |
| 136 | |64..72|Explicit original contribution order0,1,2,3,4,5,6,7,8. Shared slot8 is mandatory, including zero-weight contributions| |
| 137 | |73,74|Full map entry capacity exactly total_tokens*9+8; segment capacity128 including trailing zero descriptors| |
| 138 | |75,76|flush_each0; exact original head8 mode0 or1| |
| 139 | |77,78,79|Layer count positive; last-layer flag exactly `(layer+1==layer_count)`; incumbent combine variant1| |
| 140 | |80..111|Resources8..15, four cells each| |
| 141 | |112..115|GU input mapX1/output mapY2; DN input mapY2/output mapY2| |
| 142 | |116..121|Map padding8; duplicate-preserving sort1, mandatory shared1, barrier-reuse policy1, window-local maps1, original weight-slot policy1| |
| 143 | |122,123|Exact GU and DN final code byte lengths, positive/multiple16/at most16384| |
| 144 | |124..127|Reserved0| |
| 145 | |
| 146 | Each resource is `{baseVA, actual_allocation_extent_bytes, owner_generation, |
| 147 | row_or_element_stride_bytes}`. All VAs are nonzero/eight-byte aligned; extents |
| 148 | must cover their required full-operation footprint and not wrap the address |
| 149 | domain; resource generation matches scalar19 except tensor resources14/15 |
| 150 | which match scalar22. Ownership is not inferred from alignment or a claimed VA. |
| 151 | |
| 152 | |Resource|Role|Stride| |
| 153 | |---|---|---| |
| 154 | |0,1,2,3|Router IDs, original weights, GU directory, DN directory|Actual scalar16| |
| 155 | |4,5|GU/DN Seg32 descriptors|32| |
| 156 | |6,7|X/Y maps|4| |
| 157 | |8|XP activation|H*4| |
| 158 | |9|GU output|9*EI*8| |
| 159 | |10,11|SwiGLU activation and permuted activation|9*EI*4| |
| 160 | |12|DN contribution output|9*H*4| |
| 161 | |13|Original combine output|H*4| |
| 162 | |14,15|Corresponding GU/DN tensor allocations|Actual positive physical stride, interpreted by canonical Quant/directory owner| |
| 163 | |
| 164 | The existing `moe_windows` is the only window planner. `mc_windows` compares the |
| 165 | entire table against its exact output, including ragged final rows and byte |
| 166 | offsets; arbitrary contiguous repartitions are not accepted. Each row is |
| 167 | `{token0,tokens,R,XPbytes,GUbytes,ACTbytes,DNbytes,routerbytes}`. Selected scalar6..8 |
| 168 | must match that exact ordinal. GROUP uses window-local X=t,Y=t*9+slot; global |
| 169 | token0 is represented by shifted bases, never added twice to map values. |
| 170 | Both GU/DN use M=R and R descriptors including zero-count trailing descriptors. |
| 171 | The existing `moe_alias` independently checks GROUP read/write and write/write |
| 172 | bounding spans at the selected offsets. Broader graph alias/lifetime rules |
| 173 | remain the owner-validated policy bound in group58 and the retained snapshot. |
| 174 | |
| 175 | Runtime router ID/weight values are device-produced inputs, **not host readback |
| 176 | or code identity**. The producer/domain/ABI, live allocations/generations and |
| 177 | paired tensor directories are bound. Routed IDs must remain in0..255; duplicate |
| 178 | expert picks retain distinct original slots; shared256/slot8 remains explicit. |
| 179 | The live owner checks table/directory coherence, not this host byte predicate. |
| 180 | Weight contents do not become code identity unless they actually alter emitted |
| 181 | code. Tensor/checkpoint identities remain separate. |
| 182 | |
| 183 | ### SHA256 group dictionary |
| 184 | |
| 185 | Every group is required and nonzero. These are raw32-byte digests, not printed |
| 186 | hex or caller-selected short IDs. |
| 187 | |
| 188 | |Groups|Ordered identities| |
| 189 | |---|---| |
| 190 | |0..8|Model, config, checkpoint, exact source, compiler, encoder source, semantic spec, independent evaluator executable/source closure, numerical contract| |
| 191 | |9|Router semantic contract| |
| 192 | |10..21|Ordered code/launch **series** for GROUP, router, PERM_XO, SwiGLU, PERM_ACT and combine; mandatory even for one entry| |
| 193 | |22..29|GU canonical1152, final code, launch256, existing full manifest, parameter ABI, immutable cbank template, zero-VA QMD template, canonical Quant384| |
| 194 | |30..37|DN identities in the same order| |
| 195 | |38..43|Workload equivalence, approved joint subject, policy, measurement protocol, GU incumbent canonical artifact, GU applicability| |
| 196 | |44|Independently frozen joint qualification-context/bundle identity| |
| 197 | |45,46,47|GU/DN tensor-directory identities, live allocation-owner snapshot identity| |
| 198 | |48..52|Lifecycle protocol, router ABI/domain, permutation tables, barrier dependency DAG, original scale/head8/last-layer combine protocol| |
| 199 | |53,54|DN incumbent canonical artifact, DN applicability (may differ from GU)| |
| 200 | |55..60|Evaluation protocol, paired transformation lineage, original quant/numerical profile, alias/lifetime policy, completion/recovery policy, complete router allowed-domain contract| |
| 201 | |61,62,63|GU operation semantic digest, DN operation semantic digest, evaluator result-custody protocol| |
| 202 | |
| 203 | Group44 is an **input context identity**, not a new trusted-record claim. The |
| 204 | parent alone determines whether an existing independent qualification bundle is |
| 205 | accepted. Host fixture hashes never populate production records. No gate masks, |
| 206 | qualification bits or signed receipts are created or modified by these APIs. |
| 207 | |
| 208 | Version2 replaces direct entry hashes in groups10..21 with complete ordered |
| 209 | role-series hashes. Version1 is refused; there is no direct-leaf compatibility |
| 210 | path. Nested preimages retain their own version1/domain159 subtype tags. |
| 211 | |
| 212 | ### Integration API |
| 213 | |
| 214 | All functions are native seeded Omega, nonconcurrent fixed-array calls. Exported |
| 215 | roots return `long`, supported by existing omega-bridge ABI1; no global scratch. |
| 216 | |
| 217 | ``` |
| 218 | mc_pack(scalars view ulong128, hashes view uchar2048, |
| 219 | windows view ulong1024, wire edit uchar16384) -> long |
| 220 | mc_valid(wire view uchar16384, n ulong) -> long |
| 221 | mc_bind(expected view uchar16384, observed view uchar16384, n ulong, |
| 222 | instanceSHA edit uchar32) -> long |
| 223 | mc_context(wire view uchar16384, q view ulong64, |
| 224 | selectedRow view ulong64, role ulong) -> long |
| 225 | mc_bindctx(expected view uchar16384, observed view uchar16384, |
| 226 | q view ulong64, selectedRow view ulong64, |
| 227 | role ulong, instanceSHA edit uchar32) -> long |
| 228 | mc_blob(wire view uchar16384, canonical view uchar4096, |
| 229 | code view uchar16384, codeLength ulong, |
| 230 | launch view uchar256, role ulong) -> long |
| 231 | mc_custody(wire view uchar16384, retainedInstanceSHA view uchar32, |
| 232 | frozenExecutorContext view ulong32, |
| 233 | observedExecutorContext view ulong32) -> long |
| 234 | ``` |
| 235 | |
| 236 | Role0 is GU; role1 DN. Other roles refuse. `mc_context` requires selected family3, |
| 237 | binds q3..6/row17..20 and six q14/18/22/26/30/34 digest groups against |
| 238 | row33/37/41/45/49/53 and this wire. DN uses groups53/54 for its incumbent and |
| 239 | applicability, not GU42/43. It also binds selected row21..24 artifact, |
| 240 | row25..28 launch, row29..32 bundle and row57..60 final code to the correct |
| 241 | paired role. It does **not** run selection, accept row gate masks as authority, |
| 242 | authenticate records, or make an ineligible row eligible. |
| 243 | |
| 244 | `mc_bindctx` is the one combined integration root: clear output, check context, |
| 245 | validate both wires, exact-compare bytes, hash actual active11264 with the |
| 246 | unchanged cache SHA256. Failure clears all32 digest bytes. `mc_pack` is the |
| 247 | only field serializer; failure clears the whole output. Status0 means only |
| 248 | binding succeeded;1 malformed/canonicality,2 unsupported semantic/table |
| 249 | contract,3 resource extent/stride/generation/alias,4 unequal valid wires, |
| 250 | 5 owner context/custody mismatch,6 canonical payload binding refused. |
| 251 | |
| 252 | `mc_blob` uses unchanged Composer validation/launch validation and unchanged |
| 253 | cache SHA256 over actual canonical1152/codeLength/launch256 bytes. It checks |
| 254 | role-specific shapes, exact code lengths, compiler/encoder/spec and operation |
| 255 | semantic digests, canonical embedded code/launch digests, launch15..26 ABI/cbank/ |
| 256 | QMD digests and Quant384. The existing full manifest and actual ABI/template |
| 257 | payload validation remain the artifact owner's admission API, never replaced |
| 258 | by matching claimed hashes. Mapped family3 remains refused by the pinned |
| 259 | Composer; this component does not weaken that gate. |
| 260 | |
| 261 | `mc_custody` extends #53's result identity boundary without accepting a claimed |
| 262 | PASS or outcome. The32 executor context cells are version1, evidence class1 |
| 263 | HOST_ONLY, instanceSHA4, evaluatorSHA4, sourceSHA4, result-protocolSHA4, |
| 264 | approved-joint-subjectSHA4, qualification-contextSHA4, reserved6zero. All SHA |
| 265 | limbs are explicitly LE64. Frozen and observed contexts must match exactly and |
| 266 | match the validated wire and retained instance SHA. Class2/device claims |
| 267 | refuse even when the two supplied arrays agree. This is not a protected executor |
| 268 | or numerical result evaluator; same-process hostile callers remain outside its |
| 269 | custody guarantee, as for `aobserve`/`aattempt`. |
| 270 | |
| 271 | The existing integration owner must select once, resolve by immutable ordinal, |
| 272 | independently collect actual metadata/payloads, validate actual manifest/ABI/ |
| 273 | templates and paired graph subject, call the byte/context predicates, and retain |
| 274 | that exact selection and snapshot through existing record/submit/completion |
| 275 | leases. No second shape-based lookup or independently selected DN is permitted. |
| 276 | Do not copy the instance hash into q/row identities or overwrite accepted |
| 277 | qualification history. Production record count remains zero until real |
| 278 | independent accepted hardware/full-workload records exist. |
| 279 | |
| 280 | ### Canonical nested live-observation preimages |
| 281 | |
| 282 | The following pure Omega roots define groups10..21,45..47 in this same owner. |
| 283 | These are **live-instance** identities. They are not Composer launch256 |
| 284 | identities, synthesized parameter ABIs, zero-VA templates, qualification |
| 285 | subjects, or new authority. No existing incumbent-glue address normalizer was |
| 286 | found: admitted native templates remain exact admitted bytes under their |
| 287 | existing owner. Live code, bank, QMD, directory and allocation VAs stay live |
| 288 | here. Never zero pointers or hash weight contents to manufacture code identity. |
| 289 | All input arrays and each output32 must be disjoint. |
| 290 | |
| 291 | ``` |
| 292 | mc_code(code view uchar16384, n ulong, out edit uchar32) -> long |
| 293 | mc_launch(meta view ulong32, bank view uchar1024, |
| 294 | qmdslot view uchar1024, submit view ulong16, |
| 295 | out edit uchar32) -> long |
| 296 | mc_dir(meta view ulong8, entries view ulong1024, out edit uchar32) -> long |
| 297 | mc_alloc(meta view ulong8, records view ulong1024, out edit uchar32) -> long |
| 298 | ``` |
| 299 | |
| 300 | Every refusal clears output32. `mc_code` requires positive exact encoded |
| 301 | length, multiple16 and at most16384. It hashes exactly that prefix through |
| 302 | the existing `kc_codesha`, excluding the allocation's instruction-prefetch |
| 303 | tail. This bound follows existing `BW_MAX_IR_INSNS=1024`; exceeding it refuses |
| 304 | instead of truncating. Actual code residency/VA-to-byte membership is the |
| 305 | existing allocation owner's responsibility. |
| 306 | |
| 307 | `mc_launch` binds the **already emitted command-list entry**, not requested |
| 308 | launch fields or a reimplementation of QMD/default policy: |
| 309 | |
| 310 | |Meta cell|Actual retained observation| |
| 311 | |---|---| |
| 312 | |0,1,2|Version1, domain159, live-entry subtype1| |
| 313 | |3|Kernel role0 GROUP,1 router,2 PERM_XO,3 SwiGLU,4 PERM_ACT,5 combine| |
| 314 | |4,5|Active argument-word count1..32; exact encoded code byte length| |
| 315 | |6,7|Entry ordinal; positive command-list record generation| |
| 316 | |8,9|Actual independent flag0/1; actual pending-wait VA0 or eight-byte aligned| |
| 317 | |10|Actual resident code VA, nonzero/16-byte aligned; must equal PROGRAM_ADDRESS decoded from actual QMD1 words32/33| |
| 318 | |11..31|Reserved0| |
| 319 | |
| 320 | |Submit cell|Actual consumed submission configuration| |
| 321 | |---|---| |
| 322 | |0,1,2|Version1, domain159, submission subtype4| |
| 323 | |3|Positive record generation, equal launch meta7| |
| 324 | |4,5|Mode0 PCAS/1 INLINE; barrier enum0..4| |
| 325 | |6,7|Resolved timeout in ms, positive; resolved marker spin in us, at most1000000| |
| 326 | |8,9,10|Stamps0/1; skip-launch exactly0; first-barrier-none0/1| |
| 327 | |11|Final recorded launch count1..4096; launch ordinal must be below it| |
| 328 | |12..15|Reserved0| |
| 329 | |
| 330 | Canonical preimage order is all32 meta cells as LE64, all16 submit cells as |
| 331 | LE64, actual bank bytes `[0,896+4*nargs)`, actual QMD1 slot bytes `[0,384)`, |
| 332 | then actual QMD0 slot bytes `[512,896)`. This includes the existing224-word |
| 333 | driver bank and actual32-bit argument words; it cannot truncate widened |
| 334 | argument values because it consumes their actual retained bytes. Bank |
| 335 | padding after active arguments and QMD slot gaps are deliberately excluded. |
| 336 | Effective GPR/thread dimensions/shared allocation/grid/code/context pointers |
| 337 | are the actual emitted QMD bytes, not independently recomputed rounded |
| 338 | requested values. These raw snapshots do not independently validate a QMD; |
| 339 | the existing command-list builder/validator remains its owner. |
| 340 | |
| 341 | The snapshot must contain the **mode-final representation actually emitted**, |
| 342 | not an earlier retained QMD. The existing emitter patches QMD1 words10/12: |
| 343 | PCAS zeros them, whereas INLINE installs its dependent-QMD fields in a local |
| 344 | copy. In particular, retained storage after PCAS is not the later INLINE |
| 345 | representation. The consuming owner must prepare/capture those same final |
| 346 | bytes before binding and must consume them unchanged. Observe every entry and |
| 347 | every chunk before the **first** queue commit; a refusal after an earlier |
| 348 | chunk was submitted is not an unsubmitted-list refusal. |
| 349 | |
| 350 | This preimage binds recorded independence, pending wait, consumed options and |
| 351 | entry QMD/bank bytes. It does not alone bind the complete effective method |
| 352 | stream or chunk schedule: effective barriers also depend on ring capacity, |
| 353 | platform prefix and chunk boundaries. Group51 remains the owning dependency-DAG |
| 354 | contract; callers must not inflate this helper into effective-barrier evidence. |
| 355 | |
| 356 | `OmegaGpuLaunch.timeout_ms` and `.spin_us` are ignored by command-list add. |
| 357 | The live digest instead binds the **same resolved submission values actually |
| 358 | consumed**. Observing a global spin default separately, even under the session |
| 359 | lock, is not enough: its original setter did not take that lock. The consuming |
| 360 | owner must capture once and consume unchanged, or invoke binding at the exact |
| 361 | consumption point with the already resolved values. Actual final-list |
| 362 | observation/binding follows recording but precedes any queue commit; refusal |
| 363 | aborts the unsubmitted list without incumbent fallback. This is not terminal |
| 364 | completion evidence, a post-submit receipt, or permission to submit. |
| 365 | |
| 366 | `mc_dir` metadata is `{1,159,2,role,count,owner_generation,layer,0}`. |
| 367 | Role0 GU/1 DN, count exactly257, owner generation positive and layer a u32 |
| 368 | including zero. Entries0..513 contain all257 ordered `{W_VA,S_VA}` pairs; |
| 369 | each VA is positive/eight-byte aligned. Entries514..1023 must be zero. |
| 370 | SHA256 covers the8 LE64 metadata cells followed by the514 LE64 address cells, |
| 371 | exactly4176 bytes. No weight/scale data or invented contiguous W+S envelope |
| 372 | is included. The existing directory owner supplies and retains this complete |
| 373 | actual snapshot, including mutations through its existing setter. |
| 374 | |
| 375 | `mc_alloc` metadata is |
| 376 | `{1,159,3,active_count,graph_owner_gen,tensor_owner_gen,lifecycle_gen,0}`. |
| 377 | Count is1..64; the three owner generations are positive. There are64 records, |
| 378 | each16 LE64 cells: |
| 379 | |
| 380 | ``` |
| 381 | {role,index,handle_generation,kind,allocation_VA,physical_bytes, |
| 382 | resource_VA,available_bytes,owner_generation,0,0,0,0,0,0,0} |
| 383 | ``` |
| 384 | |
| 385 | Active roles are strictly ascending and below64; role coverage belongs to |
| 386 | the complete operation observer, not a generic invented required-role list. |
| 387 | Index0 is valid; index/generation are u32 and generation is nonzero. Kind2 |
| 388 | means data buffer,3 code buffer,4 queue/push **buffer**, never a submission |
| 389 | queue/channel handle. All VAs are positive/eight-byte aligned, extents |
| 390 | positive/nonwrapping; each resource is a real contained allocation subspan. |
| 391 | The same buffer index cannot claim differing generations, kinds, backing |
| 392 | VAs or physical extents. Multiple roles/subranges sharing the same handle |
| 393 | are legitimate and preserved. Unused record cells are zero. SHA256 covers |
| 394 | the8 metadata cells and all1024 record cells as LE64, exactly8256 bytes. |
| 395 | |
| 396 | Resource-role generations in the outer wire remain owner-lease generations, |
| 397 | not individual handle generations. This snapshot separately binds the latter. |
| 398 | The observer must cover actual separate W/S allocations, enclosing buffers, |
| 399 | router/glue/leased code and command-list-owned buffers where applicable. |
| 400 | Unused graph buffers are not invented reads. These structural checks do not |
| 401 | attest registry membership, current ownership or lifetime: the existing owner |
| 402 | retains that responsibility under the same observed lease/snapshot. |
| 403 | |
| 404 | ### Complete ordered code and launch series |
| 405 | |
| 406 | ``` |
| 407 | mc_series(meta view ulong8, leafSHAs view uchar4096, |
| 408 | ordinals view ulong128, out edit uchar32) -> long |
| 409 | ``` |
| 410 | |
| 411 | This is the only aggregation format for groups10..21, including singleton |
| 412 | roles. Metadata is `{1,159,5,role,kind,count,record_generation,full_count}`. |
| 413 | Roles0..5 have the same order as `mc_launch`; kind0 is encoded-code identity, |
| 414 | kind1 is launch identity; count is1..128. This covers the complete existing |
| 415 | operation bound, not a new64-token limit. Router recording can require multiple |
| 416 | 64-row entries, and combine can require a separate entry for every token. |
| 417 | The observer must cover **all** such occurrences; it may not pick first/last, |
| 418 | deduplicate identical code, or truncate. More than128 occurrences is refused. |
| 419 | The full command list can still have4096 entries and actual ordinal4095. |
| 420 | |
| 421 | Code metadata requires generation/full_count both0 and all ordinals0. Its |
| 422 | preimage is all8 metadata cells as LE64 followed by all4096 leaf-digest bytes. |
| 423 | Code occurrences retain their actual execution order and count, but do not |
| 424 | acquire runtime addresses, generations or weight data as encoded-code identity. |
| 425 | Launch metadata requires positive actual record generation and full_count |
| 426 | 1..4096. Active ordinals must be strictly increasing and below full_count; |
| 427 | inactive ordinals must be0. Its preimage is all8 metadata cells as LE64, all128 |
| 428 | ordinals as LE64, then all4096 digest bytes. Each active32-byte digest must be |
| 429 | nonzero and every inactive digest byte must be0 for both kinds. Refusal clears |
| 430 | out; status1 is malformed metadata/reserved data,3 is a zero active digest, |
| 431 | 6 is hashing refusal. |
| 432 | |
| 433 | The owner gathers both arrays in **one actual-entry traversal**. Code slot |
| 434 | `i` and launch slot `i` must refer to the same actual entry, in ascending actual |
| 435 | ordinal order, with identical series role and count. A launch leaf's role, |
| 436 | ordinal, generation and final-list count must agree with its series metadata |
| 437 | and ordinal. Each code leaf comes from `mc_code` over the actual exact code |
| 438 | bytes; each launch leaf comes from `mc_launch` over that same observed entry. |
| 439 | Code series goes to group`10+2*role`, launch series to`11+2*role`. These |
| 440 | correspondence/provenance obligations cannot be recovered from opaque digests |
| 441 | by `mc_series`, nor does hashing two supplied lists establish them. A valid |
| 442 | leaf from another ordinal/generation must be refused by the observer before |
| 443 | aggregation. No caller qualification flag substitutes for these checks. |
| 444 | |
| 445 | ### Host controls and remaining gates |
| 446 | |
| 447 | `tests/learn53/moe-fixtures.om` is explicitly synthetic HOST_ONLY metadata. |
| 448 | `moe-unit.om` checks every scalar and SHA role, every window cell, reserved |
| 449 | capacity, invalid length, identical malformed wires, GU/DN role mixing, all |
| 450 | selector identity limbs, session context, stale digest clearing, serializer |
| 451 | roundtrip/refusal clearing and executor-custody substitution. Independent literal |
| 452 | one-token and ragged two-window oracles are not a second planner. `moe-export.om` |
| 453 | emits the one-token wire/hash for mode0/1, or the15-token two-window wire/hash |
| 454 | for mode2/3. Read-only external `sha256sum` independently checks both results. |
| 455 | |
| 456 | The mounted Wolfram evaluator verified the source-derived layout, without |
| 457 | warnings. These are synthetic layout calculations, not measurements: |
| 458 | |
| 459 | ``` |
| 460 | WolframLanguageEvaluator: |
| 461 | {Expand[32*(9*t)],9*n+8,3072+8*i,128*8+64*32+128*8*8} |
| 462 | -> {288*t,8+9*n,3072+8*i,11264} |
| 463 | |
| 464 | WolframLanguageEvaluator: |
| 465 | ({#[[1]],#[[2]],9 #[[2]],#[[1]]2048 4,#[[1]]9 512 8, |
| 466 | #[[1]]9 512 4,#[[1]]9 2048 4,#[[1]]256}& /@ {{0,14},{14,1}}) |
| 467 | -> {{0,14,126,0,0,0,0,0},{14,1,9,114688,516096,258048,1032192,3584}} |
| 468 | ``` |
| 469 | |
| 470 | `tests/learn53/moe-host-evidence.json` remains the immutable historical |
| 471 | Version1 source receipt at commit32af495. The separate |
| 472 | `moe-observe-host-evidence.json` records the Version2 replay, nested preimages, |
| 473 | ordered-series controls, independent byte/SHA oracles and verifier mutants. |
| 474 | The original three mutants removed exact wire, result-custody and selected |
| 475 | paired-artifact comparison. New controls challenge both QMD regions, consumed |
| 476 | options, all257 W/S pairs, buffer aliases/backing, and every series digest/ |
| 477 | ordinal cell, including128 occurrences and ordinal4095. These are synthetic |
| 478 | HOST_ONLY tests, not snapshots of actual recorded or submitted GPU work. |
| 479 | |
| 480 | To construct a native test, export exact Git objects listed in |
| 481 | `moe-closure.lock`, verify each source SHA and concatenate in listed order, |
| 482 | followed by `native/learn53/moe-closure.om`. For the outer closure, append |
| 483 | `moe-fixtures.om` then `moe-unit.om` or `moe-export.om`. For nested observations, |
| 484 | append `moe-observe-fixtures.om` then `moe-observe-unit.om` or |
| 485 | `moe-observe-export.om`; for ordered series use that same observation fixture |
| 486 | followed by `moe-series-unit.om` or `moe-series-export.om`. Paths are relative to |
| 487 | `tests/learn53/`. Compile with the lock's independently pinned compiler; never |
| 488 | execute failed/stale output. No production build/runtime, source registry or |
| 489 | new host-language implementation is introduced. |
| 490 | |
| 491 | Actual protected evaluator execution, independent finite-FP/numerical/model |
| 492 | quality results, measured full-cost comparison, accepted hardware receipts, |
| 493 | full consuming graph qualification and GPU execution are **NOT_RUN** here. |
| 494 | Matching byte metadata is not a hardware-qualified receipt or graph authority. |