Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/docs/ecosystem663/metadata-v1.md # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers 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 3 This component implements the integer metadata and storage-lifetime checks 4 needed 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 8 gradient implementation supplied by this change. 9 10 Owner: 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 13 existing migration, and L491 retains training/schedule work. No existing 14 compiler, tensor, autograd or trainer source is changed. 15 16 ## Scope 17 18 `native/ecosystem663/metadata.om` validates a tensor descriptor against the 19 allocator's current storage record. It detects shape/product overflow, 20 out-of-bounds views, incorrect dtypes and stale storage generations. It also 21 implements the storage record's release transition. These checks execute as 22 seeded native AArch64 code using integer metadata. 23 24 This component does not allocate memory, store tensor values, execute tensor 25 arithmetic, compute derivatives, authenticate an allocator record or make 26 records safe for concurrent use. `ES` must be populated by the trusted existing 27 allocator owner, under that owner's synchronization. Caller-controlled claims 28 about storage do not establish that storage exists. Changing `ES` is an ordinary 29 in-process operation, not a protected capability boundary. 30 31 An eventual native tensor allocator must call this single boundary; it must not 32 copy a second implementation of its validation rules. Consumer integration 33 must pin this source and test its actual allocation and release operations. 34 The distributed #7 consumer may use this module to validate each local operand 35 record, but metadata agreement alone does not execute a collective. 36 37 ## Frozen subset and input records 38 39 Schema version is 1. Dtype 1 is F32; 2 is F16; 3 is BF16. These are storage 40 metadata tags here. No integer or complex tensor dtype is added. Rank is 0..8; 41 rank 0 has one element. Every active dimension is at least 1, with product at 42 most `1073741824`. Empty tensors remain explicitly refused under inherited M20 43 semantics; supporting them requires a separately versioned extension. 44 45 Strides and offsets are unsigned element counts. Zero strides admit read-only 46 broadcast views. Negative strides are not representable. Inactive dimensions 47 and strides are ignored. Physical overlap is allowed for immutable views; this 48 does not authorize overlapping writes. A huge stride on a size-one dimension 49 does 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 78 The slot may be zero; the generation may not. Descriptor slot, generation and 79 dtype must equal the storage snapshot. Storage capacity does not require the 80 view to cover all storage. Each logical element must lie within the capacity. 81 The implementation checks remaining extent before multiplying, so untrusted 82 large 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 94 points. `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 107 These negative values retain M20 status meanings. The new descriptor envelope 108 has its own schema version; it is not the C struct ABI or a shared transport 109 wire format. `emcheck` refusal precedence is envelope, dtype, shape/count, 110 handle, storage dtype, then extent. No mutation/version counter is invented: 111 the inherited M20 tensors are immutable. Saved tensor storage references 112 become stale after release; full autodiff node/tape lifetime is still #664. 113 114 ## Acceptance and remaining gates 115 116 The native test includes analytic boundary cases, scalar and rank-eight 117 descriptors, both storage-only dtypes, maximum counts and generations, stale 118 references, release/reuse/retirement, and 14400 tiny views compared against an 119 independent element-enumeration algorithm. Compiled controls must detect 120 missing offset accounting, generation comparison and retirement. 121 122 Build by concatenating this module and `tests/ecosystem663/metadata-test.om`, 123 then feed the bytes to pinned compiler SHA256 124 ``191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9`` and execute 125 the resulting ELF on Linux AArch64. Existing development `cat`, redirection, 126 `chmod` and `quiet-build` remain disclosed host orchestration. No new shell 127 harness is delivered. Native import/process orchestration is separate owner 128 work; this source uses no foreign runtime or dynamic library. 129 130 FP arithmetic remains blocked on the compiler/numeric owners and their exact 131 qualified interfaces. Native forward/backward/update, actual allocator and 132 trainer integration, CUDA-free model execution, physical cross-vendor results, 133 checkpoint/resume and retirement are NOT_RUN. No legacy source is deleted 134 because no existing production consumer has switched. All parent issues stay 135 open. Independent final-source review and existing desk review are required.