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-bridge/blob/main/tests/device-window/README.md # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings 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 `omega-bridge / tests / device-window / README.md` 132 lines ยท 7288 bytes Raw Blame History Rendered 1 # Device-window controls (CPU only) 2 3 Two programs run the GB10 device window: `tools/run-device-window.sh` and its 4 Omega successor `tools/run-device-window.om` (Linear DRA-441). The shell script 5 stays until one device window under a queen-scheduled lease, run by the Omega 6 program, matches the shell script's rows (`evidence/device-window/L939-w3`); 7 it is removed in the same change that files that window's evidence. Both 8 controls below run on the CPU, open no GPU, never call the real `spark-window` 9 and need no lease. 10 11 ## Compiler 12 13 The Omega programs here (`race.om`, `tools/run-device-window.om`) are built 14 with omega-mv `main` `seed/out/omc`, sha256 15 ``34d611ca0415eab1728d3234911d90e74af17ba9ab0c581d559f48274d7ca6d3`` (omega-mv 16 ``50feb135``; unchanged through ``e8fcdc01``, 2026-11-16). 17 18 ```sh 19 printf '%s %s\n' `34d611ca0415eab1728d3234911d90e74af17ba9ab0c581d559f48274d7ca6d3` "$OMC" | sha256sum --check --strict 20 mkdir -p build 21 "$OMC" < tools/run-device-window.om > build/run-device-window && chmod +x build/run-device-window 22 "$OMC" < tests/device-window/race.om > build/race && chmod +x build/race 23 ``` 24 25 `build/run-device-window` finds the repository as the parent of its own 26 directory, so keep it in `build/`. 27 28 ## compare.py: the successor against the shell script 29 30 ```sh 31 python3 tests/device-window/compare.py tools/run-device-window.sh build/run-device-window build/cmp 32 # COMPARE PASS cases=N, exit 0 33 ``` 34 35 `build/cmp` must not exist; remove it afterwards. The cases are listed in 36 `main()` of `compare.py`; the first eight are the refusal controls: 37 `refuse-no-ledger` (no `--ledger`), `refuse-ledger-needs-id` (`--ledger` 38 without an id), `refuse-ledger-chars` (`a/b`), `refuse-unknown-arg` 39 (`--bogus`), `refuse-pairs-not-integer` (`5x`), `refuse-pairs-lt-5` (`4`), 40 `refuse-dry-cvd-unset` (a dry-run with `CUDA_VISIBLE_DEVICES` unset) and 41 `refuse-dry-in-window` (a dry-run inside `SPARK_WINDOW`). Then come the other 42 refusals (`CUDA_VISIBLE_DEVICES=0` among them), complete and incomplete dry-run 43 plans, and device mode against a fake `spark-window` that runs every row on 44 the CPU: a passing window, failing rows, an existing evidence directory, a 45 failed open, a missing cubin directory and missing inputs. Each of these 46 compares exit status, stdout, stderr and the whole evidence directory. The 47 fake tree root is a git repository with a modified tracked file, and one 48 conformance result file is over 64 KiB. 49 50 Four cases kill a run while a window is held on the fake chip: 51 `device-signal-closes` sends SIGTERM to the whole process group (both programs 52 close the window by its id); `device-parent-term` and `device-parent-kill` 53 kill only the driver (SIGTERM, then kill -9) while the row keeps running. The 54 window must not be closed before the row exits: on SIGTERM both programs close 55 after the row; on kill -9 the shell script never closes (the lease runs out) 56 and the successor closes after the row. `device-kill-in-open` kills only the 57 driver (kill -9) while `spark-window open` is still running: the shell script 58 never closes that window; the successor's closer reads the id from the open 59 itself and closes the window after the open exits, and no row runs. 60 `om-closer-gone` runs the successor only and kills its closer (kill -9) while 61 a row runs: nothing can close the window then, and the successor must say so, 62 naming the window, on stderr and in `window.txt`, and close nothing. 63 64 `refuse-dry-cvd-huge` and `refuse-dry-in-window-huge` give the dry-run 65 refusals a 5000-byte value, which both programs quote whole. `om-refuse-env-*` 66 run the successor only: an environment entry over 65535 bytes, or an 67 environment too large for the execprog packet, is refused with exit 3 before 68 anything is printed, opened or created. 69 70 Negative controls (`evidence/device-window/DRA-441/gates.sh` runs them and 71 expects exit 1): a mutant of the successor that ignores the result of the 72 evidence-directory `mkdir` gives `COMPARE FAIL`; a mutant whose rows do not 73 hold the closer's hold pipe fails `device-parent-kill` (the window is closed 74 while the row still runs); a mutant whose closer takes a lost driver as 75 "nothing to close" fails `device-parent-term` and `device-parent-kill` 76 (`device-kill-in-open` still passes under it: there the closer takes the id 77 from the open's own output, not from the driver). 78 79 Deliberate differences, listed in the header of `tools/run-device-window.om`: 80 `script_sha256` is the hash of the binary; children run as 81 `/usr/bin/env -i -- CMD` because `execenv` takes at most 64 82 entries and 4096 bytes (the environment on spark-b87b had 78 entries and 4796 83 bytes on 2026-11-16); a closer process replaces the shell's `trap`, so a 84 signal ends the program by that signal where the shell exited 130, a kill -9 85 of the driver still closes the window once its rows have exited, and a row's 86 standard input is the closer's hold pipe; `NN-*.out.sha256` is in bytewise 87 order; `--pairs` without a value, a value above 2^63-1, an unset `HOME`, a 88 window id that is not 1..4095 bytes of `[A-Za-z0-9._-]` and a value output over 89 64 KiB are refused with their own lines. 90 91 ## race.om: the evidence directory is created once 92 93 `race.om` checks the evidence-directory step (DRA-105, finding F5 of the 94 DRA-106 audit refresh). Evidence is additions only: a run under a ledger id 95 that already has a directory must refuse, and two runs started at the same 96 moment with the same new ledger id must not both get past that step. Both 97 programs create `evidence/device-window/` with one `mkdir` (no `-p`), 98 which either creates the directory or fails, so exactly one of two concurrent 99 runs gets it. 100 101 Each trial, in a scratch tree holding a copy of the program: 102 103 1. Two device-mode runs with the same new ledger id start together (both block 104 on one pipe until the driver writes to it). Pass: one exits 2 with a 105 `REFUSE:` line, the other exits 1 without one. 106 2. The directory holds an empty `rc.txt`, a `window.txt` and no row log. 107 3. A third device-mode run on the same id exits 2 with `REFUSE:` and leaves 108 `rc.txt` and `window.txt` the same size. 109 4. A dry-run on the same id prints `EXISTS` and exits 1. 110 111 No run reaches a window call. `SPARK_WINDOW=NEGCTL-none` skips the open, 112 `CUBIN_DIR` names a missing directory so the run that got the directory stops 113 at the cubin copy (exit 1) before the first row, and the runs get only 114 `PATH=/usr/bin:/bin`, where there is no `spark-window`. 115 116 A program whose name ends in `.sh` is run with `/bin/sh`; anything else is 117 copied to `tools/run-device-window` in the scratch tree and run directly. 118 119 ```sh 120 build/race build/run-device-window build/race-om 100 # RACE PASS, exit 0 121 build/race tools/run-device-window.sh build/race-sh 100 # RACE PASS, exit 0 122 ``` 123 124 `SCRATCH` must not exist; remove it afterwards. Usage errors exit 2. 125 126 Negative controls: the script at ``07f276fc`` checked `[ ! -e "$out" ]` and then 127 ran `mkdir -p "$out"`. Both runs of a pair passed the check in 69 of 100 128 trials of the logged fresh-clone run on spark-b87b (97 of 100 in an earlier 129 working-tree run): `RACE FAIL`, exit 1. A mutant of the shell fix that uses 130 `mkdir -p` fails every trial, and its sequential check too. Log: 131 `evidence/device-window/race-F5.log`. A mutant of the successor that ignores 132 the result of its `mkdir` fails every trial in the same way.