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
CUDApp / docs / superpowers / plans / 2026-10-26-shader-pilot-foundation.md
| 1 | # Offline compute pilot implementation plan |
| 2 | |
| 3 | > **For agentic workers:** Use superpowers:executing-plans. Follow the checked steps in order. |
| 4 | |
| 5 | **Goal:** Make a reproducible, non-launching seeded `.om` specimen for CUDApp #86. |
| 6 | |
| 7 | **Architecture:** Reuse the unchanged `gbvec` emitter and #53 CUL1 catalog/evaluator. A small selector and complete-byte matcher admit only the two existing dense unsigned32 add cases. An offline exporter writes either the canonical task or the code, never a runnable GPU submission or an authenticated cache entry. |
| 8 | |
| 9 | **Tech Stack:** Seeded Omega, existing public CUL1, existing Linux development tools. |
| 10 | |
| 11 | **Spec:** https://github.com/aien-dev/CUDApp/issues/86, bounded stage-one increment only. |
| 12 | |
| 13 | ## Global constraints |
| 14 | |
| 15 | - No graphics stage, general shader compiler, new cache/evaluator framework or new kernel. |
| 16 | - No GPU access, native execution on x86_64, merge, deployment or qualification claim. |
| 17 | - Reuse catalog IDs 2 and 3 only; unsupported shapes and operations refuse. |
| 18 | - The existing launch uses 64-thread CTAs; the 17-element task needs its bound exit. Export is not proof that this control flow ran. |
| 19 | - New product and behavioral tests are `.om`; foreign tools remain explicitly external development evidence. |
| 20 | - Preserve existing source, owners and historical receipts. Do not repair unrelated stale crumbs. |
| 21 | |
| 22 | ## Review focus |
| 23 | |
| 24 | - Stale task for a different catalog ID must refuse even when code bytes are identical. |
| 25 | - Truncated, oversized or single-byte-corrupted task/code must refuse. |
| 26 | - Invalid request framing must emit no payload, including after a valid request prefix. |
| 27 | - Catalog drift away from dense unsigned32 add must not silently gain support. |
| 28 | - Matching bytes are not source authentication, independent machine decoding or execution evidence. |
| 29 | |
| 30 | ## Task 1: offline selector and matcher |
| 31 | |
| 32 | Files: `native/shader-pilot/core.om`, `tests/shader-pilot/core-test.om`. |
| 33 | Interfaces: `spload(id:ulong)->ulong` prepares canonical `kt`, `gbcode`, `gblen` and returns task length, or zero. `spmatch(id:ulong,tn:ulong,cn:ulong)->int` compares separate caller-owned `sptask[232]` and `spcode[512]` against freshly prepared bytes. Status 0 matches, 65 bad lengths, 77 unsupported, 1 byte mismatch. Neither function launches anything. |
| 34 | |
| 35 | - [x] Write tests for valid IDs, lengths, refusal preservation, every-byte corruption, stale ID, dirty trusted scratch and independent CUL1 output fixtures. |
| 36 | - [x] Run with an explicit temporary stub and observe failing assertions; separately show missing implementation cannot compile. |
| 37 | - [x] Implement the smallest selector/matcher using existing functions, then rerun unchanged tests. |
| 38 | - [x] Compile original `.om` with the pinned compiler source and challenge with compiled mutations. |
| 39 | |
| 40 | ## Task 2: bounded exporter and repeatable evidence |
| 41 | |
| 42 | Files: `native/shader-pilot/export.om`, `docs/shader-pilot/README.md`, `tests/shader-pilot/stream-check.om`, new evidence folder. |
| 43 | Interfaces: exporter stdin exactly two bytes `[catalog_id, selector]`, selector 1 emits existing CUL1, selector 2 emits unchanged native bytes. Invalid length 65, unsupported ID/mode 77, I/O failure 74. No payload on validation refusal; I/O failure may leave a partial stream and the nonzero status invalidates it. |
| 44 | |
| 45 | - [x] Define stream checker and input/refusal matrix; prove stub exporter fails expected byte/status checks. |
| 46 | - [x] Implement read/validate/export with bounded partial-I/O loops, then replay matrix. |
| 47 | - [x] Record deterministic exports, source/compiler/ELF/artifact hashes, corruption and stale controls. |
| 48 | - [x] Document native-host compile/run commands and separate first-observed/repeated compilation, actual cache absence, and NOT_RUN load/pipeline/GPU stages. |
| 49 | - [x] Run full `make test`, focused checks, independent review and fresh ownership check. |
| 50 | - [x] Paused before public draft PR for parent review; publication is not claimed. |
| 51 | |
| 52 | ## Execution record |
| 53 | |
| 54 | - Design choice: reuse two existing catalog tasks rather than inventing a second arithmetic specification. |
| 55 | - Environment: Linux x86_64. AArch64 compiler output may be compiled and hashed but must not be executed here. |
| 56 | - Baseline crumbs report two stale existing directories. They are outside this slice. |
| 57 | |
| 58 | - Source/test commit: `5d95e4b00a95770a6f73f299ec33827d78b49802`. Receipt and independent review: `evidence/shader-pilot/host-foundation-20261026/`. |
| 59 | - Ruling: external referee evidence is permitted development evidence, never native execution. Compiler outputs are checked and hashed without execution. |
| 60 | - Ruling: GNU time was absent; measured reference-process samples use Bash time and explicitly omit RSS. No cold-cache/native-performance claim. |
| 61 | - Ruling: crumb compile scans the whole repository even with a subdirectory argument. Its unrelated trace-crumb rewrites were restored to HEAD; only new crumbs are included. The existing global verify failure remains disclosed. |