interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

Enforce fresh-checkout host gates on pull requests

merged c160048e5880444a #198 · opened 2026-10-30 14:55 UTC · closed 2026-10-30 16:31 UTC · merged 2026-10-30 16:31 UTC

Imported from GitHub aien-dev/CUDApp#198, by drakestapleton

Base bac733058d407a683fd7d2295410889f78dc7a46 · Head d558e5d06eb5f9c847dc8bd28c50c76d862c2acb

Merged on GitHub as 6bfd376064650e2188b6a08d7d0222074a5e0d1b; reachable from main 21d8de285f713adf09e0d6ba6db2b37139d0674e (observed 2026-11-18T16:38:25Z)

drakestapleton wrote on 2026-10-30 14:55 UTC

Purpose and scope

Pull requests now run the fresh-checkout host commands from docs/START_HERE.md, with a written rule for what each result means. Refs #90.

New files:

  • .github/workflows/host-gates.yml
  • tools/ci/host-gates.sh
  • docs/CI_ACCEPTANCE.md

Small pointers in docs/START_HERE.md, CONTRIBUTING.md, and AGENTS.md.

This does not edit ci.yml, runtime-api.yml, the Makefile, or any file from PR #170. It does not touch the frozen C stack, src/omega_cubin.*, or om/cubin/.

