interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / docs / ecosystem663 / metadata-v1.md

135 lines · 6582 bytes Raw Blame History Rendered
1# M20 metadata-v1 native boundary
2
3This component implements the integer metadata and storage-lifetime checks
4needed by Omega #663. It preserves the bounded M20 tensor contract at
5`cd5897e3f92f72a015892c67b17f096e433b54f7`, specifically
6`src/tensor/omega_tensor.h` and `src/tensor/omega_tensor.c`.
7`src/autodiff/omega_autodiff.c` is a dependent legacy consumer, not a native
8gradient implementation supplied by this change.
9
10Owner: ecosystem303 tensor lane, ledger L787, parent L786. Exclusive paths:
11`native/ecosystem663`, `tests/ecosystem663`, `docs/ecosystem663`, and
12`evidence/ECOSYSTEM663`. L408 retains compiler ownership, L418 retains the
13existing migration, and L491 retains training/schedule work. No existing
14compiler, tensor, autograd or trainer source is changed.
15
16## Scope
17
18`native/ecosystem663/metadata.om` validates a tensor descriptor against the
19allocator's current storage record. It detects shape/product overflow,
20out-of-bounds views, incorrect dtypes and stale storage generations. It also
21implements the storage record's release transition. These checks execute as
22seeded native AArch64 code using integer metadata.
23
24This component does not allocate memory, store tensor values, execute tensor
25arithmetic, compute derivatives, authenticate an allocator record or make
26records safe for concurrent use. `ES` must be populated by the trusted existing
27allocator owner, under that owner's synchronization. Caller-controlled claims
28about storage do not establish that storage exists. Changing `ES` is an ordinary
29in-process operation, not a protected capability boundary.
30
31An eventual native tensor allocator must call this single boundary; it must not
32copy a second implementation of its validation rules. Consumer integration
33must pin this source and test its actual allocation and release operations.
34The distributed #7 consumer may use this module to validate each local operand
35record, but metadata agreement alone does not execute a collective.
36
37## Frozen subset and input records
38
39Schema version is 1. Dtype 1 is F32; 2 is F16; 3 is BF16. These are storage
40metadata tags here. No integer or complex tensor dtype is added. Rank is 0..8;
41rank 0 has one element. Every active dimension is at least 1, with product at
42most 1073741824. Empty tensors remain explicitly refused under inherited M20
43semantics; supporting them requires a separately versioned extension.
44
45Strides and offsets are unsigned element counts. Zero strides admit read-only
46broadcast views. Negative strides are not representable. Inactive dimensions
47and strides are ignored. Physical overlap is allowed for immutable views; this
48does not authorize overlapping writes. A huge stride on a size-one dimension
49does not access any extra element and is accepted.
50
51`ED` is a 24-element `ulong` array:
52
53| Index | Value |
54|---|---|
55| 0 | schema, exactly 1 |
56| 1 | dtype, 1..3 |
57| 2 | rank, 0..8 |
58| 3 | declared element count, equal to shape product |
59| 4 | storage offset in elements |
60| 5 | storage slot, 0..4294967295 |
61| 6 | storage generation, nonzero u64 |
62| 7 | reserved, exactly zero |
63| 8..15 | dimensions |
64| 16..23 | element strides |
65
66`ES` is an 8-element `ulong` array containing the trusted storage snapshot:
67
68| Index | Value |
69|---|---|
70| 0 | live, exactly 1 for admission |
71| 1 | retired, exactly 0 for admission |
72| 2 | storage slot |
73| 3 | current generation |
74| 4 | dtype |
75| 5 | allocation's element capacity, 1..1073741824 |
76| 6..7 | reserved, zero |
77
78The slot may be zero; the generation may not. Descriptor slot, generation and
79dtype must equal the storage snapshot. Storage capacity does not require the
80view to cover all storage. Each logical element must lie within the capacity.
81The implementation checks remaining extent before multiplying, so untrusted
82large sizes/strides refuse instead of overflowing.
83
84## Calls and errors
85
86- `emcheck() -> int`: read-only validation of `ED` against `ES`.
87- `emlive(slot ulong, gen ulong) -> int`: storage-handle validity only.
88- `emrelease(slot ulong, gen ulong) -> int`: when live, mark the snapshot dead
89 and increment generation; at u64 maximum mark it retired without wrapping.
90 Stale/double release returns -5 and changes nothing. This is the metadata
91 transition only; the owner must also release actual backing storage.
92
93`emshape` and `embounds` are internal helpers, not independently admitted entry
94points. `embounds` requires shape validation first.
95
96| Status | Meaning |
97|---|---|
98| 0 | metadata admitted |
99| -1 | unsupported schema or reserved field |
100| -2 | rank above 8 |
101| -3 | zero dimension or inconsistent element count |
102| -4 | unsupported or mismatched dtype |
103| -5 | stale/retired/dead/invalid storage handle |
104| -6 | view reaches outside storage |
105| -8 | element-count or storage-capacity limit |
106
107These negative values retain M20 status meanings. The new descriptor envelope
108has its own schema version; it is not the C struct ABI or a shared transport
109wire format. `emcheck` refusal precedence is envelope, dtype, shape/count,
110handle, storage dtype, then extent. No mutation/version counter is invented:
111the inherited M20 tensors are immutable. Saved tensor storage references
112become stale after release; full autodiff node/tape lifetime is still #664.
113
114## Acceptance and remaining gates
115
116The native test includes analytic boundary cases, scalar and rank-eight
117descriptors, both storage-only dtypes, maximum counts and generations, stale
118references, release/reuse/retirement, and 14400 tiny views compared against an
119independent element-enumeration algorithm. Compiled controls must detect
120missing offset accounting, generation comparison and retirement.
121
122Build by concatenating this module and `tests/ecosystem663/metadata-test.om`,
123then feed the bytes to pinned compiler SHA256
124`191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9` and execute
125the resulting ELF on Linux AArch64. Existing development `cat`, redirection,
126`chmod` and `quiet-build` remain disclosed host orchestration. No new shell
127harness is delivered. Native import/process orchestration is separate owner
128work; this source uses no foreign runtime or dynamic library.
129
130FP arithmetic remains blocked on the compiler/numeric owners and their exact
131qualified interfaces. Native forward/backward/update, actual allocator and
132trainer integration, CUDA-free model execution, physical cross-vendor results,
133checkpoint/resume and retirement are NOT_RUN. No legacy source is deleted
134because no existing production consumer has switched. All parent issues stay
135open. Independent final-source review and existing desk review are required.