interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / docs / distributed7 / CONTRACT.md

124 lines · 7949 bytes Raw Blame History Rendered
1# Distributed7 admission v1
2
3This bounded native component checks collective metadata agreement before an
4existing transport or numerical executor may begin work. It implements no
5transport, authentication, authorization, tensor allocation, sum, gradient,
6checkpoint or training operation. `0` means that this metadata transition was
7accepted. It never means a collective executed or that its result is correct.
8
9Tracking: [aien-train #7](https://github.com/aien-dev/aien-train/issues/7),
10[Architecture #303](https://github.com/aien-dev/aien-architecture-mv/issues/303).
11Existing owners retain the compiler, Fabric, tensor engine, trainer and devices.
12
13## Consumed interfaces
14
15| Interface | Exact source | Use |
16|---|---|---|
17| M20 metadata-v1 | Omega `3a995ba8dace538c1532c747d829ca6e4a73582d`, `native/ecosystem663/metadata.om`, SHA256 `f60b6d62c1bf90de42455effae977de66adeca1268669f6144809a3327aec7a4` | Directly calls `emcheck`; consumes its `ED` and `ES` arrays, without duplicating tensor validation |
18| Fabric identities and limits | Omega `c9846a44ef350bdece0a2822decec793b59cbbbc`, `src/runtime/aien_machine_id.h`, `src/fabric/fabric.h` | Full nonzero 32-byte canonical machine IDs; maximum 16 members; generation 1 through 4294967295 |
19| Existing task boundary D1 | Same Omega pin, `src/fabric/fab_work.h`, SHA256 `320a9fd366bac11b04a0e6fff336bf25335e49dc237d34062ac727258ee1c0a4` | Maximum 64 MiB tensor payload and 600000 ms deadline span; no new PST1 or HTK1 wire kind |
20
21M20 dtype IDs remain 1=F32, 2=F16, 3=BF16. Their presence here is metadata
22recognition only. Floating-point numerical collectives remain unimplemented in
23this component. No integer fixture is relabeled as a floating-point tensor.
24M20 allows storage slot 0; only generation 0 is invalid.
25
26The descriptor `ED` has 24 unsigned words: schema, dtype, rank, element count,
27offset, storage slot, storage generation, reserved zero, eight dimensions,
28eight strides in elements. `ES` is a trusted allocator snapshot, not wire data.
29The exact upstream module defines both. `emcheck` validates each rank's local
30descriptor against its local snapshot. Packed row-major strides are additionally
31required here. Scalars are accepted; empty tensors, broadcast views and
32noncontiguous views are refused. This is a bounded collective profile, not a
33restriction imposed on the shared tensor engine.
34
35## API and trust boundary
36
37The application has one serialized writer. Global arrays are the current
38seed compiler's module interface. No thread safety or hostile-process isolation
39is claimed. Inputs must be staged before calls; callers must not modify private
40state arrays between calls.
41
42Public staging inputs:
43
44- `d7_ids`: up to 16 full canonical 32-byte machine IDs, ordered by group rank.
45- `d7_gens`: corresponding Fabric membership generations.
46- `d7_peer`: the 32-byte identity proved by the existing authenticated channel.
47- `d7_tens`: a nonzero 32-byte semantic tensor identity supplied by the existing
48 authority boundary. It names the logical tensor slot and contract across
49 workers, not each rank's differing gradient contents.
50- `ED`, `ES`: the current locally checked descriptor and allocator snapshot.
51
52Internal arrays are `d7_rostr`, `d7_gen`, `d7_expec`, `d7_meta`, `d7_seen` and
53`d7_state`. Input identities are compared in full; no shortened hash, hardware
54model name, rank number or process-local handle replaces machine identity.
55This component does not derive IDs, validate AMID wire checksums, authenticate a
56peer or grant capabilities. A caller-provided identity is not itself evidence
57of authentication.
58
59| Entry | Behavior |
60|---|---|
61| `d7_group(epoch,size)` | Copies the already authorized roster only after validating all members, distinct nonzero IDs, generations and capacity. Requires a strictly higher epoch; cannot replace an active or agreed round. |
62| `d7_begin(epoch,sequence,now_ms,deadline_ms,operation)` | Opens one bounded metadata round. Sequence starts at 1; operation 1 is the local sum-agreement tag, not an HTK1 allocation. Snapshots the common descriptor and tensor identity. |
63| `d7_offer(rank,epoch,sequence,generation,now_ms,operation)` | Validates one authenticated peer's metadata and records it once. All members must match the semantic tensor ID, dtype, rank, shape, element count and packed strides. Each local offset, storage slot and storage generation may differ. |
64| `d7_next(epoch,sequence,now_ms)` | Advances the metadata schedule only after every member agrees. This publishes no tensor or success receipt. Sequence exhaustion retires the group instead of wrapping. |
65| `d7_stop(epoch,sequence)` | Cancels an active/agreed metadata round; recovery requires a higher group epoch. |
66| `d7_clock(now_ms)` | Applies the local monotonic deadline check without waiting for another offer. At the deadline, including equality, the round expires. |
67
68`now_ms` comes from the caller's trusted local monotonic clock. A remote timestamp
69must never drive it. Backwards time is refused. The transport owner must arrange
70a timer or call `d7_clock` while waiting; this library owns no background task.
71The 600000 ms bound is inherited from HTK1 but this component is not an HTK1 codec.
72
73State modes: 0 empty, 1 idle, 2 collecting metadata, 3 all metadata agreed,
744 cancelled, 5 expired. A wrong request does not add a participant or advance the
75sequence. A valid clock observation may expire a round even when the offered
76peer metadata is invalid. An agreed round still expires if it is not advanced
77before its deadline. Cancelled/expired state cannot be revived by a delayed
78message or by moving the local clock backwards.
79
80| Return | Meaning |
81|---|---|
82| 0 | Metadata transition accepted |
83| 1 | Unsupported or mismatched local operation tag |
84| 2 | Invalid state |
85| 3 | Stale/wrong group epoch |
86| 4 | Wrong collective sequence |
87| 5 | Rank outside frozen membership |
88| 6 | Invalid/stale member generation |
89| 7 | Missing/duplicate/wrong full machine identity |
90| 8 | Duplicate member contribution |
91| 9 | Tensor metadata, identity or local handle refusal |
92| 10 | Deadline reached or round already expired |
93| 11 | Local monotonic clock moved backwards |
94| 12 | Incomplete metadata agreement |
95| 13 | Cancelled round |
96| 14 | Capacity/deadline-span/sequence limit |
97
98## Qualification and remaining gates
99
100The native test consumer covers complete and incomplete groups, rank permutations,
101all 32 bytes of peer and tensor identities, identical element counts with wrong
102shapes, differing valid local handles, stale handles, wrong dtype/layout/schema,
103duplicates, stale epochs/sequences, generation overflow, cancellation, exact
104deadline equality and sequence exhaustion. Five compiled mutants remove peer
105binding, admit a partial group, weaken order checks, weaken descriptor matching
106or change deadline equality. The suite must reject all five.
107
108This provides no physical or multi-process distributed training result. The
109following work stays open under existing owners:
110
1111. Omega #536 and protocols #27 must provide the authenticated native Fabric/PST1
112 adapter and allocate an interoperable collective envelope. Current HTK1 defines
113 only seeded-i64-matmul and tokenizer tasks. This component does not invent a
114 third kind or send a private replacement wire format.
1152. Omega #663/#664 and aien-train #6 must provide qualified floating-point
116 forward/backward/update and actual tensor payload ownership. This guard does
117 not substitute for the trainer's optimizer or collective implementation.
1183. aien-train #7 still needs real separate-worker transport, bounded buffers,
119 reduction order and numerical oracles, timeout/cancellation integration,
120 sharding and failure/restart with durable checkpoints.
1214. Consumer cutover, deletion of superseded implementations, independent review,
122 physical execution and complete-workflow performance remain open.
123
124No production dependency was retired by these metadata tests.