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
| 1 | <!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --> |
| 2 | # Freestanding leftovers: inventory slice 5 |
| 3 | |
| 4 | ## Ownership and source |
| 5 | |
| 6 | Base: CUDApp `b774723f537cec16a359fe082b8100317a5b5490`. |
| 7 | Read all open/closed PRs returned by the required overlap listing; inspected the |
| 8 | file sets of #291 and #314 explicitly. Neither owns these target headers or |
| 9 | `omega_ampere_qmd.c`. #291 changes artifact admission implementations and #314 |
| 10 | changes Ampere corpus/export tools, not the helpers in this slice. No stacking |
| 11 | on 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, |
| 15 | ordinal normalization, atomic-acquisition result mapping, poison-state query, |
| 16 | context disposition and bounded graph-release extent. Its final `leftovers` |
| 17 | entry point selects scalar operations; earlier functions are unit-private. |
| 18 | The pinned freestanding frontend exports only the last function. There are no |
| 19 | OM2 arrays, globals, host words, arena allocation or runtime imports. |
| 20 | The first commit registers this unit separately from consumer migration. |
| 21 | |
| 22 | `CUDAPP_MIGRATION_PENDING_LEFTOVERS=1` selects the old C policy solely as an |
| 23 | oracle; it is OFF by default. Tests explicitly include the old path header |
| 24 | under renamed functions, then the real default header, so their differential |
| 25 | calls 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` |
| 45 | regenerates `src/cudapp_freest_pathcopy.c` from omega-bridge draft #72 |
| 46 | (`tools/native --freestanding`, both AArch64 and x86-64 halves). The committed C is |
| 47 | the artifact. `omega2_pathlen` stops at the first 0 inside the caller-supplied bound and refuses |
| 48 | a nonempty NULL view. `omega2_pathcopy` then receives exactly the bytes through that 0, copies an |
| 49 | accepted path and writes the trailing 0. Neither call inspects past its bound. Classification, |
| 50 | component checks and stores are Omega. The public header no longer walks the pointer. |
| 51 | |
| 52 | Five source mutants (alphabet, punctuation, slash-state, invalid-byte, dot-dot) are |
| 53 | regenerated and must die with assertion exit 1. The scalar leftover mutants no longer |
| 54 | include dot-dot or capacity: those sites moved into `pathcopy.om`, and the scalar |
| 55 | unit's mode-1 path is not what the differential calls for them. |
| 56 | |
| 57 | Atomic execution and host lease calls remain deliberately not modeled as ordinary Omega memory. |
| 58 | |
| 59 | ## Replay and acceptance |
| 60 | |
| 61 | Every command below must run through: |
| 62 | |
| 63 | ``` |
| 64 | bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 COMMAND |
| 65 | ``` |
| 66 | |
| 67 | Set `OMEGA_OMC` to omega-mv `e5b32567`'s `seed/out/omc`, `OMEGA_MV` to its |
| 68 | checkout and `OMEGA_BRIDGE` to omega-bridge `bc11b30b1faa9af8b875ae6fec24e5f49cf03ac4`. |
| 69 | No 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, |
| 78 | exercises ordinal, numeric latch and context/release policy and requires the |
| 79 | red executable (deliberately unequal differential result) to fail. |
| 80 | `test-leftovers-mutants` edits the `.om` source, regenerates each scalar unit |
| 81 | with the pinned bridge, and requires assertion exit 1 for every mutant. Compiler |
| 82 | failure or a signal is not a killed mutant. The scalar sites cover alphabet, |
| 83 | punctuation, ordinal, acquisition, poison, context and extent. Dot-dot and capacity |
| 84 | moved to `tests/pathcopy_mutants.py`. |
| 85 | |
| 86 | ## Partitions and coverage |
| 87 | |
| 88 | Paths cover empty/null output and input, cap zero, exact capacity and adjacent |
| 89 | capacities, all byte values, ASCII range endpoints, ordinary and repeated |
| 90 | slashes, terminal slash, dot/dot-dot/longer-dot components and embedded refused |
| 91 | bytes. Signed ordinals cover INT_MIN, -1, 0, 1, INT_MAX. Atomic states cover idle, |
| 92 | busy, poison and a non-enumerated state, including late release after poison. |
| 93 | Context and release counts cover 0, 1, 31, 32, 33, u32 max and adjacent values, |
| 94 | signed boundary and u64 max. A null ABI result is refused. Step capacity tests |
| 95 | include u32/u64 max. The changed policy has no floating arithmetic. |
| 96 | |
| 97 | `test-leftovers-coverage` compiles the actual C oracle with `--coverage -O0`. |
| 98 | Uncovered test assertion-failure branches are intentional: the separate red |
| 99 | check and mutants exercise checker failure. The generated scalar ABI cannot |
| 100 | refuse correctly aligned, valid scalar calls: the two unexecuted production |
| 101 | path error branches are defensive transport failures, not uncovered C oracle |
| 102 | policy. Header functions not emitted by this focused test perform host lease |
| 103 | projection; the existing native-runtime gate is the integration acceptance |
| 104 | path for those effects, not a claim of branch coverage in this oracle. |
| 105 | |
| 106 | ## Chip runbook — NOT_RUN |
| 107 | |
| 108 | No device, live RM or VFIO execution is authorized. After an operator grants a |
| 109 | current exclusive window, the integrator must rerun the repository's native |
| 110 | runtime/artifact and platform admission checks at the integrated revision, |
| 111 | then use its existing documented GPU launch/admission procedure for a minimal |
| 112 | kernel. Retain the original comparison and refusal receipts and close the |
| 113 | window through the operator runbook. Do not infer authorization from a free |
| 114 | lock, a host PASS, a historical receipt or this document. No performance or |
| 115 | hardware qualification claim is made by this scalar migration. |
| 116 | |
| 117 | No omega-harness guide semantics, compiler/bridge pin, repository ownership or |
| 118 | qualification procedure changed; no guide update is required. |