Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/evidence/api-kgen/README.md # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / evidence / api-kgen / README.md` 150 lines · 8915 bytes Raw Blame History Rendered 1 # API kernel IR migration 2 3 ## Scope and pins 4 5 The elementwise API's complete generator and scheduler are seeded Omega in 6 `om/kgen/ew_{emit,scalar,reconv,prime,ir}.om`; the tuned and general attention 7 generators and scheduler are in `om/kgen/attention_{emit,tuned,general,ir}.om`. 8 C dispatches to the existing single `omega_gpu_om_ir_replay` entry. No IR opcode 9 or replay entry was added. The replay ABI already solves register allocation; 10 neither API solves it twice. Both old C generators are retained only under 11 `CUDAPP_MIGRATION_PENDING_C_API_KGEN=1` (default **0**) as independent oracles. 12 This macro is not enabled in production builds. 13 14 Base: `feat/api-views-attn-om` at ``c1fec738fb3dfe4fd48bf9115a19ca9d4d3d6367``. 15 The base lacked replay and scan registration. `git merge-tree` reported shared 16 registration conflicts; Main explicitly authorized their union and regeneration. 17 Prerequisites merged: #309 ``63d18a2cc92cb05f800d17e46b35f0cd6237b3b0`` 18 (merge ``7113117``), then #294 ``220fe47dfdecb715e0d49be223808c211b889169`` 19 (merge ``bac386c``). No #327 merge was needed. 20 Elementwise registration-before-cutover commit: ``73b11c5``. 21 Attention registration-before-cutover commits: ``f965e67a``, ``a61802d5``, 22 ``20b33b52`` and aggregate identity completion ``aff2669c``; cutover ``913f5bec``. 23 24 Compiler: `omega-mv/seed/out/omc`, SHA-256 25 ``2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f``. 26 Converter: bridge #73 ``79e8c36``, `/tmp/integ/bridge-73-`79e8c36``; 27 `om/units.sh` verifies its converter hashes. Bootstrap executable for freest 28 bindings: `omega-bridge/build/bootstrap/omc`, SHA-256 29 ``191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9``. 30 The bridge-generated C is checked output from seeded Omega, not handwritten C 31 computation. The existing host compiler and libc remain host-build dependencies; 32 this migration changes neither the host ABI nor the foreign-runtime boundary. 33 34 ## Elementwise acceptance partition 35 36 `tests/api_kgen_ew_diff_test.c` exhausts each `OmegaGpuEwOp` plus adjacent invalid 37 enum values, each supported mutant 0..3 and both launch/test-path modes. It compares 38 instruction structs byte-for-byte, the entire solved allocator, encoded text and 39 complete cubin bytes with the retained C generator. Observed: **127 accepted, 40 73 refused**, all dispositions identical. This includes scalar, shared, divergent 41 sieve, loop, reconvergence, depth-16 and refused depth-17 variants. 42 43 EW kernel IR has no shape argument: runtime n, dimensions, epsilon and sieve 44 limits are launch constant-memory data. Thus the complete generator-spec 45 comparison applies to every admitted runtime shape, not just selected ones. 46 The same test additionally cross-checks the unchanged seeded shape-plan path 47 against its C oracle over the source-derived boundary partition from 48 `om/components/api_ew_plan.om`: zero, minimum even dimension 2, divisibility by 49 128, row clamp 1024, dimension caps 2048/16384, element clamp 131072 and mutant 50 0..3 admission, with v-1/v/v+1 representatives where representable. All modes 51 0..6 and range lower/upper comparisons are included, including the signed-input 52 boundary at `9223372036854775807` and UINT64_MAX. Observed: **4189 admitted, 53 4001 refused** with identical admission and output words. 54 55 WolframLanguageEvaluator: 56 `{`9223372036854775807`-1,`9223372036854775807`,`9223372036854775807`+1}` 57 -> `{`9223372036854775806`,`9223372036854775807`,`9223372036854775808`}`. 58 59 The red control flips the first IR immediate and must exit 1 with `FAIL IR`. 60 Five separately regenerated seeded semantic mutants were killed: descriptor 61 offset, B-pointer offset, CTA special register, tightened pair latency and EX2 62 dispatch. Compilation/generation failures do not count as killed mutants. 63 64 Elementwise commands exercised (all with private `/dev` and cores 10–14): 65 66 ```sh 67 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-api-kgen-ew 68 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 env OMEGA_OMC="$HOME/work/cudastack/omega-mv/seed/out/omc" OMEGA_BRIDGE=/tmp/integ/bridge-73-`79e8c36` OMEGA_SEED="$HOME/work/cudastack/omega-bridge/build/bootstrap/omc" make -j3 test-api-kgen-ew-mutants 69 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-gpu-elementwise test-gpu-reconv 70 ``` 71 72 Production-default host results: elementwise **24 checks, 0 failed**; 73 reconvergence **119 checks, 0 failed**. These include the existing software-model 74 and disassembly controls, not chip execution. 75 76 `elementwise-differential.log` records the final boundary/differential/red and 77 seeded-mutant gate. `simulator-targets.log` records all three named `mk/` 78 simulator targets listed below, with exit 0. Logs replace the user's home 79 directory with `~` where present; no outputs or verdicts are otherwise changed. 80 81 ## Integrated attention and final acceptance 82 83 `integrated-differential.log` records the final, serial combined commands: 84 85 ```sh 86 make -j3 test-api-kgen-ew 87 make -j3 test-api-kgen-ew-mutants 88 make -j3 test-api-kgen-attention 89 make -j3 test-api-kgen-attention-mutants 90 ``` 91 92 The entire sequence ran inside the same mandatory bwrap/CPU/nice wrapper with 93 the pinned compiler/converter environment above, and exited **0**. 94 Attention compared **39,423 cases** and **39,392 complete cubins**: every raw 95 record, loop interval, register width, solved allocator, encoded instruction 96 byte and successfully allocated final cubin matched. The partition exhausts 97 general dimensions 1..256 and tuned block/GQA shifts, plus all existing mutant, 98 divergence and split selectors and adjacent invalid boundaries. See the exact 99 partition, coverage receipt and per-case packing contract in 100 `../api-kernel-gen-attn/2026-11-06/README.md` and its `cubin-followup/README.md`. 101 Both the altered-IR and altered-final-cubin controls were detected with exit 1. 102 Five attention semantic mutants were killed, in addition to the five EW mutants. 103 Generation, compilation failures and crashes are not counted as semantic kills. 104 105 Additional integration-owned receipts, all exit **0**: 106 107 | Receipt | Exercised targets / result | 108 |---|---| 109 | `default-api-targets.log` | Default-Omega `test-gpu-elementwise`, `test-gpu-reconv`, `test-gpu-attention` including every target-specified host and simulator mode | 110 | `decode-prefill-targets.log` | `test-gpu-decode-attn` (including maxpos controls), `test-gpu-decode-attn256`, `test-gpu-prefill-host`; seven of seven maxpos controls killed | 111 | `simulator-targets.log` | All three explicitly named simulator targets enumerated below | 112 | `units-crumb.log` | Full `om/units.sh --check` byte-for-byte regeneration; `crumb compile .` and `crumb verify .`, 46 current crumbs | 113 114 All named acceptance paths are host/model **EXERCISED**. Hardware qualification 115 is **NOT_RUN**; this draft is neither **MERGED** nor **DEPLOYED**. The harness 116 skill/compiler/encoding/bridge/gate contracts are intentionally unchanged: 117 this adds consumers of the existing replay ABI and existing converter, not a 118 language, compiler, protocol, ownership or trust-path change. 119 120 ## Existing target inventory 121 122 `Makefile` defines `test-gpu-elementwise`, `test-gpu-attention`, 123 `test-gpu-decode-attn`, `test-gpu-decode-attn-maxpos`, `test-gpu-reconv` and 124 `test-gpu-prefill-host`. The latter runs the prefill-attention binary in both 125 host and simulator modes; there is no separately named 126 `test-gpu-prefill-attn*` target on this base. `mk/carried-tests.mk` defines 127 `test-gpu-decode-attn256` (host and sim). The explicitly named simulator targets 128 in `mk/` are `test-hello-sim` (`dx-sim.mk`), `test-gpu-gemm-ex-sim` 129 (`gemm-ex.mk`) and `test-gpu-engine-sim` (`omega-gpu-engine.mk`). 130 Attention's own target includes normal, sweep, HD128, divergent and general sim 131 modes. No full `make test` is part of this gate. 132 133 ## Chip runbook — NOT_RUN 134 135 No GPU window was authorized. Host byte equivalence and software simulation do 136 not establish hardware qualification. No GPU device, live service, GPU lock or 137 serving process is touched by these host gates. 138 139 In a separately authorized exclusive chip window, the operator must first follow 140 the current Spark window and device-safety procedure, pin the final commit and 141 compiler/converter identities, and build the normal default-Omega library. 142 Run `build/gpu_elementwise_test` and `build/gpu_attention_test` using their 143 existing chip modes and the current gate procedure; include supported HD64, 144 HD128 and general attention shapes and scalar/shared/reconvergent EW kernels. 145 Run the existing decode and prefill attention chip gates from the same build. 146 Capture exact commands, program outputs, device identity and kernel-driver 147 fault evidence, compare output bytes against the existing references, and run 148 the named negative controls. Do not run a refusal/mutant that the current chip 149 procedure does not authorize. Record hardware results separately from the host 150 receipts. This document grants no device or service authority.