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/aien-train/blob/main/tools/omegallm/wdrive/README.md # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / tools / omegallm / wdrive / README.md` 253 lines · 12947 bytes Raw Blame History Rendered 1 # wdrive: Omega drivers for lane wsp (DRA-187) 2 3 These four seeded Omega programs build, run and check `wprobe`. They replace the lane's Python and 4 shell instruments: 5 6 | Old file | Omega program | 7 |---|---| 8 | `tools/omegallm/wprobe/build.sh` | `wbuild.om` | 9 | `evidence/OMEGALLM/wsp-dra187-`20261107`/runarms.py` | `wrun.om` (scoring stays with `wscore`) | 10 | `tools/omegallm/wprobe/check.py` | `wcheck.om` | 11 | `evidence/OMEGALLM/wsp-dra187-`20261107`/policy_check.py` | `wpolicy.om` (its survival formula is `wprobe survive`) | 12 13 Every program is compiled by the pinned omc: omega-mv ``e5b32567``, `seed/out/omc`, sha256 14 ``2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f``. Output is plain text, one record 15 per line. Children run with an empty environment, are started through `fork` and `execprog`, and are 16 reaped with `waitpid`. The pool lock is taken in Omega with the `flock` host word. 17 18 ## Build 19 20 `wbuild.om` is a whole program and also the shared library for the other three. Bootstrap it once, 21 from the aien-train checkout: 22 23 ```sh 24 OMC < tools/omegallm/wdrive/wbuild.om > wbuild && chmod +x wbuild 25 ``` 26 27 Each of the others is composed after `wbuild.om`, with that unit's `main` renamed to `wbmain`: 28 29 ```sh 30 OMC=OMC CORE=0 wbuild OUT/wrun tools/omegallm/wdrive/wbuild.om@wbmain tools/omegallm/wdrive/wrun.om 31 OMC=OMC CORE=0 wbuild OUT/wcheck tools/omegallm/wdrive/wbuild.om@wbmain tools/omegallm/wdrive/wcheck.om 32 OMC=OMC CORE=0 wbuild OUT/wpolicy tools/omegallm/wdrive/wbuild.om@wbmain tools/omegallm/wdrive/wpolicy.om 33 OMC=OMC CORE=0 wbuild OUT/wprobe $ODRV/om2.om $NET $OLLM_PRE $N/lio.om@ollmmain $OLLM_POST tools/omegallm/wprobe/wprobe.om 34 OMC=OMC CORE=0 wbuild OUT/ollm $ODRV/om2.om $NET $OLLM_PRE $N/lio.om $OLLM_POST 35 OMC=OMC CORE=0 wbuild OUT/wsplit ../omega-mv/om/sha256/sha256-om2.om tools/omegallm/wsplit/wsplit.om 36 OMC=OMC CORE=0 wbuild OUT/wscore tools/omegallm/wscore/wscore.om 37 ``` 38 39 with 40 41 ```sh 42 ODRV=tools/omegallm/wdrive N=native/omegallm 43 NET="$N/net/http.om=`aff258ecd3858454056811a5e6fe1f660f9d650a7207d6c41885105110e046a7` 44 $N/net/json.om=`456254fc754ea35103ced480407b24fc1a3896d094b90ae0e9623e7b6594e2d2` 45 $N/net/jsonw.om=`464f649e8207495f5d67fe8795d31e42ea3ccebd9ed547274dab802d4f7c5f21`" 46 OLLM_PRE="$N/math.om $N/data.om $N/lpool.om $N/model.om $N/adam.om $N/ckpt.om $N/bpe.om $N/cli.om" 47 OLLM_POST="$N/serve.om $N/nogpu.om" 48 ``` 49 50 These are the files, in the same order, that the aarch64 target of the ollm lane's 51 `tests/omegallm/build.sh` joins after its `om2` line (`om2.om` is that one line), so no shell script is 52 in this build path. The three `net/` parts carry the sha256 pins that build.sh checks before it 53 composes (its `NET_PIN_MISMATCH`, exit 3). wbuild refuses a changed `net/` file the same way, with 54 `PART_PIN_MISMATCH` and exit 3 before anything is compiled. MEASURED 2026-11-07 at omega-mv 55 ``e5b32567``, with the pins: ollm built this way is byte-identical to build.sh's (``819664d5`…`), and so 56 is wprobe (``cdfd3150`…`, against the build.sh-composed route). `../omega-mv` is omega-mv at 57 ``e5b32567``. 58 59 ## wbuild 60 61 `wbuild OUTBIN PART...`, with environment `OMC` (the pinned omc) and `CORE` (the taskset core, 62 default 0). 63 64 A PART is `FILE`, which is appended as it is, or `FILE@NAME`, which is appended with its single line 65 `fn main to int` renamed to `fn NAME to int`. Either form may end in `=HEX64`, as `FILE=HEX64` or 66 `FILE@NAME=HEX64`, where HEX64 is the file's sha256 in 64 lowercase hex digits. The pin goes last 67 because wbuild takes the text after the last `=` as the pin and looks for `@NAME` before it. A 68 pinned part is hashed with wbuild's own SHA-256 every time it is read, on the bytes that are then 69 composed. If the hash differs, wbuild prints `PART_PIN_MISMATCH FILE ` on stderr and 70 exits 3. All parts are read and checked once before `OUTBIN-all.om` is opened, so a mismatch leaves no 71 composed source and no binary. A PART that has an `=` but not 64 lowercase hex digits after the last 72 one is refused with `PART_PIN_BAD PART` and exit 2. As a result, an unpinned FILE path cannot contain 73 `=`. 74 75 If any part has an `om2` line, the output starts with 76 one `om2` line. Next come every part's `layout ... end` blocks in order, then the parts without their 77 `om2` lines and layout blocks. Every line that starts with `export fn ` is written as `fn `: the 78 output is always a program, and a program has no exports. This is how omega-mv's 79 `om/sha256/sha256-om2.om`, which has four exports, joins wsplit. Without layout blocks and exports 80 this is plain concatenation, which is what `build.sh` did. 81 82 `wbuild` checks the sha256 of `OMC` against the pin. It writes `OUTBIN-all.om` and compiles it with 83 `taskset -c CORE nice -n 19 OMC`. It renames the result to `OUTBIN`, sets mode 0775, and prints: 84 85 ``` 86 BUILD_OK OUTBIN source_sha256 omc 87 ``` 88 89 | Exit | Meaning | 90 |---|---| 91 | 0 | Built. | 92 | 1 | omc refused the unit. stderr has `BUILD_FAIL omc rc=N`, and `OUTBIN.tmp` is removed. | 93 | 2 | Usage error, or a malformed pin (`PART_PIN_BAD`). | 94 | 3 | `OMC` is not the pinned compiler (`OMC_PIN_MISMATCH`), or a part does not match its pin (`PART_PIN_MISMATCH`). | 95 | 4 | A renamed part does not have exactly one `main`. | 96 | 61 | A part is over 8 MiB. | 97 | 70 | I/O error. | 98 99 ## wrun 100 101 `wrun ARMS OUTDIR` 102 103 ARMS is plain text with one arm per line: `NAME SPLIT MODE [ck=PATH] K L I A ...`. Blank lines and 104 lines starting with `#` are skipped, so the output of `wprobe controls` can be used directly as an 105 ARMS file. MODE is `gen` or `probe`. Hooks are groups of four decimals, which wprobe judges. Every 106 line is checked before any arm runs. A bad line exits 2 with `BAD_ARM line N`. 107 108 An arm runs only if `OUTDIR/NAME.out` does not exist yet. wrun first takes the pool lock: it opens 109 LOCK read-only, creating it with mode 0666, and tries an exclusive `flock` every 10 ms for at most 110 7200 s. This is what `flock -w 7200 -o LOCK` did, and it shares the lock with any other process that 111 uses `flock` on the same file. If the wait runs out, stderr gets `LOCK_TIMEOUT LOCK` and the arm 112 counts as exit status 1, which is flock's status for a timeout. The child does not inherit the lock 113 descriptor (`-o`); wrun holds the lock until the child has exited. The child runs as: 114 115 ``` 116 /usr/bin/taskset -c POOL /usr/bin/nice -n 10 WPROBE gen CK MERGES 64 SPLITS/SPLIT.rec hooks 117 ``` 118 119 In `probe` mode the command is `WPROBE probe CK MERGES REC hooks`. 120 121 stdout goes to `NAME.out.tmp`. On exit status 0 the file is renamed to `NAME.out`; otherwise it is 122 renamed to `NAME.out.failed`. wrun then prints the line below and appends it to `OUTDIR/runs.log`: 123 124 ``` 125 RUN NAME SPLIT MODE RC WALL_MS START_UNIX_MS CK_SHA256 WPROBE_SHA256 OUT_SHA256 hooks... 126 ``` 127 128 An arm that already has its output prints `SKIP NAME`. 129 130 Environment variables: 131 132 | Variable | Default | 133 |---|---| 134 | `HOME` | None. It is required. | 135 | `POOL` | 19 | 136 | `LOCK` | `HOME/handoffs/hive/queen/pool-POOL.lock` | 137 | `WPROBE` | `HOME/work/wsp/build/wprobe` | 138 | `CK` | `HOME/.local/share/omega-tool-model/round40/model.ck` | 139 | `MERGES` | `merges.bin` beside CK | 140 | `SPLITS` | `HOME/work/wsp/aien-train/evidence/OMEGALLM/wsp-dra187-`20261107`/splits` | 141 142 | Exit | Meaning | 143 |---|---| 144 | 0 | Every arm that ran exited 0. | 145 | 1 | Some arm failed. | 146 | 2 | Usage error or a bad ARMS line. | 147 | 70 | I/O error. | 148 149 Scoring is done by `wscore`, not by wrun. 150 151 **Hooks file.** An arm has at most 64 hook groups (256 words), wprobe's own limit; more is a bad 152 line (`BAD_ARM`, exit 2). The pinned omc's `execprog` packed list holds at most 64 records and 4096 153 bytes (omega-mv ``e5b32567`` `docs/one_layer/OMEGESE.md`, the packed-list paragraph). The pool prefix 154 and the wprobe command take 13 records, so an arm with at most 48 hook words passes them as 155 arguments. An arm with more writes them to `OUTDIR/NAME.hooks`, one line, and passes the single last 156 argument `@OUTDIR/NAME.hooks`, which wprobe reads in place of the hook words. The file is kept as 157 evidence. Such arms need a wprobe built from `wprobe.om` with `@PATH` support (after aien-train 158 ``72d3377``; `~/work/wsp/build-rank/wprobe`, sha256 ``cdfd3150`...8aec`, has it). The `RUN` line lists the 159 hook words either way. 160 161 ## wcheck 162 163 `wcheck BUILD_DIR [MILLI]`. BUILD_DIR must hold `ollm` and `wprobe`. 164 165 wcheck is an outside check of `wprobe save`. It works in a fresh `/tmp/wcheck-` directory, which 166 it removes afterwards. It makes a small checkpoint with `ollm init` and one `ollm train` step, then 167 checks eight cases, printing `CASE PASS|FAIL` for each: 168 169 | Case | What it checks | 170 |---|---| 171 | `edit` | Head and neuron row factors. Only those rows change. The header is kept and its payload FNV is correct. The optimizer state is unchanged. | 172 | `f32` | Rounding to f32. | 173 | `exists` | Saving onto an existing file exits 63. | 174 | `act` | An activation hook exits 2. | 175 | `dec` | A decoding hook exits 2. | 176 | `badhook` | A hook on a layer that does not exist exits 2. | 177 | `nofiles` | No file was left behind by the three refused saves. | 178 | `big` | A weight over the limit exits 64. | 179 180 The last line is `WPROBE_SAVE_CHECK PASS 8 cases` (exit 0) or `WPROBE_SAVE_CHECK FAIL of 8 cases` 181 (exit 1). Any MILLI other than 1500 is the negative control: the `edit` case must then fail. 182 183 | Exit | Meaning | 184 |---|---| 185 | 0 | Pass. | 186 | 1 | Fail, or `SETUP_FAIL`. | 187 | 2 | Usage error. | 188 | 70 | I/O error. | 189 190 ## wpolicy 191 192 `wpolicy prep|run BASE P0 P2 WORKDIR`. This is PREREG section 9. 193 194 - **BASE** is the unedited checkpoint, at step 600 of 600. 195 - **P0** is the edit with Adam m and v kept. 196 - **P2** is the same edit applied with wpatch policy 2. 197 198 Both modes first run `WPROBE survive BASE P0 BASE P0 P2` and print its line after `PRE `. That 199 command exits 67 if P2's weights differ from P0's, and 68 if P0 changes nothing. 200 201 Each checkpoint is then copied to `WORKDIR/base.ck`, `p0.ck` and `p2.ck`. Header words 9 and 10 must 202 both be 600. Word 10 is set to 601, so that `ollm train` takes exactly one step. This changes only 203 byte 80, because the payload FNV covers the payload alone. Each copy prints `PREP NAME PATH`. 204 205 `run` mode goes on to train each copy one step on TRAIN, with stdout to `WORKDIR/NAME.train.log`. 206 For each copy it prints `TRAIN NAME RC LOG`. Then it prints: 207 208 ``` 209 p0 S ... from WPROBE survive BASE P0 WORKDIR/base.ck WORKDIR/p0.ck P2 210 p2 S ... from WPROBE survive BASE P2 WORKDIR/base.ck WORKDIR/p2.ck 211 ``` 212 213 Children run under the same pool lock and prefix as wrun's, taken the same way; a lock timeout is 214 `FAIL STEP rc=1`. 215 216 Environment variables: 217 218 | Variable | Default | 219 |---|---| 220 | `HOME`, `POOL`, `LOCK` | As for wrun. | 221 | `OLLM` | `HOME/work/wsp/build/ollm` | 222 | `WPROBE` | `HOME/work/wsp/build/wprobe` | 223 | `TRAIN` | `HOME/handoffs/tool-omega-`20261104`/round40/data/train.tok` | 224 225 | Exit | Meaning | 226 |---|---| 227 | 0 | Done. | 228 | 1 | A child exited nonzero. stderr has `FAIL STEP rc=N`. | 229 | 2 | Usage error. | 230 | 65 | A header is not at step 600 of 600. stderr has `HEADER NAME STEP TOTAL`. | 231 | 70 | I/O error. | 232 233 ## Host programs in the run path 234 235 | Program | Version | What it does | Omega replacement | 236 |---|---|---|---| 237 | `/usr/bin/flock` | util-linux 2.39.3 | Pool lock with a 7200 s wait. | Done. `wdlock` in `wbuild.om` uses the `flock fd op` host word (OMEGESE.md, keyword id 197) with `LOCK_EX` and `LOCK_NB`, and `sleepns` between tries. | 238 | `/usr/bin/taskset` | util-linux 2.39.3 | Pins to the pool core (and to CORE for compiles). | Proposed: host word `setaffinity pid A off n`, Linux `sched_setaffinity` (ARM64 syscall 122), with a CPU mask slice of `n` bytes, `n` a multiple of 8 and at most 128. Returns 0 or minus errno. | 239 | `/usr/bin/nice` | coreutils 9.4 | Adds 10 to the niceness (19 for compiles). | Proposed: host words `getprio which who` and `setprio which who prio`, Linux `getpriority` and `setpriority` (ARM64 syscalls 141 and 140); `which` 0 is a process and `who` 0 is the caller. `setprio` returns 0 or minus errno. `getprio` returns the niceness, not the kernel's `20 - nice` encoding. | 240 241 With these host words, `wdspawn` would set the mask and add the increment in the child between 242 `fork` and `execprog` (`setaffinity 0` with only bit POOL set, then `setprio 0 0` of `getprio 0 0` 243 plus 10), and the argument list would be only the wprobe command. That frees 7 more records, so up 244 to 56 hook words would fit as arguments. Neither host word exists at omega-mv ``e5b32567``: the 245 host-word table in `docs/one_layer/OMEGESE.md` has no affinity or priority entry. Until they do, 246 taskset and nice keep the same arguments that runarms.py, policy_check.py and build.sh used. 247 248 ## Oracles 249 250 None is kept. All four replaced files were deleted. The Python and shell references served only to 251 gate the Omega programs: identical binaries from wbuild and build.sh, an identical `S4-base.out` from 252 wrun and runarms.py, the same eight PASS cases from wcheck and check.py, and an identical prepared 253 `p0.ck` from wpolicy and policy_check.py's header code.