interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / docs / learn53 / CONTRACT.md

494 lines · 33105 bytes Raw Blame History Rendered
1# CUL1 public native-host task contract
2
3Scope: 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
9The 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
13One 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
35A 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
37Registered 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
43The 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
47Candidate 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
49Statuses: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
53Build only with the explicit, source-reconstructed compiler SHA256
54`191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`.
55Qualified source import: omega-bridge `0fc7d8662cb799e7c206b17c18ea4c3ec2b8fea9`, seed origin omega-mv `29b12760f4c962606411d6bf25032aedef063301`.
56
57Existing development commands on Linux AArch64, with a private fresh output directory and `OMC` pointing to that verified compiler:
58
59```sh
60cat 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.
63timeout 10 "$OUT/stream" < public-frame.bin
64```
65
66A 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
68Native 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
72Omega653 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
77boundary for #35/#53/#159/#26/#17. It is not another benchmark, task catalog,
78artifact registry, receipt validator, signer or source of qualification authority.
79Its immutable dependencies are in `moe-closure.lock`. The unchanged
80`omega653.lock` and `omega-adapter.om` still own public CUL1 observation and
81attempt accounting. No MoE numerical oracle or full-cost measurement is
82invented 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
87There are two deliberately distinct identities:
88
891. 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.
942. 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
100All embedded identity groups are independently frozen inputs. None is defined
101as a hash of this instance wire or of a receipt containing its instance digest.
102Terminal result custody is outside the preimage. In particular applicability
103and qualification-context groups must not be made recursively self-referential.
104
105The expected wire belongs to the existing immutable owner-resolved bundle.
106The observed wire is independently assembled from actual selected artifacts,
107actual canonical Quant/Composer metadata and launch, and retained allocation
108owner state under the existing graph/session lock. Copying expected metadata
109into observed metadata does not establish observation. Allocation ownership,
110directory/tensor coherence, immutable template validation, protected evaluator
111execution and authentication remain their existing owners' obligations.
112
113### One canonical wire
114
115Capacity is `uchar16384`. Exact active length is11264 bytes. Integers are
116unsigned64, explicitly little-endian. There are no native structs or alternate
117encodings. Byte0..1023 contains scalar128. Byte1024..3071 contains64 raw SHA256
118groups. Byte3072..11263 contains128 ordered window rows of eight LE64 cells.
119Unused window cells, reserved scalars and bytes11264..16383 must be zero.
120Both expected and observed descriptors are validated before exact comparison.
121Even 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
146Each resource is `{baseVA, actual_allocation_extent_bytes, owner_generation,
147row_or_element_stride_bytes}`. All VAs are nonzero/eight-byte aligned; extents
148must cover their required full-operation footprint and not wrap the address
149domain; resource generation matches scalar19 except tensor resources14/15
150which 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
164The existing `moe_windows` is the only window planner. `mc_windows` compares the
165entire table against its exact output, including ragged final rows and byte
166offsets; arbitrary contiguous repartitions are not accepted. Each row is
167`{token0,tokens,R,XPbytes,GUbytes,ACTbytes,DNbytes,routerbytes}`. Selected scalar6..8
168must match that exact ordinal. GROUP uses window-local X=t,Y=t*9+slot; global
169token0 is represented by shifted bases, never added twice to map values.
170Both GU/DN use M=R and R descriptors including zero-count trailing descriptors.
171The existing `moe_alias` independently checks GROUP read/write and write/write
172bounding spans at the selected offsets. Broader graph alias/lifetime rules
173remain the owner-validated policy bound in group58 and the retained snapshot.
174
175Runtime router ID/weight values are device-produced inputs, **not host readback
176or code identity**. The producer/domain/ABI, live allocations/generations and
177paired tensor directories are bound. Routed IDs must remain in0..255; duplicate
178expert picks retain distinct original slots; shared256/slot8 remains explicit.
179The live owner checks table/directory coherence, not this host byte predicate.
180Weight contents do not become code identity unless they actually alter emitted
181code. Tensor/checkpoint identities remain separate.
182
183### SHA256 group dictionary
184
185Every group is required and nonzero. These are raw32-byte digests, not printed
186hex 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
203Group44 is an **input context identity**, not a new trusted-record claim. The
204parent alone determines whether an existing independent qualification bundle is
205accepted. Host fixture hashes never populate production records. No gate masks,
206qualification bits or signed receipts are created or modified by these APIs.
207
208Version2 replaces direct entry hashes in groups10..21 with complete ordered
209role-series hashes. Version1 is refused; there is no direct-leaf compatibility
210path. Nested preimages retain their own version1/domain159 subtype tags.
211
212### Integration API
213
214All functions are native seeded Omega, nonconcurrent fixed-array calls. Exported
215roots return `long`, supported by existing omega-bridge ABI1; no global scratch.
216
217```
218mc_pack(scalars view ulong128, hashes view uchar2048,
219 windows view ulong1024, wire edit uchar16384) -> long
220mc_valid(wire view uchar16384, n ulong) -> long
221mc_bind(expected view uchar16384, observed view uchar16384, n ulong,
222 instanceSHA edit uchar32) -> long
223mc_context(wire view uchar16384, q view ulong64,
224 selectedRow view ulong64, role ulong) -> long
225mc_bindctx(expected view uchar16384, observed view uchar16384,
226 q view ulong64, selectedRow view ulong64,
227 role ulong, instanceSHA edit uchar32) -> long
228mc_blob(wire view uchar16384, canonical view uchar4096,
229 code view uchar16384, codeLength ulong,
230 launch view uchar256, role ulong) -> long
231mc_custody(wire view uchar16384, retainedInstanceSHA view uchar32,
232 frozenExecutorContext view ulong32,
233 observedExecutorContext view ulong32) -> long
234```
235
236Role0 is GU; role1 DN. Other roles refuse. `mc_context` requires selected family3,
237binds q3..6/row17..20 and six q14/18/22/26/30/34 digest groups against
238row33/37/41/45/49/53 and this wire. DN uses groups53/54 for its incumbent and
239applicability, not GU42/43. It also binds selected row21..24 artifact,
240row25..28 launch, row29..32 bundle and row57..60 final code to the correct
241paired role. It does **not** run selection, accept row gate masks as authority,
242authenticate records, or make an ineligible row eligible.
243
244`mc_bindctx` is the one combined integration root: clear output, check context,
245validate both wires, exact-compare bytes, hash actual active11264 with the
246unchanged cache SHA256. Failure clears all32 digest bytes. `mc_pack` is the
247only field serializer; failure clears the whole output. Status0 means only
248binding succeeded;1 malformed/canonicality,2 unsupported semantic/table
249contract,3 resource extent/stride/generation/alias,4 unequal valid wires,
2505 owner context/custody mismatch,6 canonical payload binding refused.
251
252`mc_blob` uses unchanged Composer validation/launch validation and unchanged
253cache SHA256 over actual canonical1152/codeLength/launch256 bytes. It checks
254role-specific shapes, exact code lengths, compiler/encoder/spec and operation
255semantic digests, canonical embedded code/launch digests, launch15..26 ABI/cbank/
256QMD digests and Quant384. The existing full manifest and actual ABI/template
257payload validation remain the artifact owner's admission API, never replaced
258by matching claimed hashes. Mapped family3 remains refused by the pinned
259Composer; this component does not weaken that gate.
260
261`mc_custody` extends #53's result identity boundary without accepting a claimed
262PASS or outcome. The32 executor context cells are version1, evidence class1
263HOST_ONLY, instanceSHA4, evaluatorSHA4, sourceSHA4, result-protocolSHA4,
264approved-joint-subjectSHA4, qualification-contextSHA4, reserved6zero. All SHA
265limbs are explicitly LE64. Frozen and observed contexts must match exactly and
266match the validated wire and retained instance SHA. Class2/device claims
267refuse even when the two supplied arrays agree. This is not a protected executor
268or numerical result evaluator; same-process hostile callers remain outside its
269custody guarantee, as for `aobserve`/`aattempt`.
270
271The existing integration owner must select once, resolve by immutable ordinal,
272independently collect actual metadata/payloads, validate actual manifest/ABI/
273templates and paired graph subject, call the byte/context predicates, and retain
274that exact selection and snapshot through existing record/submit/completion
275leases. No second shape-based lookup or independently selected DN is permitted.
276Do not copy the instance hash into q/row identities or overwrite accepted
277qualification history. Production record count remains zero until real
278independent accepted hardware/full-workload records exist.
279
280### Canonical nested live-observation preimages
281
282The following pure Omega roots define groups10..21,45..47 in this same owner.
283These are **live-instance** identities. They are not Composer launch256
284identities, synthesized parameter ABIs, zero-VA templates, qualification
285subjects, or new authority. No existing incumbent-glue address normalizer was
286found: admitted native templates remain exact admitted bytes under their
287existing owner. Live code, bank, QMD, directory and allocation VAs stay live
288here. Never zero pointers or hash weight contents to manufacture code identity.
289All input arrays and each output32 must be disjoint.
290
291```
292mc_code(code view uchar16384, n ulong, out edit uchar32) -> long
293mc_launch(meta view ulong32, bank view uchar1024,
294 qmdslot view uchar1024, submit view ulong16,
295 out edit uchar32) -> long
296mc_dir(meta view ulong8, entries view ulong1024, out edit uchar32) -> long
297mc_alloc(meta view ulong8, records view ulong1024, out edit uchar32) -> long
298```
299
300Every refusal clears output32. `mc_code` requires positive exact encoded
301length, multiple16 and at most16384. It hashes exactly that prefix through
302the existing `kc_codesha`, excluding the allocation's instruction-prefetch
303tail. This bound follows existing `BW_MAX_IR_INSNS=1024`; exceeding it refuses
304instead of truncating. Actual code residency/VA-to-byte membership is the
305existing allocation owner's responsibility.
306
307`mc_launch` binds the **already emitted command-list entry**, not requested
308launch 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
330Canonical preimage order is all32 meta cells as LE64, all16 submit cells as
331LE64, actual bank bytes `[0,896+4*nargs)`, actual QMD1 slot bytes `[0,384)`,
332then actual QMD0 slot bytes `[512,896)`. This includes the existing224-word
333driver bank and actual32-bit argument words; it cannot truncate widened
334argument values because it consumes their actual retained bytes. Bank
335padding after active arguments and QMD slot gaps are deliberately excluded.
336Effective GPR/thread dimensions/shared allocation/grid/code/context pointers
337are the actual emitted QMD bytes, not independently recomputed rounded
338requested values. These raw snapshots do not independently validate a QMD;
339the existing command-list builder/validator remains its owner.
340
341The snapshot must contain the **mode-final representation actually emitted**,
342not an earlier retained QMD. The existing emitter patches QMD1 words10/12:
343PCAS zeros them, whereas INLINE installs its dependent-QMD fields in a local
344copy. In particular, retained storage after PCAS is not the later INLINE
345representation. The consuming owner must prepare/capture those same final
346bytes before binding and must consume them unchanged. Observe every entry and
347every chunk before the **first** queue commit; a refusal after an earlier
348chunk was submitted is not an unsubmitted-list refusal.
349
350This preimage binds recorded independence, pending wait, consumed options and
351entry QMD/bank bytes. It does not alone bind the complete effective method
352stream or chunk schedule: effective barriers also depend on ring capacity,
353platform prefix and chunk boundaries. Group51 remains the owning dependency-DAG
354contract; callers must not inflate this helper into effective-barrier evidence.
355
356`OmegaGpuLaunch.timeout_ms` and `.spin_us` are ignored by command-list add.
357The live digest instead binds the **same resolved submission values actually
358consumed**. Observing a global spin default separately, even under the session
359lock, is not enough: its original setter did not take that lock. The consuming
360owner must capture once and consume unchanged, or invoke binding at the exact
361consumption point with the already resolved values. Actual final-list
362observation/binding follows recording but precedes any queue commit; refusal
363aborts the unsubmitted list without incumbent fallback. This is not terminal
364completion evidence, a post-submit receipt, or permission to submit.
365
366`mc_dir` metadata is `{1,159,2,role,count,owner_generation,layer,0}`.
367Role0 GU/1 DN, count exactly257, owner generation positive and layer a u32
368including zero. Entries0..513 contain all257 ordered `{W_VA,S_VA}` pairs;
369each VA is positive/eight-byte aligned. Entries514..1023 must be zero.
370SHA256 covers the8 LE64 metadata cells followed by the514 LE64 address cells,
371exactly4176 bytes. No weight/scale data or invented contiguous W+S envelope
372is included. The existing directory owner supplies and retains this complete
373actual 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}`.
377Count is1..64; the three owner generations are positive. There are64 records,
378each16 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
385Active roles are strictly ascending and below64; role coverage belongs to
386the complete operation observer, not a generic invented required-role list.
387Index0 is valid; index/generation are u32 and generation is nonzero. Kind2
388means data buffer,3 code buffer,4 queue/push **buffer**, never a submission
389queue/channel handle. All VAs are positive/eight-byte aligned, extents
390positive/nonwrapping; each resource is a real contained allocation subspan.
391The same buffer index cannot claim differing generations, kinds, backing
392VAs or physical extents. Multiple roles/subranges sharing the same handle
393are legitimate and preserved. Unused record cells are zero. SHA256 covers
394the8 metadata cells and all1024 record cells as LE64, exactly8256 bytes.
395
396Resource-role generations in the outer wire remain owner-lease generations,
397not individual handle generations. This snapshot separately binds the latter.
398The observer must cover actual separate W/S allocations, enclosing buffers,
399router/glue/leased code and command-list-owned buffers where applicable.
400Unused graph buffers are not invented reads. These structural checks do not
401attest registry membership, current ownership or lifetime: the existing owner
402retains that responsibility under the same observed lease/snapshot.
403
404### Complete ordered code and launch series
405
406```
407mc_series(meta view ulong8, leafSHAs view uchar4096,
408 ordinals view ulong128, out edit uchar32) -> long
409```
410
411This is the only aggregation format for groups10..21, including singleton
412roles. Metadata is `{1,159,5,role,kind,count,record_generation,full_count}`.
413Roles0..5 have the same order as `mc_launch`; kind0 is encoded-code identity,
414kind1 is launch identity; count is1..128. This covers the complete existing
415operation bound, not a new64-token limit. Router recording can require multiple
41664-row entries, and combine can require a separate entry for every token.
417The observer must cover **all** such occurrences; it may not pick first/last,
418deduplicate identical code, or truncate. More than128 occurrences is refused.
419The full command list can still have4096 entries and actual ordinal4095.
420
421Code metadata requires generation/full_count both0 and all ordinals0. Its
422preimage is all8 metadata cells as LE64 followed by all4096 leaf-digest bytes.
423Code occurrences retain their actual execution order and count, but do not
424acquire runtime addresses, generations or weight data as encoded-code identity.
425Launch metadata requires positive actual record generation and full_count
4261..4096. Active ordinals must be strictly increasing and below full_count;
427inactive ordinals must be0. Its preimage is all8 metadata cells as LE64, all128
428ordinals as LE64, then all4096 digest bytes. Each active32-byte digest must be
429nonzero and every inactive digest byte must be0 for both kinds. Refusal clears
430out; status1 is malformed metadata/reserved data,3 is a zero active digest,
4316 is hashing refusal.
432
433The 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
435ordinal order, with identical series role and count. A launch leaf's role,
436ordinal, generation and final-list count must agree with its series metadata
437and ordinal. Each code leaf comes from `mc_code` over the actual exact code
438bytes; each launch leaf comes from `mc_launch` over that same observed entry.
439Code series goes to group`10+2*role`, launch series to`11+2*role`. These
440correspondence/provenance obligations cannot be recovered from opaque digests
441by `mc_series`, nor does hashing two supplied lists establish them. A valid
442leaf from another ordinal/generation must be refused by the observer before
443aggregation. 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
449capacity, invalid length, identical malformed wires, GU/DN role mixing, all
450selector identity limbs, session context, stale digest clearing, serializer
451roundtrip/refusal clearing and executor-custody substitution. Independent literal
452one-token and ragged two-window oracles are not a second planner. `moe-export.om`
453emits the one-token wire/hash for mode0/1, or the15-token two-window wire/hash
454for mode2/3. Read-only external `sha256sum` independently checks both results.
455
456The mounted Wolfram evaluator verified the source-derived layout, without
457warnings. These are synthetic layout calculations, not measurements:
458
459```
460WolframLanguageEvaluator:
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
464WolframLanguageEvaluator:
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
471Version1 source receipt at commit32af495. The separate
472`moe-observe-host-evidence.json` records the Version2 replay, nested preimages,
473ordered-series controls, independent byte/SHA oracles and verifier mutants.
474The original three mutants removed exact wire, result-custody and selected
475paired-artifact comparison. New controls challenge both QMD regions, consumed
476options, all257 W/S pairs, buffer aliases/backing, and every series digest/
477ordinal cell, including128 occurrences and ordinal4095. These are synthetic
478HOST_ONLY tests, not snapshots of actual recorded or submitted GPU work.
479
480To construct a native test, export exact Git objects listed in
481`moe-closure.lock`, verify each source SHA and concatenate in listed order,
482followed 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,
484append `moe-observe-fixtures.om` then `moe-observe-unit.om` or
485`moe-observe-export.om`; for ordered series use that same observation fixture
486followed 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
488execute failed/stale output. No production build/runtime, source registry or
489new host-language implementation is introduced.
490
491Actual protected evaluator execution, independent finite-FP/numerical/model
492quality results, measured full-cost comparison, accepted hardware receipts,
493full consuming graph qualification and GPU execution are **NOT_RUN** here.
494Matching byte metadata is not a hardware-qualified receipt or graph authority.