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 / backend / hw / README.md

98 lines · 6335 bytes Raw Blame History Rendered
1# Hardware capability manifest and device lifecycle (DRA-400, DRA-401)
2
3`manifest.tsv` registers every processor family Omega is asked to reach. `hwman` (seeded Omega:
4`core.om`, `cpu.om`, `tpm.om`, `main.om`, concatenated in that order and compiled by the pinned omc)
5checks the register, answers admission queries and runs the admitted targets through one typed lifecycle.
6GPU execution stays in `backend/targets.om` and the CUDApp runtime; the GPU row here only records its
7status and why `hwman` will not run it.
8
9Build: `cat backend/hw/core.om backend/hw/cpu.om backend/hw/tpm.om backend/hw/main.om | omc > hwman`.
10Gate: `make test-hw OMC=/abs/omc` (`tests/hw/run.sh`).
11
12## Manifest
13
14Line 1 is `hwman<TAB>1`; line 2 is the header below. Every row has exactly 25 tab-separated, non-empty
15fields (`-` means none).
16
17| Field | Meaning |
18| --- | --- |
19| `id` | lowercase `[a-z0-9-]`, unique |
20| `family` | CPU GPU APU PPU SPU NPU TPU LPU MCU ISP TPM SECURE_ENCLAVE ASIC FPGA DPU WSE NEUROMORPHIC PHOTONIC QPU TSU BPU; all 21 must appear |
21| `vendor`, `part`, `revision` | exact device, or `unresolved` |
22| `route` | NATIVE_ISA, DIRECT_DEVICE, VENDOR_RUNTIME, REMOTE_SERVICE, FIRMWARE_OWNED, UNRESOLVED |
23| `platform`, `identity`, `node` | where it lives, the identity discovery must read back (`midr_el1=0x…`, `manufacturer=0x…`, `uuid=…`), and the device node |
24| `isa_cmds`, `discovery`, `ops` | instruction set or command format, how it is found, comma-separated operations |
25| `addr_spaces`, `dma_coherence`, `queue_irq`, `reset_power`, `firmware` | the device's memory, ordering, submission, reset and firmware ownership |
26| `compiler_artifact`, `refs` | what produces its code; primary sources |
27| `runner`, `timeout_ms` | the executor (`hwman-cpu`, `hwman-tpm`, or an outside authority such as `spark-window`) and the wall-clock budget |
28| `status` | CHIP_TESTED, PRIOR_RECEIPT, EMULATED, HOST_TESTED, PROPOSED, BLOCKED_ACCESS, BLOCKED_NAME |
29| `admit` | YES or NO |
30| `evidence`, `blocker` | receipt path (or `NOT_RUN`) and the exact reason a row is not admitted |
31
32`hwman check` refuses (exit 3) a row that admits without CHIP_TESTED evidence, a `hwman-*` runner and
33operations; a BLOCKED row without a blocker or with `admit=YES`; UNRESOLVED routes that are not
34BLOCKED_NAME (and the reverse); PROPOSED rows that admit; tested statuses whose evidence is `NOT_RUN`;
35non-decimal timeouts; duplicate ids; unknown enums; and a register missing any family.
36
37Every `hwman-` runner is bound by one closed table in `core.om` (`TRUN`), used by `check` and therefore
38by `admit` and `run`, which load the register through `check`:
39
40| Runner | Family | Route | Operations |
41|---|---|---|---|
42| `hwman-cpu` | CPU | NATIVE_ISA | `sumsq64`, `fnv1a64` |
43| `hwman-tpm` | TPM | DIRECT_DEVICE | `props`, `getrandom` |
44
45A `hwman-` runner outside the table is `manifest unknown_runner`, a runner on another family or route is
46`manifest runner_family_route`, and an operation outside the runner's list is `manifest runner_op`; all
47exit 3. `run` also refuses (exit 5) an operation its runner does not execute before discovery or claim.
48
49## Lifecycle
50
51`hwman run MAN TARGET OP ARG GEN STATE [EXPECT]` performs, and prints a `STEP` line for each of:
52
531. **discover**: the runner reads the device identity (CPU: the pinned processor's `midr_el1` from sysfs;
54 TPM: `TPM2_GetCapability(TPM_PROPERTIES, PT_FIXED)` on `/dev/tpmrm0`) and compares it with `identity`;
552. **claim**: `STATE` is opened and locked with `flock(LOCK_EX|LOCK_NB)`; it holds `"<generation> <target>\n"`
56 (an empty new file is generation 0). The caller's `GEN` must equal the stored generation;
573. **prepare**: `ARG` is validated for the operation;
584. **submit** and **complete** (both CPU and TPM print `STEP complete`): before submission byte 0 of
59 `STATE` is set to `x` and synced, so a crash or failed release from here on leaves the handle
60 unreadable. `timeout_ms` is overrun detection, not cancellation: the CPU compares elapsed time after the
61 operation returns; the TPM bounds its wait for the response and refuses, but a sent command is not
62 cancelled in the chip;
635. **quiesce**: CPU re-reads the processor it ran on; TPM closes the descriptor;
646. **release**: after any submission the generation advances by one: bytes 1.. of the new record are
65 written and synced, then byte 0, then synced again. The record never shrinks (the generation only
66 grows), and nothing is truncated. A failed or short write or a failed sync refuses with 74
67 (`state_write_failed`) and never prints PASS; the handle stays unreadable (exit 7 for every
68 generation), or after only the final sync failed holds the advanced record. It never returns to an
69 earlier generation. Recovery of an unreadable handle is an operator decision: inspect the device, then
70 create a new `STATE` file. A refusal before submission releases without advancing.
71
72`hwman admit MAN OP [TARGET]` is the read-only consumer query (proposed to the Omega Node scheduler,
73DRA-407): exit 0 and an `ADMIT` line naming the target, or a refusal with the classes below.
74`hwman fault MAN TARGET KIND GEN STATE` sends a fixed malformed TPM frame and passes only on the one
75exact expected result: `badsize` (commandSize 13, 12 bytes written) on kernel errno -22 (`layer=kernel
76errno=-22`); `badcc` (commandCode 0x11e) on rc 0x000b0143 (`layer=tpmrm rc=0x000b0143`), which is
77TPM2_RC_COMMAND_CODE 0x143 with TSS2_RESMGR_TPM_RC_LAYER (11 << 16): the Linux resource manager
78(`drivers/char/tpm/tpm-dev-common.c`, `tpm2_prepare_space`) answers an unlisted command code itself, so
79the frame never reaches the chip. Any other result is a device error (exit 13,
80`unexpected_fault_result kind= result= want=`).
81
82| Exit | Class |
83| --- | --- |
84| 0 | PASS |
85| 2 | usage |
86| 3 | manifest refused |
87| 4 | unknown target |
88| 5 | unsupported operation or fault kind |
89| 6 | not admitted (`admit=NO`, outside lease) |
90| 7 | stale generation, wrong or unreadable handle |
91| 8 | wrong device (identity, unpinned or moved processor) |
92| 9 | busy (handle locked) |
93| 10 | offline (node absent or unreadable) |
94| 11 | timeout |
95| 12 | oracle mismatch (`EXPECT`) |
96| 13 | device error |
97| 14 | invalid argument or generation |
98| 74 | I/O error, including `state_write_failed` (handle persistence failed after submission) |