aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / tools / capreg / README.md
| 1 | # CUDA capability register checker (seeded `.om`) |
| 2 | |
| 3 | Status: **IMPLEMENTED, EXERCISED on host (aarch64) by the `capreg` gate step.** |
| 4 | |
| 5 | The register itself is [`docs/capability-register/register.tsv`](../../docs/capability-register/register.tsv) |
| 6 | (the source of truth) and its generated view [`REGISTER.md`](../../docs/capability-register/REGISTER.md). |
| 7 | It records, for every row of the 47-row CUDA replacement map in the 2026-10-27 external audit and for |
| 8 | work done since, which aien-dev repository owns the capability, at which exact commit, on which |
| 9 | architecture it was exercised, and which file proves it. |
| 10 | |
| 11 | Both programs here are native Omega, built only by the pinned seed compiler named in |
| 12 | `../zero-legacy/omega.pin` (sha256 `734f0a39…6b61`). No C, Rust, Python or shell makes a judgment. |
| 13 | |
| 14 | | File | Role | |
| 15 | | --- | --- | |
| 16 | | `capreg.om` | `capreg check REG`, `capreg render REG`, `capreg verify REG VIEW`, `capreg evidence REG CLONEROOT` | |
| 17 | | `gate.om` | the gate runner: checks the compiler against the pin with `../zero-legacy/sha256.om`, builds `capreg.om`, runs the fixtures, the register and a planted bad row, prints `AIEN-OBS` lines | |
| 18 | | `gate.sh` | the loader outside the programs: compile `gate.om` with `$AIEN_OMC` and exec it | |
| 19 | | `fixtures/` | `good.tsv` and its view `good.md`; 22 `bad-*.tsv` with the exact stderr each must produce in `bad-*.err` | |
| 20 | |
| 21 | ## Schema |
| 22 | |
| 23 | `register.tsv` is UTF-8, one header line and one record per line, exactly 16 TAB-separated fields, |
| 24 | none empty (write `none` or `-`), no control byte other than TAB, no backtick, newline at the end. |
| 25 | |
| 26 | | # | Field | Rule enforced by `capreg check` | |
| 27 | | --- | --- | --- | |
| 28 | | 1 | `row` | `NN.k`: NN is the audit map row 1..47, k counts owner components from 1; strictly ascending; every NN present | |
| 29 | | 2 | `area` | exactly the audit map name of row NN | |
| 30 | | 3 | `owner_repo` | `aien-dev/<name>` | |
| 31 | | 4 | `rev` | the exact commit, 40 lowercase hex | |
| 32 | | 5 | `ref_state` | `MERGED`, `DRAFT_PR#N`, `OPEN_PR#N` or `BRANCH:<name>` | |
| 33 | | 6 | `arch` | `host-aarch64`, `host-x86_64`, `GB10`, `QEMU`, `gpu:<name>` or `none` | |
| 34 | | 7 | `level` | `NONE_FOUND`, `PROPOSED`, `IMPLEMENTED`, `EXERCISED_HOST`, `EXERCISED_EMULATOR`, `EXERCISED_GB10`, `EXERCISED_OTHER_GPU`, `QUALIFIED_GB10` | |
| 35 | | 8 | `scope` | free text: what is covered (shapes, dtypes, ops) | |
| 36 | | 9 | `api_contract` | free text: the entry points or format | |
| 37 | | 10 | `test_command` | the command that produced the evidence; must not be `none` at an exercised or qualified level | |
| 38 | | 11 | `evidence` | `aien-dev/<repo>@<40-hex>:<path>` or `register:<path>` (relative to the register, no `..`) | |
| 39 | | 12 | `refusals` | what the component refuses or does not support | |
| 40 | | 13 | `deploy_state` | `NOT_DEPLOYED` or `DEPLOYED:<system>`; DEPLOYED needs `MERGED` | |
| 41 | | 14 | `audit_claim` | what the audit said, or `(post-audit)` for work it did not see | |
| 42 | | 15 | `audit_verdict` | `CONFIRMED`, `CORRECTED`, `OUTDATED`, `NEW` (exactly the `(post-audit)` rows) or `UNVERIFIED`; CORRECTED, OUTDATED and UNVERIFIED need a note | |
| 43 | | 16 | `note` | evidence for the verdict, or `-` | |
| 44 | |
| 45 | Level and arch must agree, so no row can claim more than its evidence architecture: |
| 46 | `NONE_FOUND`, `PROPOSED`, `IMPLEMENTED` need `none`; `EXERCISED_HOST` needs `host-*` (a CPU |
| 47 | Vulkan or OpenCL driver such as lavapipe or PoCL is host); `EXERCISED_EMULATOR` needs `QEMU`; |
| 48 | `EXERCISED_GB10` and `QUALIFIED_GB10` need `GB10`; `EXERCISED_OTHER_GPU` needs `gpu:<name>`. |
| 49 | `NONE_FOUND` needs `register:absence/<file>` evidence: the log of the search that found nothing. |
| 50 | It is not proof of absence. |
| 51 | |
| 52 | `check` judges form. Whether a cited file really exists at the cited commit is the separate |
| 53 | `capreg evidence REG CLONEROOT`, which runs `/usr/bin/git -C CLONEROOT/<repo> cat-file -e |
| 54 | <sha>:<path>` for every repository evidence (exit 3, NOT_RUN, when a clone is missing). It needs |
| 55 | network-fetched clones, so it is not part of the offline gate; its last run is recorded in |
| 56 | `docs/capability-register/evidence-check.log`. |
| 57 | |
| 58 | ## Use |
| 59 | |
| 60 | ```sh |
| 61 | omc=/path/to/pinned/omc # sha256 must match ../zero-legacy/omega.pin |
| 62 | mkdir -p build && "$omc" < capreg.om > build/capreg && chmod +x build/capreg |
| 63 | build/capreg check ../../docs/capability-register/register.tsv |
| 64 | build/capreg render ../../docs/capability-register/register.tsv > ../../docs/capability-register/REGISTER.md |
| 65 | AIEN_OMC="$omc" ../../tests/gates/run.sh capreg |
| 66 | ``` |
| 67 | |
| 68 | Exit codes: 0 pass; 1 the register (or view) fails a rule, one `FAIL line N: rule` per finding on |
| 69 | stderr; 3 NOT_RUN (evidence mode with a missing clone); 64 usage; 65 register unreadable or over |
| 70 | 500000 bytes; 100 + code on a trap. Capacities: 1024 records, a 999000-byte view. |
| 71 | |
| 72 | ## Where the gate runs |
| 73 | |
| 74 | `tests/gates/arch-capability-register.gate` says `requires: - host`: it needs the pinned AArch64 omc |
| 75 | of `../zero-legacy/omega.pin`. Without `AIEN_OMC`, `run.sh capreg` exits 3 (NOT_RUN). |
| 76 | |
| 77 | - **Hosted CI, every PR and every push to main:** the `AIEN Pinned-omc Gates` job of |
| 78 | `.github/workflows/aien-verification.yml` runs on an `ubuntu-24.04-arm` runner. It checks out the |
| 79 | omega-mv commit named in `omega.pin`, births omc from seed-0 with `sh seed/omega-from-seed.sh`, |
| 80 | refuses a compiler whose sha256 differs from `omc_sha256`, and runs `tests/gates/run.sh capreg` |
| 81 | (with `doctrine`, `zero-legacy` and `script-tests`). A red or NOT_RUN step fails the job. Like the |
| 82 | rest of that workflow it is advisory: main requires no status check. |
| 83 | - **The hosted AIEN Checks job** (x86) runs only `crumb verify` and the gates that require only |
| 84 | `portable`, so it never runs this gate. |
| 85 | - **On the Spark:** `AIEN_OMC=<pinned omc> tests/gates/run.sh capreg`, and `aien-alpha |
| 86 | aien-architecture <sha>`, which runs every gate. A hosted run is a run on GitHub's AArch64 runner, |
| 87 | not a signed Spark receipt. |