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 / tests / device-trace / README-safety.md

102 lines · 5168 bytes Raw Blame History Rendered
1# Emitter safety regressions
2
3These are host tests for the low-level emitter, not hardware qualification.
4They do not establish that a complete kernel can be instrumented safely.
5
6## Supported input
7
8Enabled input is a prepared, straight-line body fragment. The caller must
9initialise and preserve `R0 = TID.X`, launch exactly one CTA, and account for
10the markers' `P0`, `R2`, `R4:R13`, and `UR4:UR5` clobbers. Both insertion points
11must be reached by fallthrough. Branches, calls, returns, and early exits are
12unsupported. The wrapper rejects the repository's `EXIT` encoding, regardless
13of predicate, with error 5 before writing output. That scan is not a general
14control-flow verifier. In particular, do not pass the complete `gbvec` kernel.
15
16All nonzero enable values require `gtchecks == 1`. That is an explicit caller
17precondition, not proof of launch geometry, memory visibility, scheduling, or
18GPU safety. Disabled input remains byte-identical after the existing capacity
19and 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
38On Linux AArch64, using an independently verified seeded compiler:
39
40```sh
41test "$(uname -m)" = aarch64 || exit 69
42: "${OMEGA_COMPILER:?set the verified seeded compiler path}"
43sha256sum "$OMEGA_COMPILER"
44mkdir -p build/emitter-safety-native
45for 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
58done
59```
60
61All four units must exit zero. The original emitter test prints its individual
62checks. The three new tests are silent on success and return a named assertion
63status in their source on failure. `run-emitter-checks.sh` now compiles and runs
64all four units before its external decode check. A failed compile, nonempty
65compiler stderr or failing unit stops the runner before any later stage.
66These units are still not integrated into `make test`.
67
68The runner's shell control flow can be checked without a compiler or GPU:
69
70```sh
71sh tests/device-trace/run-runner-controls.sh
72```
73
74That check uses synthetic compiler programs and decode rows. It checks unit
75composition and failure propagation only; it is not native Omega execution,
76an instruction decoder or evidence that the emitter's instruction words work.
77
78## Disassembler check (replaces the historical golden)
79
80The historical `expected.sass` described the original PR84 head
81`60d6c57fc6821accce0027d65dd239355beeb543`, including the erroneous
82multiply-based address formation, and was itself an NVIDIA-tool listing.
83PR #93 removed it. `run-emitter-checks.sh` (`make test-device-trace-emitter`)
84now decodes the words with Omega's own sm_121 disassembler (`build/sm121dis`;
85nvdisasm only as an oracle when `NVDISASM` is set), keeps the listing in its
86temporary directory and checks it against hand-written expectations: the
87opcode 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
90on main before this repair fails
91that 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
93a record of what ran on PR84's head.
94
95## Remaining limits
96
97Native AArch64 execution and the full native suite, GB10 execution, QMD/launch
98wiring, paired off/on overhead, clock qualification, and chip repeatability
99remain unverified by these host models. Runtime overflow/drop accounting,
100capacity zero/one capture, and begin/end ranges are not implemented by this
101fixed two-mark slice. No default-on mode, driver changes, or hardware authority
102are introduced.