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 / LEFTOVERS.md

118 lines · 8448 bytes Raw Blame History Rendered
1<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
2# Freestanding leftovers: inventory slice 5
3
4## Ownership and source
5
6Base: CUDApp `b774723f537cec16a359fe082b8100317a5b5490`.
7Read all open/closed PRs returned by the required overlap listing; inspected the
8file sets of #291 and #314 explicitly. Neither owns these target headers or
9`omega_ampere_qmd.c`. #291 changes artifact admission implementations and #314
10changes Ampere corpus/export tools, not the helpers in this slice. No stacking
11on those PRs is needed. `om/units.sh`, `src/cudapp_native.h` and
12`src/cudapp_om_units.ident` are the shared integration seams.
13
14`om/components/leftovers.om` owns path alphabet/component/capacity policy,
15ordinal normalization, atomic-acquisition result mapping, poison-state query,
16context disposition and bounded graph-release extent. Its final `leftovers`
17entry point selects scalar operations; earlier functions are unit-private.
18The pinned freestanding frontend exports only the last function. There are no
19OM2 arrays, globals, host words, arena allocation or runtime imports.
20The first commit registers this unit separately from consumer migration.
21
22`CUDAPP_MIGRATION_PENDING_LEFTOVERS=1` selects the old C policy solely as an
23oracle; it is OFF by default. Tests explicitly include the old path header
24under renamed functions, then the real default header, so their differential
25calls both implementations, not two Omega wrappers.
26
27## What remains C and why
28
29| Target | Source audit / irreducible residue |
30| --- | --- |
31| `src/cudapp_freest_f16.c` | Already generated, not handwritten: `PURE_UNITS` maps it to `om/numeric/f16.om`; `cudapp_om_f16.ident` records its source, converter and compiler hashes. Regeneration checks custody. |
32| `src/cudapp_freest_epoch.c` | Already generated from array-free `om/pipeline/epoch.om`; identity is `cudapp_om_epoch.ident`. No duplicate port. |
33| `src/cudapp_freest_revision.c` | Already generated from array-free `om/pipeline/revision.om`; identity is `cudapp_om_revision.ident`. No duplicate port. |
34| `src/omega_ampere_qmd.c/.h` | Descriptor admission and encoding already execute `om/encoder/amp_runtime.om`. C constructs the native input view, copies generated result cells to caller-owned u32 storage and adapts ABI status/null pointers. The header has declarations only. |
35| `src/omega_types.h` | Types, enum values and constants only; no executable computation to port. |
36| `src/omega_native_artifact_snapshot.h` | Types, constants and function declarations only; no executable computation to port. |
37| `src/omega_gpu_attention_mirror.h` | Function declaration and contract only; no executable computation to port. |
38| `src/omega_gpu_fp8_internal.h` | Function declarations and contract only; no executable computation to port. |
39| `src/omega_path_check.h` | Public ABI adapter only. The default path asks `omega2_pathlen` for the index of the first 0 inside the destination capacity, then `omega2_pathcopy` classifies, checks components and stores that exact view. Neither call walks a pointer in C. `omega2_pathlen` stops at the first 0 and never reads past the bound, so a NUL-terminated source is not read past its allocation. Empty output, empty input and a missing 0 inside `cap` are refused here; a nonempty NULL source is refused by the binding. The old classifying pointer walk remains only under `CUDAPP_MIGRATION_PENDING_LEFTOVERS`. |
40| `src/omega_numeric_lifecycle.h` | Retains C11 atomic loads/stores/CAS with their original sequential consistency. Omega maps acquisition outcome and queries the poison state. The compare-exchange itself must stay atomic, not split into Omega read/compute/write. |
41| `src/omega_gpu_q36_native.h` | Retains native object/pointer projection and host lease effects. Existing context/graph/residency policy already calls Omega. Added scalar policy handles status, context disposition and bounded release extent. Prepared-lease iteration invokes host releases, not a plain-data kernel. |
42
43`om/components/pathcopy.om` is the freestanding borrowed-byte path copy. It is not a
44`PURE_UNITS` scalar: the pinned scalar frontend has no views. `om/native-freest.sh`
45regenerates `src/cudapp_freest_pathcopy.c` from omega-bridge draft #72
46(`tools/native --freestanding`, both AArch64 and x86-64 halves). The committed C is
47the artifact. `omega2_pathlen` stops at the first 0 inside the caller-supplied bound and refuses
48a nonempty NULL view. `omega2_pathcopy` then receives exactly the bytes through that 0, copies an
49accepted path and writes the trailing 0. Neither call inspects past its bound. Classification,
50component checks and stores are Omega. The public header no longer walks the pointer.
51
52Five source mutants (alphabet, punctuation, slash-state, invalid-byte, dot-dot) are
53regenerated and must die with assertion exit 1. The scalar leftover mutants no longer
54include dot-dot or capacity: those sites moved into `pathcopy.om`, and the scalar
55unit's mode-1 path is not what the differential calls for them.
56
57Atomic execution and host lease calls remain deliberately not modeled as ordinary Omega memory.
58
59## Replay and acceptance
60
61Every command below must run through:
62
63```
64bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 COMMAND
65```
66
67Set `OMEGA_OMC` to omega-mv `e5b32567`'s `seed/out/omc`, `OMEGA_MV` to its
68checkout and `OMEGA_BRIDGE` to omega-bridge `bc11b30b1faa9af8b875ae6fec24e5f49cf03ac4`.
69No pin is changed here.
70
71- `sh om/units.sh --check`
72- `make -j3 test-leftovers test-leftovers-mutants test-leftovers-coverage`
73- `make -j3 test-native-artifact test-native-artifact-manifest test-omega-binding-portable`
74- `make -j3 gpu-engine-freestanding test-gpu-engine-freestanding test-codegen-freestanding`
75- Additional consumers: `make -j3 test-zero-cuda-tool-argv test-ampere-numeric-host test-ampere-f16-host`
76
77`test-leftovers` compares old C and Omega paths, checks null/result refusal,
78exercises ordinal, numeric latch and context/release policy and requires the
79red executable (deliberately unequal differential result) to fail.
80`test-leftovers-mutants` edits the `.om` source, regenerates each scalar unit
81with the pinned bridge, and requires assertion exit 1 for every mutant. Compiler
82failure or a signal is not a killed mutant. The scalar sites cover alphabet,
83punctuation, ordinal, acquisition, poison, context and extent. Dot-dot and capacity
84moved to `tests/pathcopy_mutants.py`.
85
86## Partitions and coverage
87
88Paths cover empty/null output and input, cap zero, exact capacity and adjacent
89capacities, all byte values, ASCII range endpoints, ordinary and repeated
90slashes, terminal slash, dot/dot-dot/longer-dot components and embedded refused
91bytes. Signed ordinals cover INT_MIN, -1, 0, 1, INT_MAX. Atomic states cover idle,
92busy, poison and a non-enumerated state, including late release after poison.
93Context and release counts cover 0, 1, 31, 32, 33, u32 max and adjacent values,
94signed boundary and u64 max. A null ABI result is refused. Step capacity tests
95include u32/u64 max. The changed policy has no floating arithmetic.
96
97`test-leftovers-coverage` compiles the actual C oracle with `--coverage -O0`.
98Uncovered test assertion-failure branches are intentional: the separate red
99check and mutants exercise checker failure. The generated scalar ABI cannot
100refuse correctly aligned, valid scalar calls: the two unexecuted production
101path error branches are defensive transport failures, not uncovered C oracle
102policy. Header functions not emitted by this focused test perform host lease
103projection; the existing native-runtime gate is the integration acceptance
104path for those effects, not a claim of branch coverage in this oracle.
105
106## Chip runbook — NOT_RUN
107
108No device, live RM or VFIO execution is authorized. After an operator grants a
109current exclusive window, the integrator must rerun the repository's native
110runtime/artifact and platform admission checks at the integrated revision,
111then use its existing documented GPU launch/admission procedure for a minimal
112kernel. Retain the original comparison and refusal receipts and close the
113window through the operator runbook. Do not infer authorization from a free
114lock, a host PASS, a historical receipt or this document. No performance or
115hardware qualification claim is made by this scalar migration.
116
117No omega-harness guide semantics, compiler/bridge pin, repository ownership or
118qualification procedure changed; no guide update is required.