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 / tests / device-trace / README-safety.md
| 1 | # Emitter safety regressions |
| 2 | |
| 3 | These are host tests for the low-level emitter, not hardware qualification. |
| 4 | They do not establish that a complete kernel can be instrumented safely. |
| 5 | |
| 6 | ## Supported input |
| 7 | |
| 8 | Enabled input is a prepared, straight-line body fragment. The caller must |
| 9 | initialise and preserve `R0 = TID.X`, launch exactly one CTA, and account for |
| 10 | the markers' `P0`, `R2`, `R4:R13`, and `UR4:UR5` clobbers. Both insertion points |
| 11 | must be reached by fallthrough. Branches, calls, returns, and early exits are |
| 12 | unsupported. The wrapper rejects the repository's `EXIT` encoding, regardless |
| 13 | of predicate, with error 5 before writing output. That scan is not a general |
| 14 | control-flow verifier. In particular, do not pass the complete `gbvec` kernel. |
| 15 | |
| 16 | All nonzero enable values require `gtchecks == 1`. That is an explicit caller |
| 17 | precondition, not proof of launch geometry, memory visibility, scheduling, or |
| 18 | GPU safety. Disabled input remains byte-identical after the existing capacity |
| 19 | and instruction-alignment checks. Disabled capacity zero is still refused. |
| 20 | |
| 21 | ## Independent semantic tests |
| 22 | |
| 23 | - `address-test.om` decodes the address pair and models each store's effective |
| 24 | address inside a guarded capture extent. It checks ordinary and low-half-carry |
| 25 | cases, untouched header/reserved bytes/canaries, signed 24-bit store offsets, |
| 26 | the branch predicate and complete relative displacement, the GLOBALTIMERLO |
| 27 | source and R2 destination, and each record field's store-source register. |
| 28 | Its in-test timer and register mutations must be refused after each field is |
| 29 | changed, and the original bytes are restored. It does not use |
| 30 | the nvdisasm decode or the emitter's address helpers as its oracle. This limited |
| 31 | arithmetic model does not validate GPU instruction scheduling or scoreboards. |
| 32 | - `guard-test.om` exercises enable/check values 0, 1, 2 and maximum unsigned |
| 33 | 64-bit value. Refusal must preserve every output byte and its prior length. |
| 34 | - `body-test.om` uses the actual `gbvec` kernel as a negative control, checks |
| 35 | disabled byte identity, and refuses every predicate variant of `EXIT` for |
| 36 | enable values 1, 2 and maximum unsigned 64-bit value. |
| 37 | |
| 38 | On Linux AArch64, using an independently verified seeded compiler: |
| 39 | |
| 40 | ```sh |
| 41 | test "$(uname -m)" = aarch64 || exit 69 |
| 42 | : "${OMEGA_COMPILER:?set the verified seeded compiler path}" |
| 43 | sha256sum "$OMEGA_COMPILER" |
| 44 | mkdir -p build/emitter-safety-native |
| 45 | for name in emitter address guard body; do |
| 46 | unit=build/emitter-safety-native/$name |
| 47 | if [ "$name" = body ]; then |
| 48 | cat native/blackwell/vector.om native/blackwell/trace-emit.om \ |
| 49 | tests/device-trace/body-test.om > "$unit.om" |
| 50 | else |
| 51 | cat native/blackwell/trace-emit.om \ |
| 52 | "tests/device-trace/$name-test.om" > "$unit.om" |
| 53 | fi |
| 54 | "$OMEGA_COMPILER" < "$unit.om" > "$unit.elf" 2> "$unit.compile.stderr" || exit |
| 55 | test ! -s "$unit.compile.stderr" || exit 1 |
| 56 | chmod +x "$unit.elf" |
| 57 | "$unit.elf" || exit |
| 58 | done |
| 59 | ``` |
| 60 | |
| 61 | All four units must exit zero. The original emitter test prints its individual |
| 62 | checks. The three new tests are silent on success and return a named assertion |
| 63 | status in their source on failure. `run-emitter-checks.sh` now compiles and runs |
| 64 | all four units before its external decode check. A failed compile, nonempty |
| 65 | compiler stderr or failing unit stops the runner before any later stage. |
| 66 | These units are still not integrated into `make test`. |
| 67 | |
| 68 | The runner's shell control flow can be checked without a compiler or GPU: |
| 69 | |
| 70 | ```sh |
| 71 | sh tests/device-trace/run-runner-controls.sh |
| 72 | ``` |
| 73 | |
| 74 | That check uses synthetic compiler programs and decode rows. It checks unit |
| 75 | composition and failure propagation only; it is not native Omega execution, |
| 76 | an instruction decoder or evidence that the emitter's instruction words work. |
| 77 | |
| 78 | ## Disassembler check (replaces the historical golden) |
| 79 | |
| 80 | The historical `expected.sass` described the original PR84 head |
| 81 | `60d6c57fc6821accce0027d65dd239355beeb543`, including the erroneous |
| 82 | multiply-based address formation, and was itself an NVIDIA-tool listing. |
| 83 | PR #93 removed it. `run-emitter-checks.sh` (`make test-device-trace-emitter`) |
| 84 | now decodes the words with Omega's own sm_121 disassembler (`build/sm121dis`; |
| 85 | nvdisasm only as an oracle when `NVDISASM` is set), keeps the listing in its |
| 86 | temporary directory and checks it against hand-written expectations: the |
| 87 | opcode counts of the two 20-instruction marker blocks, the two timer reads |
| 88 | (`S2R R2, SR_GLOBALTIMERLO` at 0x30 and 0x170) and the address-formation lines |
| 89 | (`MOV R6, 0x40` / `0x80`, then `IMAD.WIDE.U32 R8, R6, 0x1, R4`). The emitter |
| 90 | on main before this repair fails |
| 91 | that check (`IMAD.SHL R8, R4, 0x40, RZ` at offset 0x70). The historical receipt |
| 92 | `evidence/device-trace/emitter-host-20261026/receipt.json` stays unchanged as |
| 93 | a record of what ran on PR84's head. |
| 94 | |
| 95 | ## Remaining limits |
| 96 | |
| 97 | Native AArch64 execution and the full native suite, GB10 execution, QMD/launch |
| 98 | wiring, paired off/on overhead, clock qualification, and chip repeatability |
| 99 | remain unverified by these host models. Runtime overflow/drop accounting, |
| 100 | capacity zero/one capture, and begin/end ranges are not implemented by this |
| 101 | fixed two-mark slice. No default-on mode, driver changes, or hardware authority |
| 102 | are introduced. |