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 / evidence / api-kgen / README.md

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