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
CUDApp / examples / hello_gpu / README.md
| 1 | <!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --> |
| 2 | # hello_gpu: seeded host planning and checking |
| 3 | |
| 4 | The default executable uses `om/graph/hello.om` for input construction and |
| 5 | whole-output checking, and `hello-plan.om` for scoreboard controls, chunk sizes, |
| 6 | launch dimensions, byte counts, bandwidth reporting and simulator fault planning. |
| 7 | `CUDAPP_MIGRATION_PENDING_HELLO_HOST=1` selects the C differential oracle only. |
| 8 | It is OFF by default. The existing HELLO_CONTROL switch enables the intentional |
| 9 | short-launch negative control; it does not select the C host oracle. |
| 10 | |
| 11 | C retains the IR instruction emission, register-allocation API calls, command-line |
| 12 | and diagnostic I/O, clock acquisition, allocations, simulator invocation, device |
| 13 | session and launches. No GPU launcher was moved into Omega. A result is checked |
| 14 | on the host, but the checker is first-party seeded Omega, not handwritten C. |
| 15 | Input values are finite binary32; the differential compares their bits exactly. |
| 16 | The poison sentinel is counted separately from wrong answers. |
| 17 | |
| 18 | ## Host acceptance |
| 19 | |
| 20 | Every execution, including simulator, differential and mutant children, must run |
| 21 | inside the device-hiding wrapper: |
| 22 | |
| 23 | ```sh |
| 24 | bwrap --dev-bind / / --dev /dev --proc /proc -- \ |
| 25 | taskset -c 10-14 nice -n 10 make -j3 \ |
| 26 | test-graph-residue test-graph-residue-mutants test-graph-residue-coverage \ |
| 27 | test-hello-sim |
| 28 | ``` |
| 29 | |
| 30 | Set `OMEGA_OMC` and `OMEGA_BRIDGE` to the pins required by `om/units.sh` when |
| 31 | running the mutant gate. The coverage gate compiles its C oracles with |
| 32 | `-O0 --coverage -ffp-contract=off`. It also runs the actual oracle executable's |
| 33 | simulator path, plus past-end and short negative controls. Those controls must |
| 34 | exit 1, not merely any nonzero status. `test-graph-residue` compares deterministic |
| 35 | phase digests and diagnostics against the oracle and requires a deliberately |
| 36 | changed result to disagree. The mutant gate compiles each changed `.om` unit; |
| 37 | compile refusal is not counted as a killed mutant. |
| 38 | |
| 39 | ## D8: the process-tax line |
| 40 | |
| 41 | `hello_gpu` prints one overhead line (developer bar D8, |
| 42 | `docs/issues/D8-process-tax.md`). On the GPU path it reads its resident memory |
| 43 | (`VmRSS` in `/proc/self/status`) before the open, after the open and with its |
| 44 | buffers allocated, its own buffer bytes, and what the session asked the driver |
| 45 | for: |
| 46 | |
| 47 | ```text |
| 48 | overhead (D8): resident B KiB before open, O KiB after open, W KiB with buffers; own buffers N KiB; session driver allocations S KiB in K; open cost ±X KiB, beyond own buffers ±Y KiB |
| 49 | ``` |
| 50 | |
| 51 | `--sim` prints the same line without the open: |
| 52 | `overhead (D8, simulator, no device opened): …`. The KiB rounding and the signed |
| 53 | differences come from `hello-plan.om` mode 5. `test-graph-residue` checks mode 5 |
| 54 | against the C oracle, and three mutants (`tests/d8_mutants.om`, run by |
| 55 | `make test-graph-residue-mutants`) check its rounding and sign. |
| 56 | `--hold-ms=N` (1 to 60000) holds the buffers after the line and prints the pid, |
| 57 | so another process can read this one. The control build also accepts |
| 58 | `--d8-ballast-mib=N`. It holds N MiB of touched host memory through the |
| 59 | measurement, which is the negative control. |
| 60 | |
| 61 | `tests/d8_process_tax.om` (with its shared part `tests/d8_lib.om`, compiled by the |
| 62 | pinned seeded omc) holds the bar that was fixed before any chip run, and the |
| 63 | controls: |
| 64 | |
| 65 | - `make d8-process-tax-dry-run` (`dry-run`) runs on the host only, in bwrap |
| 66 | with the GPU devices hidden. It runs the simulator, a device-hidden GPU path |
| 67 | that must stop at NOT_RUN, the `--hold-ms` bound and the default build's |
| 68 | refusal of `--d8-ballast-mib`, and judge self-tests on synthetic logs. This dry |
| 69 | run is not chip evidence. |
| 70 | - `make d8-process-tax` (`gpu`) takes one `spark-window` lease (gb10 exclusive, |
| 71 | 20 minutes). Inside the lease it measures `hello_gpu --hold-ms=3000` and both |
| 72 | controls (`--bug=short`, and `--d8-ballast-mib=512`), then releases the lease. |
| 73 | It reads `VmRSS` and the driver's per-process report from outside the process. |
| 74 | `build/d8_process_tax check-gpu OUTDIR` judges a recorded run again. |
| 75 | |
| 76 | The program runs these host tools, each at its absolute path or found on `PATH`: |
| 77 | `/usr/bin/bwrap` (hides the GPU devices for the dry run), `/usr/bin/env`, |
| 78 | `/usr/bin/nice`, `/usr/bin/taskset` (CPU pin, `D8_CORES`, default `16,17`), |
| 79 | `spark-window`, `sha256sum`, `git`, and `nvidia-smi`. The 1080 s lease wall clock |
| 80 | is kept by the program itself. `nvidia-smi` is an |
| 81 | ORACLE: the driver's own per-process report, read from outside the process (B4). |
| 82 | It is never shipped and never linked. |
| 83 | |
| 84 | ## Chip runbook — NOT_RUN |
| 85 | |
| 86 | This migration has no current hardware qualification. Historical hello receipts |
| 87 | do not qualify these source bytes. No GPU window was authorized for this lane. |
| 88 | |
| 89 | 1. Obtain a current exclusive hardware window and follow the current Spark |
| 90 | authorization procedure. Record the exact commit, generated identities, |
| 91 | compiler and bridge digests, GPU identity, module version and window receipt. |
| 92 | A free lock file alone is not authorization. Do not stop a service or change |
| 93 | driver binding merely to run this example. |
| 94 | 2. First complete the wrapped host gates above. Build `build/hello_gpu` and |
| 95 | `build/hello_gpu_control` without executing a chip target. Record their hashes. |
| 96 | 3. Inside the authorized hardware procedure only, run `make doctor`, then |
| 97 | `make hello-gpu`. This step deliberately cannot use the host device-hiding |
| 98 | bwrap: it needs the admitted GPU. Require exit 0, every element checked, |
| 99 | zero wrong and unwritten elements, and a final `PASS`. |
| 100 | 4. Run `make hello-gpu-control`. Its short final launch must produce exactly one |
| 101 | missing result, executable exit 1, and the enclosing control target must pass. |
| 102 | **Never run the past-end control on hardware.** It is simulator-only. |
| 103 | 5. Compare the output hash with the same revision's wrapped simulator output. |
| 104 | Keep stdout, stderr, exit codes and device admission evidence. A mismatch, |
| 105 | timeout or missing negative-control observation is not PASS. Do not infer |
| 106 | model-graph chip qualification from the vector-add receipt. |
| 107 | |
| 108 | The host simulator cannot establish chip timing, fault recovery or device safety. |