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

branch main Branches Tags History

CUDApp / docs / device-trace / REPRODUCE.md

143 lines · 6829 bytes Raw Blame History Rendered
1# Reproduce the bounded host reference
2
3This is preparation for CUDApp #82, not its completion. All stamps in these
4fixtures are synthetic. No command below opens a GPU. Do not run a chip test
5without the maintainer's separate GPU admission.
6
7## Pins
8
9- CUDApp base: `a520cd30e54c3b0ddd553ee3ccb3f5e673345cd6`.
10- Compiler source: `omega-mv@55f9b0af47de70a3d06357985cf99ae3e45c016f`,
11 path `seed/omc/omc.om`, SHA256
12 `2e35db7d6c2066fb4a20d19b8a9579c44caca9c9937b0594a89422010b673637`.
13- Expected seeded compiler: `seed/out/omc`, SHA256
14 `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`.
15- External oracle: `omega-mv@190130b71d0a59b93f01c515218a5509b149a145`,
16 path `tools/omega_ref/omega_ref.c`, SHA256
17 `52e747096c1d978103432460a2978b21a604cc5d3e961bbe4b253fcc7636290e`.
18
19These are explicit historical source pins. They do not silently track later
20OM-2 releases or change any compiler/Bridge ABI. The oracle is a pre-existing
21C test referee, outside the delivered native implementation. It is not a
22new production dependency, a native executor or a device qualification path.
23
24## Compose the three units
25
26From the CUDApp checkout, with an empty disposable `out` directory:
27
28```sh
29cat native/blackwell/trace.om tests/device-trace/contract-test.om > out/contract.om
30cat native/blackwell/trace.om tests/device-trace/golden-test.om > out/golden.om
31cat native/blackwell/vector.om tests/device-trace/disabled-test.om > out/disabled.om
32```
33
34The contract test prints `DEVICE_TRACE_CONTRACT_PASS` and exits 0 on success.
35The golden unit emits exactly 192 bytes, equal to the hex in `golden.hex`.
36The disabled unit emits the existing 512-byte vector kernel, SHA256
37`39f3dfdfc529a75a8274a27900acf4e7382b7f280a211e0412c51609f44b62a1`.
38This checks the existing emitter only. No enabled GPU trace emitter exists.
39
40## Externally interpreted compiler and semantic oracle (x86_64 host)
41
42Obtain both pinned source files in a separate oracle workspace. Verify the
43hashes above before compiling. This command matches the existing referee's
44build flags, without the machine-specific `quiet-build` wrapper:
45
46```sh
47cc -O2 -g -std=gnu11 -Wall -Wextra -Werror -o omega_ref omega_ref.c -lpthread
48./omega_ref check omc.om
49./omega_ref run omc.om < omc.om > omc-from-ref.elf 2> self.err
50```
51
52Require exit 0 and empty stderr for both calls. The measured self-output
53SHA256 was the exact expected seeded compiler digest `734f0a39...6b61` above.
54That byte identity does not turn the referee into a trusted native runtime.
55
56For each composed unit:
57
58```sh
59./omega_ref check out/contract.om
60./omega_ref run out/contract.om > out/contract.stdout 2> out/contract.stderr
61./omega_ref run omc.om < out/contract.om > out/contract.elf 2> out/contract.compile.stderr
62```
63
64Record each exit separately. Repeat for `golden` and `disabled`. Semantic
65execution uses the external interpreter; compilation executes the pinned
66Omega compiler source through that interpreter. The emitted executables are
67AArch64, not run by these commands. A nonzero compile must never be followed
68by execution of its partial output.
69
70Compare `golden.stdout` byte-for-byte with the decoded `golden.hex`, and check
71`disabled.stdout` against the full digest above. Do not count file creation or
72a matching byte count alone as a pass.
73
74## Mutants (private copies only)
75
76For each one-line replacement below, compose the mutated module with
77`contract-test.om`. Require oracle `check` exit 0, oracle `run` exit 1 with
78`DEVICE_TRACE_CONTRACT_FAIL` on stderr, and interpreted compiler exit 0.
79Never mutate the committed implementation for a test run.
80
81| Original | Replacement |
82| --- | --- |
83| `if or or gt cap 64 ge cta` | `if or or gt cap 65 ge cta` |
84| `if ge n get gtstate 3` | `if gt n get gtstate 3` |
85| `mul get gtstate 5 32` | `mul get gtstate 5 31` |
86| `if ne gen get gtstate 0` | `if eq gen get gtstate 0` |
87| `gtput32 60 1` | `gtput32 60 0` |
88| `gtput32 add off 8 uint n` | `gtput32 add off 8 uint add n 1` |
89| `for j ulong 16` | `for j ulong 0` |
90| `for i ulong sub bytes off` | `for i ulong 0` |
91| First `put gtstate 6 0` in `gtinit` | `put gtstate 6 1` |
92| `if and ne gtget32 20 0 ne n cap` | `if and ne gtget32 20 0 gt n cap` |
93| `if and eq gtget32 60 1 ne gtget32 20 4294967295` | `if and eq gtget32 60 2 ne gtget32 20 4294967295` |
94| `if ne gtget64 add off 16 gtget64 32` | `if ne gtget64 add off 16 gtget64 add off 16` |
95
96Without the module, `contract-test.om` is refused by both the oracle checker
97and externally interpreted compiler with error 3 at the first `gtinit` call.
98This absence check was run after implementation, not a pre-implementation
99native red/green run. Native TDD execution remains unestablished.
100
101## Native execution, still NOT_RUN
102
103On an authorized Linux AArch64 host, verify the exact compiler digest first.
104Compile each composed unit with that compiler, then execute only successful
105outputs. Repeat the exact-byte and mutant comparisons above. Record unit and
106ELF hashes, status, stdout and stderr. This is a host test, still not GB10.
107The full CUDApp `make test` suite must also run in a complete checkout.
108
109The local connector-materialized partial snapshot could not run `make test`:
110make exited 2 because `tests/gpu_matmul_api_test.c` was absent. No target or
111threshold was skipped or weakened. The native seed/compiler gates, native
112ELF execution, full repository suite and all GPU gates are NOT_RUN.
113
114## Independent arithmetic check
115
116The golden was independently encoded with Wolfram Language using
117`Reverse[IntegerDigits[value,256,width]]` for each field in contract order.
118An independent `struct.pack` check matched those 192 bytes. The resulting
119byte SHA256 is `88a3de3f88a0d59852704a97d2c9f859f87b57ee9efd0f2509aa95ace1adcab6`.
120Wolfram also checked the finite store-extent property:
121
122```text
123And@@Flatten[Table[64+64*n+63 < 64+64*c,{c,1,64},{n,0,c-1}]] -> True
124```
125
126This is MODELED arithmetic, not a measured device memory-safety result.
127
128## Current compiler compatibility, separate receipt
129
130A later check used `omega-mv@7505b3a3e3cf5ee46933e3a89a021b4289037983`,
131without changing the historical pins or receipt above. Its
132`seed/omc/omc.om` SHA256 is
133`c792b401193d8477d38965d6ddb0fd0cb8fd5ac24fcb92fae9af52037a765f1c`.
134Executed through the same unchanged external oracle, its self-output matches
135`499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec`,
136the pinned commit's `seed/out/omc.sha256`.
137
138All three unmodified units and all twelve semantic mutants compile with
139exit 0 and empty compiler stderr under this newer compiler source. The three
140positive ELF files are byte-identical to the earlier compiler's outputs.
141This is compatibility of these units only, not a full compiler qualification
142or execution of those AArch64 files. See the additive
143`evidence/device-trace/current-compiler-7505b3a/receipt.json` receipt.