How this composes with #189 and the x86 job

  • make test stays the host-tests job in .github/workflows/ci.yml. This pull request does not run that suite a second time. The arm job still installs pinned nvdisasm 13.0.85 there, and still judges the exit code and the final CUDA++ HOST TESTS PASS line. Intentional FAIL and ERROR lines in that log stay visible.
  • make test-runtime-api stays .github/workflows/runtime-api.yml. Issue #189 owns that job. This pull request does not add another copy.
  • x86-64 make test is the x86-host-tests job in .github/workflows/host-x86.yml (PR #199). This pull request does not add that job and does not change the AArch64 host-tests job. On x86-64 the portable suite is the contract in docs/OMEGA_HOST_TESTS.md. The device open returns ENOTSUP and requires AArch64 Linux. That is not a supported GPU run.

What each gate runs

GateJobPass condition
make -j4host-gates / fresh-checkout on ubuntu-24.04-arm, 30 minute limitExit 0. Both archives exist. sha256 uploaded.
make testexisting ci.yml / host-testsExit 0 and the final PASS line.
make test-native-artifactfresh-checkoutExit 0 and test_gpu_artifact_export: <n> checks, 0 failed.
make zero-cuda-gatefresh-checkoutExit 0. Log keeps ZERO_CUDA FAIL for the stub libcudart probe, then ZERO_CUDA SELF-TEST PASS, then ZERO_CUDA PASS for the two binaries.
build/hello_gpu --simfresh-checkoutExit 0, the simulator sentence, the 1048576-element check, the pinned output sha256, and the same hashes on a second run. If make -j4 exits 0 and build/hello_gpu is missing, the three simulator rows are FAIL.
build/hello_gpu --sim --bug=past-endfresh-checkoutExit 1, FAULT, 0 bytes past the end of buffer a, and no PASS line.
build/hello_gpu --bug=past-endfresh-checkoutExit 2. Refuses to leave the simulator.
make doctorfresh-checkoutExit 2 only. Every line matching ^[[:space:]]*FAIL([[:space:]]|:|$) must equal one of the five allowlisted missing-hardware lines, and there must be exactly those five. The summary line starts with NOT READY: 5 problems above. Any other FAIL line, including one with no indent or a tab, fails the job. READY. Next: make hello-gpu fails the job.
python3 tools/figures/make_figures.py --checkhost-gates / figures on ubuntu-latest, 5 minute limitExit 0 and figures current: <n>.
tools/ci/host-gates.sh --self-testboth jobsChecker negative controls. The doctor cases reject an extra FAIL line, a summary count of 6, a missing allowlisted line, exit 1, exit 3, a FAIL line with no indent, and a tab before FAIL.

docs/img/stack.svg already matched the generator on main 522ee0d (figures current: 10). No SVG was rewritten.

CI on this pull request

GitHub tested head d558e5d06eb5f9c847dc8bd28c50c76d862c2acb.

host-gates passed. fresh-checkout last line: CUDA++ HOST GATES PASS. The self-test printed PASS doctor-fail-noindent, PASS doctor-fail-tab, and CUDA++ HOST GATES SELF-TEST PASS. make doctor exited 2 and was recorded PASS. Chip qualification stays NOT_RUN.

CI host-tests passed in 15m3s. Last line: CUDA++ HOST TESTS PASS (62 targets).

x86-host-tests passed in 7m47s.

The other checks also passed: runtime-api, hello-sim, library, drift, om-units, sbom, audit-scanner, and CodeQL.

Known limitations

  • make hello-gpu, chip tests, and any open of /dev/nvidia* or /dev/aien-gpu are NOT_RUN. The runners have no GB10.
  • The Inkscape legend test is NOT_RUN. Inkscape is not installed on the figure job.
  • An outside engineer following docs/START_HERE.md on a machine this repository does not control is NOT_RUN.
  • The ruleset main-verified-promotion still has no required status checks. Marking a check required is an administrator change and was not done.
  • This workflow does not run x86-64 make test and does not set CUDAPP_MEM_RESERVE_MIB. That suite is the x86-host-tests job in .github/workflows/host-x86.yml.

— Grokbot

<div><a href="https://cursor.com/agents/bc-a927ce42-2920-5f9f-a82f-cf7816015d8f?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-a927ce42-2920-5f9f-a82f-cf7816015d8f&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>

drakestapleton reviewed (COMMENTED) on 2026-10-30 14:58 UTC

Review at cbcbcabe32cdff532693dd1607d1edd2eab09bb2: needs changes (small). CI hasn't started yet: all 13 checks were queued at review time, so fresh-checkout has no AArch64 result yet.

Provenance. This is 1 commit from cloud agent bc-a927ce42, branched off main 522ee0d. The body says Refs #90, which matches the issue. It doesn't close #90, and that's correct, since the ruleset's required checks are left to an admin.

Scope. Existing workflows aren't touched (ci.yml and runtime-api.yml are unchanged). It adds a new file, .github/workflows/host-gates.yml, with two jobs:

  • figures (L21-37): runs on ubuntu-latest with a 5-minute limit.
  • fresh-checkout (L38-56): runs on ubuntu-24.04-arm with a 30-minute limit.

Triggers are pull_request plus pushes to main, and permissions are contents: read. checkout and upload-artifact are pinned to SHAs. concurrency cancels in-progress runs per ref.

Also changed: the new tools/ci/host-gates.sh (415 lines) and docs/CI_ACCEPTANCE.md, plus pointer lines in AGENTS.md L78, CONTRIBUTING.md L24-25 and docs/START_HERE.md L93-97. The check names figures and fresh-checkout are new, and none collides with host-tests, runtime-api or the others.

Fake-green check. This is mostly strict.

  • run_log captures rc. finish exits 1 on any FAIL (L250-259).
  • Each checker requires the exact exit code and its marker lines: artifact 0 failed, ZERO_CUDA self-test plus both binaries, sim pinned output sha with two identical runs, past-end exit 1 with no PASS, GPU bug path exit 2, doctor exit 2 with NOT READY and no READY. line, and figures with no stale.
  • --self-test covers the reject cases.
  • The || true at L46, L365 and L366 only guards greps whose result is then checked.
  • The if: always() lines are on the artifact upload only.

One gap fails open:

  • tools/ci/host-gates.sh L356 and L391-393. If make -j4 passes but build/hello_gpu isn't built, the three sim and bug gates are recorded NOT_RUN. record doesn't set fail for NOT_RUN, so the job ends with CUDA++ HOST GATES PASS with no sim run at all. The same pattern sits at L352-353, but there it's harmless, because the make -j4 failure already sets fail. Please make a missing build/hello_gpu after a successful make -j4 a FAIL, and add a self-test case for it.
  • Minor: doctor_ok matches make's Error 1 text (L295). That's fine, just brittle across make versions.

GB10. There's no claim beyond NOT_RUN. make hello-gpu, chip tests and device opens are NOT_RUN in both the script (L321) and the doc. The local evidence is x86-64 portable only, so the arm runner result is still pending.

Fit with #197 and #196. There are no shared files: #197 only edits runtime-api.yml. #196 is still an issue, with no PR open. Its x86 job should take a name other than host-tests, fresh-checkout, figures and runtime-api. If it edits ci.yml, it won't conflict with this PR. Suggested merge order: #197, then #198, then #196. No textual rebase is expected. #196's PR should update the pointers here (host-gates.yml L15, the script's x86-64 make test NOT_RUN note at L320, and docs/CI_ACCEPTANCE.md L9).

Follow-ups. The body lists none to file. It notes these as NOT_RUN or admin-only: the Inkscape legend test, an outside-engineer run, required status checks on main-verified-promotion, and x86 make test (#196).

— Grokbot

drakestapleton reviewed (COMMENTED) on 2026-10-30 15:47 UTC

Re-review at b7bc8daf5f3d66355e3f6809c6658f233fbc0ff8: needs changes (doctor gate only).

The branch has 2 commits: cbcbcab, then b7bc8da on top of it. It wasn't force-pushed. The base is now 86b78f2, after #199 merged. CI is green on all 14 checks: host-gates run 41080804127 (figures, fresh-checkout), ci run 41080804265, and the rest.

Fixed

  • hello_gpu missing. tools/ci/host-gates.sh L117-130 and L325-341: a successful make -j4 with no build/hello_gpu now records 3 FAILs and sets fail=1. NOT_RUN is kept only when make itself failed.
  • Self-tests. L256-287 feed real cases: a nonexistent path, an empty executable file, and a make rc of 2. They assert both fail and the FAIL/NOT_RUN row counts, and saved_fail carries any failure into the exit 1 at L295-299. CI runs --self-test in both jobs (host-gates.yml), and a self-test failure fails the job. The || true at L257, L277 and L278-279 only stops set -e from aborting before the asserts run. The return code and counts are still checked.
  • Error 1 text. It's gone from doctor_ok (L100-115), and L246-247 tests that the text alone doesn't pass.
  • x86 pointer. L395 now says ENFORCED_ELSEWHERE with x86-host-tests in host-x86.yml.

Doctor gate: doesn't meet the policy yet (L100-115). Exit codes are handled right: only rc 2 passes, and 0, 1, 3 and anything else fail at L102. The output check is loose, though:

  • It only checks that the five expected FAIL lines are present, using grep -F substring matches (L104-108). There's no check that they're the only ones, so an unexpected sixth FAIL ... line still passes. That's a fixed list of required lines, not an allowlist that rejects anything else.
  • The count isn't pinned. L109 accepts any NOT READY:, so NOT READY: 9 problems above passes.
  • The self-tests have no case for an unexpected problem line, a wrong count, or rc 1 or rc 3. Only rc 0 and the READY line are covered (L244-249).

What's needed:

  1. Take every line matching ^ FAIL and require it to equal one of the five allowlisted lines exactly. Those are the kernel module line (full text, including the /proc/... parenthesis), nvidiactl, nvidia0, nvidia-uvm, and no NVIDIA GPU. Any other FAIL line fails the gate.
  2. Require exactly 5 FAIL lines and an exact NOT READY: 5 problems above. prefix.
  3. Add self-test rejects for an extra unexpected FAIL line, a count of 6, a missing allowlisted line, rc 1 and rc 3.

Fake-green re-scan. It's clean: no continue-on-error, and no if: skip except always() on the artifact uploads. Every || true sits on a grep or count that's checked afterwards. GB10 stays NOT_RUN (L396), and the PR makes no chip claim.

#199 is merged and #197 is still open. The pointers are correct now.

— Grokbot

drakestapleton reviewed (COMMENTED) on 2026-10-30 16:09 UTC

Re-review at 16ff7c11f1b2cd7e610a24d84b765f351f6655ce: needs changes, one small gap left in how FAIL lines are found.

This head is a fast-forward from b7bc8da: it is 1 commit ahead and 0 behind, so nothing was force-pushed. The only file changed is tools/ci/host-gates.sh (+57/-8). The PR is mergeable and clean on base bac7330. All 15 checks are green at 16ff7c1: host-gates run 41084623303 (figures, fresh-checkout), x86-host-tests 41084623395, ci 41084623539, runtime-api 41084623271, hello-sim 41084623681, library 41084623293, drift 41084623479, and CodeQL 41084617093.

I ran the doctor_ok function from L103-153 against edge cases.

Works

  • Exit code (L124). Only exit 2 is accepted. Exit 0, 1 and 3 are all rejected.
  • Allowlist (L103-119). A case statement compares the whole line against the five allowlisted lines exactly.
    • Duplicates and missing lines. The total must be exactly 5 (L146) and each kind must appear once (L147), so a repeated line can't stand in for a missing one. I tested this: replacing uvm with a second nvidia0 is rejected.
    • Whitespace and partial matches. A trailing space, a longer line, or FAIL x with three spaces is rejected.
  • Summary line (L148-151). The pattern ^NOT READY: 5 problems above\. must match exactly once, and there must be exactly one ^NOT READY: line.
    • Rejected: 6 problems, 50 problems, bare NOT READY: 5, an indented summary, a duplicated summary, and a missing summary.
    • 50 can't match, because the literal problems must come straight after the 5.
  • Self-tests. These are real. expect_reject (L190-198) sets fail=1 whenever the checker accepts a case it should reject, and that leads to the exit 1 at L347-348.
    • doctor-extra-fail (L291-293) adds a sixth FAIL line.
    • doctor-count-6 (L294-295) uses sed to change the summary to 6.
    • doctor-missing-allowlisted-line (L296-297) drops the uvm line with grep -vxF.
    • doctor-exit1 and doctor-exit3 (L298-299) pass exit 1 and exit 3.

Gap (L132). FAIL lines are found with ' FAIL '*, which only catches lines starting with exactly two spaces, FAIL and two spaces. A FAIL line in any other form is never counted, so the gate still passes. I tested each of these appended to the good fixture, and each was ACCEPTED:

  • FAIL something (no leading spaces)
  • FAIL something (one leading space)
  • a tab followed by FAIL x

Fix. Treat any line matching ^[[:space:]]*FAIL([[:space:]]|:|$) as a problem line, so it must pass doctor_fail_line or the gate fails. Then add a self-test reject for one of these variant forms.

Fake-green scan. It's still clean. There's no continue-on-error, and no if: skip apart from always() on the uploads. The new || true on the grep -c calls (L148-149) feeds counts that are checked right after. GB10 stays NOT_RUN.

— Grokbot

drakestapleton reviewed (COMMENTED) on 2026-10-30 16:29 UTC

Re-review at d558e5d06eb5f9c847dc8bd28c50c76d862c2acb: ready to merge.

Diff. This head is a fast-forward from 16ff7c1: 1 commit ahead, 0 behind, so nothing was force-pushed. The only file changed is tools/ci/host-gates.sh (+10/-5):

  • the comment at L98-99;
  • the FAIL-line check at L132, which is now [[ "$line" =~ ^[[:space:]]*FAIL([[:space:]]|:|$) ]] instead of the case prefix;
  • two new self-tests at L297-304.

Nothing else changed.

Edge cases. I ran the new doctor_ok (L104-155) on these:

  • The good five-line output with exit 2 PASSES.
  • Each of these is REJECTED:
    • FAIL x with no indent;
    • FAIL x with one space;
    • a tab followed by FAIL x;
    • FAIL: x;
    • a bare FAIL, indented or not;
    • an allowlisted line with a trailing space;
    • FAIL x with three spaces;
    • a duplicated line standing in for uvm;
    • a missing uvm line;
    • a summary count of 6 or 50;
    • a missing summary;
    • exit 0, 1 or 3.
  • Lines starting FAILED, FAILURE or a lowercase fail aren't treated as problem lines, as the regex intends, so the gate still passes. That's acceptable: the doctor prints problems as FAIL . Note it for later if the doctor's output format changes.

Self-tests. Both are real:

  • doctor-fail-noindent (L299-301) appends FAIL x.
  • doctor-fail-tab (L302-304) appends a tab followed by FAIL x.

If either is accepted, expect_reject (L189-197) sets fail=1, which ends in SELF-TEST FAIL and exit 1 (L352-353). --self-test runs in both host-gates jobs.

CI. All 15 checks at d558e5d are green: host-gates 41087598473 (figures, fresh-checkout), x86-host-tests 41087598346, ci 41087598565, runtime-api 41087598377, hello-sim 41087598416, library 41087598383, drift 41087598347, and CodeQL 41087589254. The PR is mergeable clean on base bac7330, and #197 merged at 10:53 AM CT.

Fake-green scan. Still clean: no continue-on-error, and no if: skip apart from always() on the uploads. Every || true is followed by a check. GB10 stays NOT_RUN.

— Grokbot

Apply it

git checkout -b patch-c160048e5880444a bac733058d407a683fd7d2295410889f78dc7a46
curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/c160048e5880444a.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/CUDApp
198
d558e5d06eb5f9c847dc8bd28c50c76d862c2acb
{"kind":"github-import","owner":"aien-dev","repo":"CUDApp","number":198,"url":"https://github.com/aien-dev/CUDApp/pull/198","export_sha256":"0aafd51b77ff5776d6baaf9b88b48c8b36a6e27c8d829ae8ded561b71712b17a","imported_utc":"2026-11-18T16:38:25Z"}

Changes

diff --git a/.github/workflows/host-gates.yml b/.github/workflows/host-gates.yml
new file mode 100644
index 00000000..b60bd6f1
--- /dev/null
+++ b/.github/workflows/host-gates.yml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+# Fresh-checkout host gates (issue #90).
+#
+# Composition, so this file stays small:
+# - make test is already the host-tests job in ci.yml. It is not repeated here.
+# - make test-runtime-api is runtime-api.yml. Issue #189 owns that job.
+# - x86-64 make test is the x86-host-tests job in .github/workflows/host-x86.yml. This file does not add it.
+# The AArch64 job below is the documented Linux host path with no GPU device opened.
+# Budgets: make -j4, 30 minutes on the arm runner, 5 minutes for the figure check.
+name: host-gates
+on:
+  pull_request:
+  push:
+    branches: [main]
+permissions:
+  contents: read
+concurrency:
+  group: host-gates-${{ github.ref }}
+  cancel-in-progress: true
+jobs:
+  figures:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
+      - name: Checker negative controls
+        run: bash tools/ci/host-gates.sh --self-test
+      - name: Figure check
+        run: bash tools/ci/host-gates.sh --figures
+      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+        if: always()
+        with:
+          name: host-gates-figures-${{ github.sha }}
+          path: build/host-gates/
+          if-no-files-found: warn
+  fresh-checkout:
+    runs-on: ubuntu-24.04-arm
+    timeout-minutes: 30
+    steps:
+      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+        with:
+          persist-credentials: false
+      - name: Checker negative controls
+        run: bash tools/ci/host-gates.sh --self-test
+      - name: Host gates
+        env:
+          HOST_GATES_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
+        run: bash tools/ci/host-gates.sh
+      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+        if: always()
+        with:
+          name: host-gates-${{ github.sha }}
+          path: build/host-gates/
+          if-no-files-found: warn
diff --git a/AGENTS.md b/AGENTS.md
index 479c406e..50a47402 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -75,7 +75,7 @@ make hello-gpu                              # runs make doctor, then examples/he
 - Status words in `README.md` and `ROADMAP.md` are PASS (receipt on a named commit), PARTIAL, MISSING, BUILDING. Do not upgrade a status without the receipt.
 - New source files carry `SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception`. Keep third-party notices (`THIRD_PARTY.md`, `NOTICE`).
 - Plain English, short sentences, every number with the command that produced it.
-- Pull request CI runs the host-only `make test` suite, pinned Omega binding regeneration and mutants, SBOM generation and GitHub CodeQL. Its disposable arm64 host-test runner installs only the checksum-verified NVIDIA `nvdisasm` 13.0.85 executable and the bridge source pinned by `om/omega-bridge.lock`. The archive URL and SHA-256 are fixed in `.github/workflows/ci.yml`, from NVIDIA's `redistrib_13.0.2.json` manifest. The oracle is verification-only: no CUDA driver, runtime or compiler is installed, no NVIDIA binary is committed, and no GPU is opened. Provisioning errors and missing-oracle checks remain failures. Put local results in the pull request with their exact source revision; all-green host CI is not physical qualification.
+- Pull request CI runs the host-only `make test` suite, pinned Omega binding regeneration and mutants, SBOM generation and GitHub CodeQL. Its disposable arm64 host-test runner installs only the checksum-verified NVIDIA `nvdisasm` 13.0.85 executable and the bridge source pinned by `om/omega-bridge.lock`. The archive URL and SHA-256 are fixed in `.github/workflows/ci.yml`, from NVIDIA's `redistrib_13.0.2.json` manifest. The oracle is verification-only: no CUDA driver, runtime or compiler is installed, no NVIDIA binary is committed, and no GPU is opened. Provisioning errors and missing-oracle checks remain failures. Put local results in the pull request with their exact source revision; all-green host CI is not physical qualification. `.github/workflows/host-gates.yml` runs `make -j4`, `make test-native-artifact`, `make zero-cuda-gate`, `build/hello_gpu --sim`, read-only `make doctor`, and `python3 tools/figures/make_figures.py --check`. `make test` stays in the `host-tests` job. The rules are `docs/CI_ACCEPTANCE.md`.
 
 ## Safety and approvals
 
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5c17f0f4..2c45c16c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -21,6 +21,8 @@ build/hello_gpu --sim   # simulator, not a hardware result
 make doctor             # diagnostic; may report NOT READY on other hosts
 ```
 
+Pull requests run those host commands. The acceptance rules are [docs/CI_ACCEPTANCE.md](docs/CI_ACCEPTANCE.md). A green check is a host or simulator result for that commit. It is not a GB10 result.
+
 Only on a qualified GB10 when it is safe to use the GPU (never interrupt a live service):
 
 ```sh
diff --git a/docs/CI_ACCEPTANCE.md b/docs/CI_ACCEPTANCE.md
new file mode 100644
index 00000000..145a7129
--- /dev/null
+++ b/docs/CI_ACCEPTANCE.md
@@ -0,0 +1,50 @@
+# CI acceptance
+
+A pull-request check is a result for the commit GitHub built. A green host check is not a GB10 qualification. Commands that did not run are `NOT_RUN`.
+
+The workflow is `.github/workflows/host-gates.yml`. It composes with the jobs that already exist:
+
+- `make test` is the `host-tests` job in `.github/workflows/ci.yml`. That job judges the process exit code and the last line, `CUDA++ HOST TESTS PASS (<count> targets)`. The log keeps intentional `FAIL` and `ERROR` lines from mutants and negative controls. This policy does not start a second copy of that suite.
+- `make test-runtime-api` is `.github/workflows/runtime-api.yml`. Issue #189 owns any further change to that job.
+- x86-64 `make test` is the `x86-host-tests` job in `.github/workflows/host-x86.yml`. This policy does not add that job.
+
+## What each gate is
+
+| Command | Where it runs | What a pass is |
+| --- | --- | --- |
+| `make -j4` | `host-gates` / `fresh-checkout`, `ubuntu-24.04-arm`, 30 minute limit | Exit 0. `build/libomega_gpu.a` and `build/libcudapp.a` exist. Their sha256 is uploaded. |
+| `make test` | `ci.yml` / `host-tests`, same arm runner | Exit 0 and the final `CUDA++ HOST TESTS PASS` line. Needs the pinned `nvdisasm` 13.0.85, full git history, and the pinned Omega tools named in that workflow. |
+| `make test-native-artifact` | `host-gates` / `fresh-checkout` | Exit 0 and a last summary `test_gpu_artifact_export: <n> checks, 0 failed`. |
+| `make zero-cuda-gate` | `host-gates` / `fresh-checkout` | Exit 0. The log still shows `ZERO_CUDA FAIL` for the stub `libcudart` probe, then `ZERO_CUDA SELF-TEST PASS`, then `ZERO_CUDA PASS` for `build/hello_gpu` and `build/gpu_matmul_api_test`. |
+| `build/hello_gpu --sim` | `host-gates` / `fresh-checkout` | Exit 0, the host-simulator sentence, the 1048576-element check, the work line, the pinned output sha256, and the same hashes on a second run. This is the warp simulator. |
+| `make doctor` | `host-gates` / `fresh-checkout` | The runner has no NVIDIA module and no GPU node, so `make` exits 2 and the log contains `NOT READY:` plus the five refusal lines and `NOT_RUN` for the seeded target table. A line `READY. Next: make hello-gpu` fails the job. Chip qualification stays `NOT_RUN`. |
+| `python3 tools/figures/make_figures.py --check` | `host-gates` / `figures`, `ubuntu-latest`, 5 minute limit | Exit 0 and `figures current: <n>`. `docs/img/stack.svg` is one of those files. |
+
+`build/hello_gpu --sim --bug=past-end` must exit 1, print the `FAULT` line, and name `0 bytes past the end of buffer a`. That path does not print `PASS`. `build/hello_gpu --bug=past-end` must exit 2 and refuse to run off the simulator. Those two are negative controls. `make zero-cuda-gate` also prints `ZERO_CUDA FAIL` for its stub probe. That text stays in the log. The job is judged by its exit code and its last line, `CUDA++ HOST GATES PASS`, the same way `make test` is judged.
+
+The checker itself has a negative control: `tools/ci/host-gates.sh --self-test`. A log that contains `ZERO_CUDA FAIL` and still exits 0 must be accepted. A doctor log that says `NOT READY` must be accepted. A doctor log that also says `READY. Next: make hello-gpu` must be rejected. A figure log that says `stale figures` must be rejected.
+
+## Classes
+
+- **Host-only.** `make -j4`, `make test`, `make test-native-artifact`, `make zero-cuda-gate`. No device node is opened.
+- **Simulator-only.** `build/hello_gpu --sim`. A simulator pass is not hardware qualification and not a performance result.
+- **Target-specific compile.** AArch64 Linux is the native host. Production ordering there stays `dsb sy` (`nvrm/cpu_barrier.h`). On x86-64 the portable suite is the one in `docs/OMEGA_HOST_TESTS.md`: `make test` with gcc, no NVIDIA tool and no sibling checkout. The x86-64 device open returns `ENOTSUP` and the text `requires AArch64 Linux`. That is `NOT SUPPORTED` for a GPU run. The receipt `evidence/HOST-X86-20261030/` is for its own commit. On that VM the default `CUDAPP_MEM_RESERVE_MIB` of 4096 made `make test` exit 2, and the suite passed only with `CUDAPP_MEM_RESERVE_MIB=0`. The default is unchanged. This workflow does not set the reserve and does not run the x86-64 suite.
+- **GPU-only.** `make hello-gpu` and `./build/gpu_*_test` on a GB10. GitHub runners have no GB10 and no `/dev/aien-gpu`. Those commands are `NOT_RUN`. A missing GPU run is never recorded as a pass.
+
+## Figures
+
+`tools/figures/make_figures.py` is the source of the README pictures. `--check` compares its bytes with `docs/img/`. On `522ee0d` it printed `figures current: 10`, so `docs/img/stack.svg` already matched the generator. A later change that moves the generator must commit the regenerated SVG in the same change. A hand edit that makes the SVG disagree with the generator fails the check. The rendered legend test (`tools/figures/test_stack_legend.py`) needs Inkscape. The hosted figure job does not install Inkscape, so that test is `NOT_RUN` there. When Inkscape is on `PATH`, the same job runs it.
+
+## Toolchain
+
+`fresh-checkout` uses the `ubuntu-24.04-arm` image's `gcc`, `make` and `python3`. It installs no packages and no CUDA toolkit. `make -j4` is the compile budget. The job records `git rev-parse HEAD`, `uname`, the compiler line and the archive sha256 in the `host-gates-<sha>` artifact. The figure job uploads `host-gates-figures-<sha>`. No vendor binary, model weight or home-directory path is committed.
+
+`make test` on the arm runner still installs the checksum-verified `nvdisasm` named in `ci.yml`. That oracle is verification-only. The host-gates job does not need it.
+
+## What a green pull request does not prove
+
+The active ruleset `main-verified-promotion` blocks deletion and non-fast-forward pushes. It does not list required status checks. The workflows start on every pull request. Marking a check required is an administrator change and is `NOT_RUN` here.
+
+An outside engineer following `docs/START_HERE.md` on a machine this repository does not control is `NOT_RUN`.
+
+`make hello-gpu`, every chip test, and any open of `/dev/nvidia*` or `/dev/aien-gpu` are `NOT_RUN` on these runners.
diff --git a/docs/START_HERE.md b/docs/START_HERE.md
index 24ad2112..3a51f3c3 100644
--- a/docs/START_HERE.md
+++ b/docs/START_HERE.md
@@ -90,9 +90,11 @@ maps and receipts remain unchanged. The obsolete
 [consumer PR #618](https://github.com/aien-dev/omega-mv/pull/618) used an older
 pin and different source-check contract; it is not the canonical cutover base.
 
-On x86-64, `make test` is the portable host suite. Production `dsb sy` stays on AArch64 (`nvrm/cpu_barrier.h`). The x86-64 publication barrier is a real sequentially consistent fence. A target-only check that names its requirement and exits 2 is not a pass of that check. The two lists are in [docs/OMEGA_HOST_TESTS.md](OMEGA_HOST_TESTS.md) ([#15](https://github.com/aien-dev/CUDApp/issues/15)).
+On x86-64, `make test` is the portable host suite. Production `dsb sy` stays on AArch64 (`nvrm/cpu_barrier.h`). The x86-64 publication barrier is a real sequentially consistent fence. A target-only check that names its requirement and exits 2 is not a pass of that check. The two lists are in [docs/OMEGA_HOST_TESTS.md](OMEGA_HOST_TESTS.md) ([#15](https://github.com/aien-dev/CUDApp/issues/15)). The x86-64 device path returns `ENOTSUP` and the text `requires AArch64 Linux`. That path is not a supported GPU run.
 
-Optional: `python3 tools/figures/make_figures.py --check` verifies that README diagrams match the generator. Check it on your exact commit.
+`python3 tools/figures/make_figures.py --check` verifies that the README diagrams, including `docs/img/stack.svg`, match `tools/figures/make_figures.py`. It must print `figures current:` and exit 0. Pull requests run that check. When the generator changes, commit the regenerated SVG in the same change. A diagram that disagrees with the generator fails the check.
+
+Pull requests also run `make -j4`, `make test-native-artifact`, `make zero-cuda-gate`, `build/hello_gpu --sim` and read-only `make doctor` on `ubuntu-24.04-arm`. `make test` runs as the `host-tests` job. None of those jobs open a GPU. What a green check means is [docs/CI_ACCEPTANCE.md](CI_ACCEPTANCE.md).
 
 ## 3. Diagnose a native GPU machine
 
diff --git a/tools/ci/host-gates.sh b/tools/ci/host-gates.sh
new file mode 100755
index 00000000..a92b2392
--- /dev/null
+++ b/tools/ci/host-gates.sh
@@ -0,0 +1,539 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+# Fresh-checkout host gates. Reads no GPU device node and does not run make hello-gpu.
+#
+#   tools/ci/host-gates.sh --self-test   checker negative controls (no compile)
+#   tools/ci/host-gates.sh --figures     README figure byte check
+#   tools/ci/host-gates.sh               make -j4 and the host commands below
+#
+# make test is the host-tests job in .github/workflows/ci.yml. This script does not repeat it.
+# make test-runtime-api is .github/workflows/runtime-api.yml (#189). An x86-64 host-tests
+# job is #196. Neither is started here.
+set -euo pipefail
+export LC_ALL=C
+
+root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
+cd "$root"
+out=build/host-gates
+mkdir -p "$out"
+
+# Simulator output of c = a + b over 2^20 floats. Measured by build/hello_gpu --sim.
+# Pinned so a silent answer change fails even when the program still prints PASS.
+output_sha='output sha256 72d0c1b2928779e83518f0b4c7d101d933cf89f210cd4627e138c33c9ce9b6a6'
+
+fail=0
+summary=$out/summary.txt
+
+note() { printf '%s\n' "$*" | tee -a "$summary"; }
+
+run_log() {
+	local log=$1
+	shift
+	set +e
+	"$@" >"$log" 2>&1
+	local rc=$?
+	set -e
+	cat "$log"
+	printf '%s\n' "$rc" >"$log.rc"
+}
+
+rc_of() { cat "$1.rc"; }
+
+archives_ok() {
+	local rc=$1 dir=$2
+	[ "$rc" -eq 0 ] || return 1
+	[ -f "$dir/libomega_gpu.a" ] && [ -f "$dir/libcudapp.a" ]
+}
+
+artifact_ok() {
+	local rc=$1 log=$2 line
+	[ "$rc" -eq 0 ] || return 1
+	line=$(grep -E '^test_gpu_artifact_export: ' "$log" | tail -n 1 || true)
+	[[ "$line" =~ ^test_gpu_artifact_export:\ [0-9]+\ checks,\ 0\ failed$ ]]
+}
+
+zero_cuda_ok() {
+	local rc=$1 log=$2
+	[ "$rc" -eq 0 ] || return 1
+	grep -qF 'ZERO_CUDA SELF-TEST PASS (CUDA probe rejected, clean library accepted)' "$log" || return 1
+	grep -qF 'ZERO_CUDA FAIL' "$log" || return 1
+	grep -qF 'libcudart.so' "$log" || return 1
+	grep -qF 'cudaMalloc' "$log" || return 1
+	grep -qF 'ZERO_CUDA PASS build/hello_gpu needs=' "$log" || return 1
+	grep -qF 'ZERO_CUDA PASS build/gpu_matmul_api_test needs=' "$log" || return 1
+	grep -qF 'ZERO_CUDA SELF-TEST BROKEN' "$log" && return 1
+	return 0
+}
+
+sim_ok() {
+	local rc=$1 log=$2
+	[ "$rc" -eq 0 ] || return 1
+	grep -qF 'on the host simulator (no GPU)' "$log" || return 1
+	grep -qF 'checked 1048576 of 1048576 elements: 0 wrong, 0 never written' "$log" || return 1
+	grep -qF 'work: 12582912 bytes moved (8388608 read, 4194304 written), 1048576 floating-point operations' "$log" || return 1
+	grep -qF "$output_sha" "$log" || return 1
+	grep -qxF 'PASS' "$log" || return 1
+	grep -qE '^machine code sha256 [0-9a-f]{64}$' "$log" || return 1
+}
+
+# The fault path exits 1 from inside the launch loop. It prints FAULT and does not print PASS.
+past_end_ok() {
+	local rc=$1 log=$2
+	[ "$rc" -eq 1 ] || return 1
+	grep -qF 'FAULT at launch 8 of 8 of kernel vecadd (simulator): global load outside every buffer' "$log" || return 1
+	grep -qF '0 bytes past the end of buffer a' "$log" || return 1
+	grep -qF '0 wrong, 0 never written' "$log" && return 1
+	grep -qxF 'PASS' "$log" && return 1
+	return 0
+}
+
+gpu_bug_refused_ok() {
+	local rc=$1 log=$2
+	[ "$rc" -eq 2 ] || return 1
+	grep -qF -e '--bug=past-end is only for --sim: on the GPU it would write past a buffer' "$log" || return 1
+}
+
+# make's exit status is the decision. Exit 2 is the recipe refusal. Every other exit fails.
+# The words "Error 1" in make's message are not part of the check.
+# Every line matching ^[[:space:]]*FAIL([[:space:]]|:|$) is a problem line.
+# It must equal one of the five missing-hardware lines, whole line, and it counts toward the five.
+# A longer line, a prefix, or any other FAIL line fails. There must be exactly those five.
+# The summary line must start with "NOT READY: 5 problems above."
+doctor_fail_line() {
+	case $1 in
+	'  FAIL  NVIDIA kernel module: not loaded (/proc/driver/nvidia/version does not exist)')
+		printf '%s\n' module ;;
+	'  FAIL  device files: /dev/nvidiactl is missing')
+		printf '%s\n' ctl ;;
+	'  FAIL  device files: /dev/nvidia0 is missing')
+		printf '%s\n' gpu0 ;;
+	'  FAIL  device files: /dev/nvidia-uvm is missing')
+		printf '%s\n' uvm ;;
+	'  FAIL  GPU: no NVIDIA GPU found in /sys/bus/pci/devices')
+		printf '%s\n' gpu ;;
+	*)
+		return 1
+		;;
+	esac
+}
+
+doctor_ok() {
+	local rc=$1 log=$2 line kind n=0 module=0 ctl=0 gpu0=0 uvm=0 gpu=0
+	local ready_n any_ready
+	[ "$rc" -eq 2 ] || return 1
+	grep -qF 'cudapp doctor: is this machine ready for CUDA++?' "$log" || return 1
+	grep -qF 'NOT_RUN: the target table is seeded Omega' "$log" || return 1
+	if grep -qxF 'READY. Next: make hello-gpu' "$log"; then
+		return 1
+	fi
+	while IFS= read -r line || [ -n "$line" ]; do
+		if [[ "$line" =~ ^[[:space:]]*FAIL([[:space:]]|:|$) ]]; then
+			kind=$(doctor_fail_line "$line") || return 1
+			n=$((n + 1))
+			case $kind in
+			module) module=$((module + 1)) ;;
+			ctl) ctl=$((ctl + 1)) ;;
+			gpu0) gpu0=$((gpu0 + 1)) ;;
+			uvm) uvm=$((uvm + 1)) ;;
+			gpu) gpu=$((gpu + 1)) ;;
+			*) return 1 ;;
+			esac
+		fi
+	done <"$log"
+	[ "$n" -eq 5 ] || return 1
+	[ "$module" -eq 1 ] && [ "$ctl" -eq 1 ] && [ "$gpu0" -eq 1 ] && [ "$uvm" -eq 1 ] && [ "$gpu" -eq 1 ] || return 1
+	ready_n=$(grep -cE '^NOT READY: 5 problems above\.' "$log" || true)
+	any_ready=$(grep -cE '^NOT READY:' "$log" || true)
+	[ "$ready_n" -eq 1 ] || return 1
+	[ "$any_ready" -eq 1 ] || return 1
+	return 0
+}
+
+# RUN when the binary can be executed. FAIL when make -j4 exited 0 and it is missing.
+# NOT_RUN only when that build already failed.
+hello_sim_rows() {
+	local make_rc=$1 hello=$2
+	if [ -x "$hello" ]; then
+		printf '%s\n' RUN
+		return 0
+	fi
+	if [ "$make_rc" -eq 0 ]; then
+		printf '%s\n' FAIL
+		return 0
+	fi
+	printf '%s\n' NOT_RUN
+}
+
+figures_ok() {
+	local rc=$1 log=$2
+	[ "$rc" -eq 0 ] || return 1
+	grep -qE '^figures current: [0-9]+$' "$log" || return 1
+	grep -qF 'stale figures' "$log" && return 1
+	return 0
+}
+
+expect_ok() {
+	local name=$1
+	shift
+	if "$@"; then
+		echo "PASS $name"
+		return 0
+	fi
+	echo "FAIL $name"
+	fail=1
+	return 0
+}
+
+expect_reject() {
+	local name=$1
+	shift
+	if "$@"; then
+		echo "FAIL $name (checker accepted a case that must be rejected)"
+		fail=1
+		return 0
+	fi
+	echo "PASS $name"
+}
+
+self_test() {
+	local t log
+	t=$(mktemp -d)
+	log=$t/log
+
+	mkdir -p "$t/both"
+	: >"$t/both/libomega_gpu.a"
+	: >"$t/both/libcudapp.a"
+	expect_ok archives-both archives_ok 0 "$t/both"
+	expect_reject archives-missing archives_ok 0 "$t"
+	expect_reject archives-bad-exit archives_ok 2 "$t/both"
+
+	printf '%s\n' 'test_gpu_artifact_export: 47 checks, 0 failed' >"$log"
+	expect_ok artifact-clean artifact_ok 0 "$log"
+	printf '%s\n' 'FAIL tamper caught' 'test_gpu_artifact_export: 47 checks, 0 failed' >"$log"
+	expect_ok artifact-fail-word-kept artifact_ok 0 "$log"
+	printf '%s\n' 'test_gpu_artifact_export: 47 checks, 1 failed' >"$log"
+	expect_reject artifact-failed-count artifact_ok 0 "$log"
+	printf '%s\n' 'test_gpu_artifact_export: 47 checks, 0 failed' >"$log"
+	expect_reject artifact-bad-exit artifact_ok 1 "$log"
+
+	cat >"$log" <<'EOF'
+ZERO_CUDA FAIL /tmp/probe.so needs: libcudart.so.13
+ZERO_CUDA FAIL /tmp/probe.so imports: cudaMalloc
+ZERO_CUDA SELF-TEST PASS (CUDA probe rejected, clean library accepted)
+ZERO_CUDA PASS build/hello_gpu needs=[libm.so.6 libc.so.6]
+ZERO_CUDA PASS build/gpu_matmul_api_test needs=[libc.so.6]
+EOF
+	expect_ok zero-cuda-with-visible-fail zero_cuda_ok 0 "$log"
+	expect_reject zero-cuda-bad-exit zero_cuda_ok 1 "$log"
+	printf '%s\n' 'ZERO_CUDA PASS build/hello_gpu needs=[libc.so.6]' >"$log"
+	expect_reject zero-cuda-hidden-control zero_cuda_ok 0 "$log"
+
+	cat >"$log" <<EOF
+hello_gpu: c = a + b over 1048576 floats on the host simulator (no GPU), built with Omega's own kernel builder
+machine code sha256 9e28bd9c46f80584d77238a752e99cecddbc8d622ffbe320885ed2f499e1f075
+checked 1048576 of 1048576 elements: 0 wrong, 0 never written
+work: 12582912 bytes moved (8388608 read, 4194304 written), 1048576 floating-point operations
+$output_sha
+PASS
+EOF
+	expect_ok sim-pass sim_ok 0 "$log"
+	printf '%s\n' 'PASS' >"$log"
+	expect_reject sim-pass-only sim_ok 0 "$log"
+	cat >"$log" <<EOF
+on the host simulator (no GPU)
+checked 1048576 of 1048576 elements: 0 wrong, 0 never written
+work: 12582912 bytes moved (8388608 read, 4194304 written), 1048576 floating-point operations
+$output_sha
+machine code sha256 9e28bd9c46f80584d77238a752e99cecddbc8d622ffbe320885ed2f499e1f075
+FAIL
+EOF
+	expect_reject sim-printed-fail sim_ok 0 "$log"
+
+	cat >"$log" <<'EOF'
+FAULT at launch 8 of 8 of kernel vecadd (simulator): global load outside every buffer
+  address: 0x1000 (4 bytes), 0 bytes past the end of buffer a = [0x0, 0x1000) (4194304 bytes)
+EOF
+	expect_ok past-end past_end_ok 1 "$log"
+	printf '%s\n' \
+		'FAULT at launch 8 of 8 of kernel vecadd (simulator): global load outside every buffer' \
+		'0 bytes past the end of buffer a' \
+		'checked 1048576 of 1048576 elements: 0 wrong, 0 never written' \
+		'PASS' >"$log"
+	expect_reject past-end-continued past_end_ok 1 "$log"
+	expect_reject past-end-exit0 past_end_ok 0 "$log"
+
+	printf '%s\n' '--bug=past-end is only for --sim: on the GPU it would write past a buffer' >"$log"
+	expect_ok gpu-bug-refused gpu_bug_refused_ok 2 "$log"
+	expect_reject gpu-bug-exit0 gpu_bug_refused_ok 0 "$log"
+
+	cat >"$log" <<'EOF'
+cudapp doctor: is this machine ready for CUDA++?
+  FAIL  NVIDIA kernel module: not loaded (/proc/driver/nvidia/version does not exist)
+  FAIL  device files: /dev/nvidiactl is missing
+  FAIL  device files: /dev/nvidia0 is missing
+  FAIL  device files: /dev/nvidia-uvm is missing
+  FAIL  GPU: no NVIDIA GPU found in /sys/bus/pci/devices
+NOT READY: 5 problems above. Fix the first FAIL line and run make doctor again.
+  NOT_RUN: the target table is seeded Omega and needs the pinned omc.
+EOF
+	cp "$log" "$t/doctor-good"
+	expect_ok doctor-not-ready doctor_ok 2 "$log"
+	expect_reject doctor-exit0 doctor_ok 0 "$log"
+	printf '%s\n' 'make: *** [mk/dx-doctor.mk:14: doctor] Error 1' >>"$log"
+	expect_reject doctor-error-text-exit0 doctor_ok 0 "$log"
+	printf '%s\n' 'READY. Next: make hello-gpu' >>"$log"
+	expect_reject doctor-ready-line doctor_ok 2 "$log"
+	grep -qF 'NOT READY:' "$log" || { echo "FAIL doctor fixture lost NOT READY"; fail=1; }
+
+	cp "$t/doctor-good" "$t/doctor-extra"
+	printf '%s\n' '  FAIL  device files: /dev/nvidia0 exists but this user cannot open it for reading and writing' >>"$t/doctor-extra"
+	expect_reject doctor-extra-fail doctor_ok 2 "$t/doctor-extra"
+	sed 's/^NOT READY: 5 problems above\./NOT READY: 6 problems above./' "$t/doctor-good" >"$t/doctor-count6"
+	expect_reject doctor-count-6 doctor_ok 2 "$t/doctor-count6"
+	grep -vxF '  FAIL  device files: /dev/nvidia-uvm is missing' "$t/doctor-good" >"$t/doctor-missing"
+	expect_reject doctor-missing-allowlisted-line doctor_ok 2 "$t/doctor-missing"
+	expect_reject doctor-exit1 doctor_ok 1 "$t/doctor-good"
+	expect_reject doctor-exit3 doctor_ok 3 "$t/doctor-good"
+	cp "$t/doctor-good" "$t/doctor-noindent"
+	printf '%s\n' 'FAIL  x' >>"$t/doctor-noindent"
+	expect_reject doctor-fail-noindent doctor_ok 2 "$t/doctor-noindent"
+	cp "$t/doctor-good" "$t/doctor-tab"
+	printf '\tFAIL x\n' >>"$t/doctor-tab"
+	expect_reject doctor-fail-tab doctor_ok 2 "$t/doctor-tab"
+
+	saved_fail=$fail
+	saved_summary=$summary
+	fail=0
+	summary=$t/missing-hello-summary.txt
+	: >"$summary"
+	record_hello_or_fail 0 "$t/no-such-hello" || true
+	rows=$(grep -c '	FAIL	' "$summary" || true)
+	if [ "$fail" -eq 1 ] && [ "$rows" -eq 3 ]; then
+		echo "PASS missing-hello-after-make"
+	else
+		echo "FAIL missing-hello-after-make (fail=$fail rows=$rows)"
+		saved_fail=1
+	fi
+	fail=0
+	: >"$summary"
+	: >"$t/hello_gpu"
+	chmod +x "$t/hello_gpu"
+	if record_hello_or_fail 0 "$t/hello_gpu"; then
+		echo "PASS hello-present-is-run"
+	else
+		echo "FAIL hello-present-is-run"
+		saved_fail=1
+	fi
+	fail=0
+	: >"$summary"
+	record_hello_or_fail 2 "$t/no-such-hello" || true
+	rows=$(grep -c '	NOT_RUN	' "$summary" || true)
+	bad_rows=$(grep -c '	FAIL	' "$summary" || true)
+	if [ "$fail" -eq 0 ] && [ "$rows" -eq 3 ] && [ "$bad_rows" -eq 0 ]; then
+		echo "PASS missing-hello-after-failed-make"
+	else
+		echo "FAIL missing-hello-after-failed-make (fail=$fail not_run=$rows fail_rows=$bad_rows)"
+		saved_fail=1
+	fi
+	fail=$saved_fail
+	summary=$saved_summary
+
+	printf '%s\n' 'figures current: 10' >"$log"
+	expect_ok figures-current figures_ok 0 "$log"
+	printf '%s\n' 'stale figures (run python3 tools/figures/make_figures.py): stack.svg' >"$log"
+	expect_reject figures-stale figures_ok 1 "$log"
+	printf '%s\n' 'figures current: 10' >"$log"
+	expect_reject figures-bad-exit figures_ok 1 "$log"
+
+	rm -rf "$t"
+	if [ "$fail" -ne 0 ]; then
+		echo "CUDA++ HOST GATES SELF-TEST FAIL" | tee "$out/self-test.txt"
+		exit 1
+	fi
+	echo "CUDA++ HOST GATES SELF-TEST PASS" | tee "$out/self-test.txt"
+	exit 0
+}
+
+finish() {
+	echo "----- summary -----"
+	cat "$summary"
+	if [ "$fail" -ne 0 ]; then
+		echo "CUDA++ HOST GATES FAIL"
+		exit 1
+	fi
+	echo "CUDA++ HOST GATES PASS"
+	exit 0
+}
+
+record() {
+	# name, exit, result, detail
+	note "$(printf '%s\texit=%s\t%s\t%s' "$1" "$2" "$3" "$4")"
+	if [ "$3" = FAIL ]; then
+		fail=1
+	fi
+}
+
+# Returns 0 only when the three simulator commands should run.
+# A successful make -j4 with no build/hello_gpu records three FAILs.
+record_hello_or_fail() {
+	local make_rc=$1 hello=$2 how
+	how=$(hello_sim_rows "$make_rc" "$hello")
+	if [ "$how" = RUN ]; then
+		return 0
+	fi
+	if [ "$how" = FAIL ]; then
+		record 'build/hello_gpu --sim' '-' FAIL 'make -j4 exited 0 and build/hello_gpu is missing'
+		record 'build/hello_gpu --sim --bug=past-end' '-' FAIL 'make -j4 exited 0 and build/hello_gpu is missing'
+		record 'build/hello_gpu --bug=past-end' '-' FAIL 'make -j4 exited 0 and build/hello_gpu is missing'
+		return 1
+	fi
+	record 'build/hello_gpu --sim' '-' NOT_RUN 'blocked: build/hello_gpu was not built'
+	record 'build/hello_gpu --sim --bug=past-end' '-' NOT_RUN 'blocked: build/hello_gpu was not built'
+	record 'build/hello_gpu --bug=past-end' '-' NOT_RUN 'blocked: build/hello_gpu was not built'
+	return 1
+}
+
+figures_mode() {
+	local log=$out/figures.log rc
+	: >"$summary"
+	run_log "$log" python3 tools/figures/make_figures.py --check
+	rc=$(rc_of "$log")
+	if figures_ok "$rc" "$log"; then
+		record 'python3 tools/figures/make_figures.py --check' "$rc" PASS "$(grep -E '^figures current: ' "$log")"
+	else
+		record 'python3 tools/figures/make_figures.py --check' "$rc" FAIL 'checker rejected the figure output'
+	fi
+	if command -v inkscape >/dev/null 2>&1; then
+		local legend=$out/stack-legend.log
+		run_log "$legend" python3 tools/figures/test_stack_legend.py -v
+		rc=$(rc_of "$legend")
+		if [ "$rc" -eq 0 ]; then
+			record 'python3 tools/figures/test_stack_legend.py' "$rc" PASS 'rendered legend'
+		else
+			record 'python3 tools/figures/test_stack_legend.py' "$rc" FAIL 'legend test failed'
+		fi
+	else
+		record 'python3 tools/figures/test_stack_legend.py' '-' NOT_RUN 'inkscape is not installed'
+	fi
+	finish
+}
+
+identity() {
+	{
+		echo "source_sha $(git rev-parse HEAD)"
+		if [ -n "${HOST_GATES_HEAD_SHA:-}" ]; then
+			echo "head_sha ${HOST_GATES_HEAD_SHA}"
+		fi
+		echo "uname $(uname -s -m -r)"
+		if [ -r /etc/os-release ]; then
+			# shellcheck disable=SC1091
+			. /etc/os-release
+			echo "os ${PRETTY_NAME:-unknown}"
+		fi
+		echo "gcc $(gcc --version | head -n 1)"
+		echo "make $(make --version | head -n 1)"
+		echo "python3 $(python3 --version 2>&1)"
+		echo "jobs 4"
+		echo "utc $(date -u +%Y-%m-%dT%H:%M:%SZ)"
+	} | tee "$out/identity.txt"
+}
+
+gates() {
+	local log rc make_rc
+	: >"$summary"
+	identity
+	note 'make test	exit=-	ENFORCED_ELSEWHERE	CI job host-tests in .github/workflows/ci.yml'
+	note 'make test-runtime-api	exit=-	ENFORCED_ELSEWHERE	.github/workflows/runtime-api.yml (#189)'
+	note 'x86-64 make test	exit=-	ENFORCED_ELSEWHERE	job x86-host-tests in .github/workflows/host-x86.yml'
+	note 'make hello-gpu	exit=-	NOT_RUN	no GB10 and no /dev/aien-gpu on this runner'
+
+	log=$out/make-j4.log
+	run_log "$log" make -j4
+	make_rc=$(rc_of "$log")
+	rc=$make_rc
+	if archives_ok "$rc" build; then
+		sha256sum build/libomega_gpu.a build/libcudapp.a | tee "$out/archives.sha256"
+		record 'make -j4' "$rc" PASS "$(sed -n '1,2p' "$out/archives.sha256" | tr '\n' ' ')"
+	else
+		record 'make -j4' "$rc" FAIL 'library archives were not produced'
+	fi
+
+	if [ -f build/libomega_gpu.a ]; then
+		log=$out/native-artifact.log
+		run_log "$log" make -j4 test-native-artifact
+		rc=$(rc_of "$log")
+		if artifact_ok "$rc" "$log"; then
+			record 'make test-native-artifact' "$rc" PASS "$(grep -E '^test_gpu_artifact_export: ' "$log" | tail -n 1)"
+		else
+			record 'make test-native-artifact' "$rc" FAIL 'exit code or summary line rejected'
+		fi
+
+		log=$out/zero-cuda.log
+		run_log "$log" make -j4 zero-cuda-gate
+		rc=$(rc_of "$log")
+		if zero_cuda_ok "$rc" "$log"; then
+			record 'make zero-cuda-gate' "$rc" PASS 'self-test FAIL lines kept; binaries PASS'
+		else
+			record 'make zero-cuda-gate' "$rc" FAIL 'exit code or ZERO_CUDA lines rejected'
+		fi
+	else
+		record 'make test-native-artifact' '-' NOT_RUN 'blocked: make -j4 did not produce the library'
+		record 'make zero-cuda-gate' '-' NOT_RUN 'blocked: make -j4 did not produce the library'
+	fi
+
+	if record_hello_or_fail "$make_rc" build/hello_gpu; then
+		log=$out/hello-sim.log
+		run_log "$log" build/hello_gpu --sim
+		rc=$(rc_of "$log")
+		local log2=$out/hello-sim-2.log
+		run_log "$log2" build/hello_gpu --sim
+		local rc2
+		rc2=$(rc_of "$log2")
+		local h1 h2
+		h1=$(grep -E '^(output|machine code) sha256 ' "$log" || true)
+		h2=$(grep -E '^(output|machine code) sha256 ' "$log2" || true)
+		if sim_ok "$rc" "$log" && sim_ok "$rc2" "$log2" && [ -n "$h1" ] && [ "$h1" = "$h2" ]; then
+			record 'build/hello_gpu --sim' "$rc" PASS 'two runs, same output and machine-code hashes'
+		else
+			record 'build/hello_gpu --sim' "$rc" FAIL "repeat exit $rc2; hashes differ or checks missed"
+		fi
+
+		log=$out/hello-past-end.log
+		run_log "$log" build/hello_gpu --sim --bug=past-end
+		rc=$(rc_of "$log")
+		if past_end_ok "$rc" "$log"; then
+			record 'build/hello_gpu --sim --bug=past-end' "$rc" PASS 'negative control: FAULT, exit 1, no PASS'
+		else
+			record 'build/hello_gpu --sim --bug=past-end' "$rc" FAIL 'negative control did not fail closed'
+		fi
+
+		log=$out/hello-bug-refused.log
+		run_log "$log" build/hello_gpu --bug=past-end
+		rc=$(rc_of "$log")
+		if gpu_bug_refused_ok "$rc" "$log"; then
+			record 'build/hello_gpu --bug=past-end' "$rc" PASS 'refused off the simulator'
+		else
+			record 'build/hello_gpu --bug=past-end' "$rc" FAIL 'GPU bug path was not refused'
+		fi
+	fi
+
+	log=$out/doctor.log
+	run_log "$log" make -j4 doctor
+	rc=$(rc_of "$log")
+	if doctor_ok "$rc" "$log"; then
+		record 'make doctor' "$rc" PASS 'NOT READY on this runner; chip qualification NOT_RUN'
+	else
+		record 'make doctor' "$rc" FAIL 'expected the no-GPU refusal, not READY'
+	fi
+	finish
+}
+
+case "${1:-}" in
+--self-test) self_test ;;
+--figures) figures_mode ;;
+'') gates ;;
+*)
+	echo "usage: $0 [--self-test|--figures]" >&2
+	exit 2
+	;;
+esac