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 / ecosystem6 / CONTRACT.md

94 lines · 5901 bytes Raw Blame History Rendered
1# Bounded native affine numerical consumer
2
3This is an executable prerequisite for aien-train#6 and Omega#663/#664, not a
4general trainer, automatic differentiation system, completed ecosystem M1 or
5production consumer cutover. It reuses the existing L720 arithmetic and M20
6metadata implementations. Their owners remain unchanged. L491 retains trainer
7ownership. No compiler, runtime, model, GPU or service was changed.
8
9`native/ecosystem6/affine.om` executes actual IEEE binary32 operations through
10the external L720 `add32` and `mul32`. Inputs, intermediate results, gradients
11and updated parameters are binary32 bit patterns held in ulong cells. These
12carriers are not a new byte-addressed tensor allocator. Descriptor dtype1 means
13the arithmetic value format; storage remains the declared fixed local carriers.
14No foreign floating runtime, language wrapper or fixed-point product path is used.
15
16The fixed graph has X[2,3], W[3,2], b[2], T[2,2]. It computes Y=XW+b and
17L=sum((Y-T)^2), then dX, dW and db from the original W, followed by
18W'=W-lr*dW and b'=b-lr*db. Each scalar multiply and addition rounds separately
19to nearest, ties to even. This is not fused multiply-add. Reduction order is
20the source's ascending row, column and inner-dimension order. The loss and
21gradients describe the pre-update parameters. This explicit derivative is a
22vector-Jacobian product for one fixed graph, not a general differentiation tape.
23
24The eight slots X,W,b,T,Y,dX,dW,db occupy `AP[t*16+i]`. `AD[t*24+i]` contains
25the M20 metadata-v1 descriptor and `AS[t*8+i]` its trusted allocator snapshot.
26The consumer validates each with existing `emcheck`, then requires dtype1,
27offset0, contiguous fixed dimensions, capacity exactly2/4/6, and distinct slot
28identity t+1. The caller must supply trusted snapshots; these records do not
29authenticate external memory or callers. Snapshot generations may vary so long
30as the descriptor and live allocator snapshot agree. Shared `ED`/`ES` are scratch.
31All operations are serialized. Padding cells are not part of a tensor.
32
33`afstep(lr)` returns0 on success. Existing M20 failures retain their codes.
34Additional failures are -20 incompatible local storage/dtype, -21 shape/stride,
35-22 invalid input or learning rate, -23 nonfinite computed result. Inputs must
36be finite canonical-width32 bit patterns. lr must be finite with a clear sign
37bit; negative zero is deliberately refused. NaN and infinity inputs are refused.
38Overflow and any nonfinite intermediate that reaches a result reject the step.
39Subnormals and rounding underflow are supported. `AP` and `AL` remain unchanged
40on every refusal; private scratch `AQ`, `ED` and `ES` may change. The final commit
41replaces W,b,Y,dX,dW,db and writes the pre-update loss to `AL[0]`, preserving X,T.
42
43## Dependency and build freeze
44
45`dependencies.json` records exact repositories, source commits, files and hashes.
46The libraries remain external source dependencies, not copied replacement
47libraries. Build order is L720 add32.om, L720 mul32.om, M20 metadata.om, affine.om,
48then the chosen caller. Concatenation is existing host build glue and is not
49claimed retired. All new executable implementation, tests and mutation tooling
50are handwritten `.om`. External dependencies have AGPLv3 licensing; preserve
51their existing SPDX declarations and repository licenses when distributing a unit.
52
53On AArch64 Linux, materialize the three dependency files from their exact Git
54objects, verify the SHA256 values, then use this existing command recipe with
55private paths:
56
57```sh
58cat "$ADD32" "$MUL32" "$METADATA" native/ecosystem6/affine.om tests/ecosystem6/step-test.om > "$OUT/unit.om"
59quiet-build "$COMPILER" < "$OUT/unit.om" > "$OUT/unit.elf"
60chmod +x "$OUT/unit.elf"
61"$OUT/unit.elf"
62```
63
64Record compiler and program statuses separately and verify a real ELF before
65execution. Expected output is `NATIVE_AFFINE_FP32_PASS checks=374708`, exit0.
66The independent test oracle represents exactly expressible rational inputs as
67integers solely to calculate expected answers: X=x/8,W=w/16,b=b/128,T=t/128,
68lr=1/32. It computes integer polynomial derivatives and encodes exact expected
69binary32 values without calling add32/mul32. 4096 deterministic cases have all
70numerators within24 significant bits, so intermediate rounding is exact.
71Additional literal fixtures check a hand-calculated loss36.46875, smallest
72subnormal forward/gradient propagation, underflow to zero and midpoint ties.
73The oracle's fixed rational representation is test-only, not the implementation.
74
75`tests/ecosystem6/mutate.om` compiles using the same compiler. Its input is one
76ASCII mode byte followed by affine.om. Modes0/1/2 invert the gradient sign,
77remove dimension admission, or reverse the weight-update direction. It requires
78exactly one source match and emits the full altered module. Concatenate the
79same dependencies and unchanged test with the resulting module, compile and run.
80All three compile0 and fail the test with exit1, at checks31/93/33 respectively.
81The tests do not merely look for reduced loss or self-rebuild consistency.
82
83## Qualification boundaries
84
85This host-native test is the first actual downstream numerical consumer of
86these pinned primitives and M20 metadata in this slice. It does not replace an
87existing production trainer. Arbitrary layouts, dynamic allocation, matmul sizes,
88other operators, optimizer state, data loading, checkpoint/resume, evaluation,
89export/serve, distributed and GPU execution remain open in their existing issues.
90There is no simulator or physical-device numerical result, speedup, quality or
91training convergence claim. Existing seeded compiler and L720 host-oracle corpus
92evidence remain separately qualified; finite tests are not a proof of all IEEE
93inputs. Performance and lifecycle costs are recorded without comparing to a
94framework or claiming a win. Initial compiler refusals are preserved in evidence.