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 / speculation / TEARDOWN-HOST.md

108 lines · 5866 bytes Raw Blame History Rendered
1# Teardown refusal and retry fixture
2
3Refs CUDApp #65 and #67. This is a bounded cleanup repair and a synthetic host
4fixture. It does not qualify model inference, GPU execution, or deployment.
5
6## Source contract
7
8`nvstate` records the teardown phase:
9
10| Value | Meaning | Permitted cleanup |
11| --- | --- | --- |
12| 0 | Closed | Return success without another effect |
13| 1 | Driver resources live, including partial construction | Existing RM/UVM teardown and one close attempt per descriptor |
14| 2 | Descriptors closed; CPU mappings remain | Retry owned BAR, channel, and buffer unmaps only |
15
16The compiler's `mapdrop` returns a nonzero syscall result without retiring its
17owned mapping slot. The runtime must therefore retain the mapping handle until
18unmap succeeds. After descriptor closure, driver-owned memory flags can retire,
19but a failed CPU mapping retains its handle, address and length. A failed
20cleanup latches `nvfault`; successful cleanup does not make the context reusable.
21Descriptor numbers are retired after their first close attempt, including an
22error, so a subsequent call cannot close a newly reused descriptor number.
23
24The same ownership rule applies before `nvcpumap` publishes a mapping to its
25caller. If descriptor close fails and its immediate unmap is refused,
26`nvunpub` retains that mapping for `nvmapfinish`. A faulted or inactive
27context refuses another `nvcpumap`, so the retained handle cannot be overwritten.
28Failed `mapbind` is different: the pinned compiler contract retires that handle.
29
30## Fixture and isolation
31
32The handwritten `tests/speculation/teardown-host-test.om` runs the actual
33`nvstop`/`nvmapfinish`/`nvmforce` control flow in a private source-derived unit.
34The disclosed shell composer replaces only these OS effects:
35
36- Device operations become a bounded fake that refuses any call after the
37 descriptor phase has ended.
38- Device opens become an immediate test assertion failure.
39- Unmap and close become stateful fakes that count calls, reject double release,
40 and can refuse an otherwise valid synthetic mapping.
41- The unpublished-mapping case allows one synthetic descriptor open and replaces
42 `mapnew` with a fake that returns a fourth owned mapping; no real mapping or
43 device open is performed.
44
45The composer refuses an unbound device/open/close/unmap verb. It never changes
46the tracked runtime file. The fixture does not open `/dev/nvidia*`, allocate GPU
47memory, or submit work. It follows the existing development practice of building
48private native translation units and compiling behavioral negative controls;
49the shell is test orchestration, not a new product runtime.
50
51Cases cover normal and repeated shutdown, a BAR unmap refusal, a channel-map
52refusal, a buffer unmap refusal, a driver teardown refusal followed by mapping
53refusal, successful retry, and a descriptor close error. Each refused mapping
54must survive two shutdown attempts, then release when refusal is removed.
55Retries must make no extra descriptor closes or driver calls. The context fault
56must remain set, and `nvstart` must still refuse reuse. A direct `nvmforce` call
57while driver resources are live must refuse without changing ownership flags,
58handles, addresses or lengths and without making an OS effect.
59The additional close-error/unmap-refusal case checks that the unpublished
60mapping survives two shutdown attempts, is released on a later successful
61retry, and is never double-unmapped. It also checks refusal of another mapping
62attempt while that context is faulted.
63
64## Reproduction
65
66Use Linux AArch64 and the compiler from the existing native-device receipt:
67
68- Omega source: `d7390d88d07dbf48cfbb0583070599c350f814d3`.
69- Compiler SHA-256:
70 `9749f38841a55917d41924a68bce31463ec2339910bddd5e6cbf6ea4420551db`.
71
72```sh
73sh tests/speculation/run-teardown-host.sh /absolute/path/to/pinned-omc
74```
75
76The script retains a private temporary directory with exact source units, ELF
77files, compiler logs, stdout/stderr, exit statuses, and hashes. It compiles the
78original `f9cd649c1dca92ad81009bcd05a959f34c25c76e` context with the same fixture
79first: it must fail by a test assertion (exit 1), not compilation error, trap or
80timeout. The repaired source must then compile and exit 0 with the PASS marker.
81An unsupported host returns 77 and `NOT_RUN`; it is not a test pass.
82
83## Current qualification limit
84
85The source-compatibility review uses the exact pinned `seed/omc/omc.om`, not
86a different compiler profile. Its `topname` and `s_fn` readers limit globals,
87texts and parameter names to eight bytes; function names may be 63 bytes.
88The initial source review missed overlong names in both this repair and the
89inherited fixture. They are now shortened without changing cleanup behavior.
90The fixture's custom calls use scalar arguments only; the compiler's prohibition
91on passing globals to ordinary `view`/`edit` parameters does not apply to them.
92The `tmapnew` fake preserves the native word's five scalar types and long result.
93This is source inspection, not evidence that either unit compiles or executes.
94
95Native compilation and execution are **NOT_RUN** in the merge-review workspace,
96which is x86_64 and has no runnable AArch64 compiler or emulator. The fixture and
97repair remain candidates for source review and supported-host qualification.
98Existing hardware receipts describe older source and must not be reused to
99approve this change. Real kernel/model behavior and production activation remain
100outside this host fixture.
101
102## Supported-host qualification
103
104On 2026-10-24 a candidate based on `main` (22e9d9b plus this repair, code commit
1052e24216) was compiled with the pinned compiler rebuilt from seed and run on
106Linux AArch64: the original cleanup failed by assertion and the repair passed.
107Mutants, the GPU vector rerun and the remaining fixture gap are recorded in
108`evidence/speculation/release-candidate-teardown/`.