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 / om / resident / README.md

107 lines · 6218 bytes Raw Blame History Rendered
1# Resident small-model kernel
2
3IMPLEMENTED in seeded Omega at compiler source `omega-mv@e5b32567`.
4Chip: EXERCISED on the GB10 on 2026-11-12, on a shared chip (values only), receipt
5`evidence/chip-gates-shared-20261112/`: `gpu_resident_chip --chip` passes both witnesses in both
6modes after the `S2R` scheduling fix described there. It is not QUALIFIED: the exclusive window of
7the runbook below is still NOT_RUN. The ROADMAP row is PARTIAL.
8This branch stacks on the generic replay in CodegenA commit `22ebf8f`.
9No replay implementation is forked or changed here.
10
11`resident.om` emits one descriptor interpreter through the canonical eight-u64 IR
12records and `omega_gpu_om_ir_replay`. `check.om` exports the Omega admission entry.
13`src/omega_gpu_resident.c` widens descriptor words and calls those entries. It has
14no operation selection, scheduling, layer arithmetic or barrier decisions.
15The internal builder is not an addition to the public runtime API.
16
17## Contract
18
19A descriptor is eight little-endian u32 words:
20`op, input_a_offset, input_b_offset, output_offset, rows, cols, 0, 0`.
21Offsets count f32 elements in one arena. Operations are GEMV (1, row-major),
22ADD (2), MUL (3), SUM (4, one output row), COPY (5). Elementwise operations and
23COPY require cols=1. Dimensions are bounded by 32; the table has at most 64
24entries and the arena at most 65536 elements. Outputs cannot overlap their own
25inputs. Later descriptors may consume earlier outputs. Admission rejects invalid
26opcodes, bounds, reserved words, dimensions, overlap and unsupported launch grids.
27The table and pointers must not change after admission until completion.
28
29The launch has one or two CTAs, each with 32 threads. Thread zero of each CTA
30works; other threads exit. CTA c owns rows c, c+ctas, ... . The device loops over
31the descriptor table; no host return occurs between layers. The included model
32has GEMV -> ADD -> MUL -> SUM -> COPY, with dependencies at every boundary.
33
34The grid barrier uses an arrival counter and monotonically increasing generation
35word, initially both zero. Every CTA fences its data stores, then atomically adds
36one to the counter. The last arrival atomically resets the counter, fences, and
37atomically exchanges the new generation. Others poll with STRONG.SYS loads.
38There is a fence on exit. Arena traffic uses STRONG.SYS loads/stores too.
39The initial count/generation must be reset for every model invocation.
40All CTAs must fit simultaneously; this bounded grid is not a general oversubscribed
41cooperative launch. Hardware occupancy and memory-order behavior still require
42the chip tier. Never run a dropped-barrier control on the chip.
43
44The fixed vreg plan uses pairs 0..7 and scalars 8..30. Initialization and terminal
45self-reads hold all values across every generated loop and branch arm, without
46assuming that the straight-line register allocator understands a CFG.
47
48## Host acceptance
49
50Run with the pinned `OMEGA_OMC` and `OMEGA_BRIDGE` from the repository:
51
52```sh
53taskset -c 10-14 nice -n 10 make -j3 test-gpu-resident
54```
55
56The plain C evaluator is independent of the generator. f32 order is fixed:
57GEMV multiplies, rounds, then accumulates left-to-right with a separate FADD;
58SUM accumulates left-to-right. The compiler uses `-ffp-contract=off`.
59The exact-f32 witness includes a cancellation that distinguishes an FMA from
60separate multiply/add. WolframLanguageEvaluator query:
61`{Expand[(1+2^-23)(1-2^-23)-1], N[1+2^-23,25], N[1-2^-23,25]}`
62returned `{-1/70368744177664, 1.00000011920928955078125,
630.99999988079071044921875}`. The rounding check
64`Round[(1+2^-23)(1-2^-23),2^-24]-1` returned `0` through
65WolframLanguageEvaluator: separately rounded f32 multiplication is 1, so adding
66-1 is zero; an FMA retains the nonzero product residual.
67
68`bw_warp_sim_k.h` previously completed each CTA before starting the next. It now
69has a default-off instruction quantum and the existing integer atomic-exchange
70operation. Existing `ws_run` callers keep quantum=0 and retain their scheduling.
71`tests/gpu_resident_grid.h` interleaves one-warp CTAs in both CTA orders and
72several instruction quanta; it executes the emitted polling loops, not a host
73replacement barrier. This SC/coherent memory model cannot qualify GPU caches,
74fences, progress or occupancy. It also has no instruction latency: a
75variable-latency producer read without its wait passes the simulator. `gpu_resident_test`
76therefore runs the static hazard checker (`src/omega_bw_hazard.c`) on the encoded kernels
77(1 and 5 layers, 1 and 2 CTAs) before the simulator, and the mutant
78`fixed-latency-thread-id` must fail there. The dropped-barrier control uses an intentionally
79unfair long quantum so the reduction observes unfinished producer rows.
80Corrupted descriptors must be refused before replay. Source mutations must
81compile successfully, then fail the oracle. Missing tools are NOT_RUN.
82
83## Authorized chip runbook (exclusive window: NOT_RUN)
84
85Only after the operator opens a current exclusive window, runs the platform's
86normal admission/doctor checks, and authorizes this exact candidate:
87
88```sh
89taskset -c 10-14 nice -n 10 make -j3 build/gpu_resident_chip
90SPARK_WINDOW="$AUTHORIZED_WINDOW_ID" build/gpu_resident_chip --chip
91```
92
93The executable refuses missing `--chip` or an empty window label before any
94device call. The label is a guard, not authorization. Capture the command, rc,
95stdout/stderr, source/compiler hashes, machine and window in a new evidence
96directory. A timeout is uncertain completion: preserve the runtime latch and
97parked buffers; do not retry, free through another path, reset the GPU or unload
98modules. Escalate to the operator.
99
100Both paths use PCAS command lists with WFI ordering and the same model, arena,
101CTA geometry and f32 comparison. The resident path records one launch; the
102per-layer baseline records five. Require exact output, the expected generation
103words, matching semaphore counts and observed launch counts on both ordinary and
104cancellation fixtures. Record raw elapsed_ns independently; do not claim a speedup
105from launch count alone. The historical receipt
106`evidence/OWN30B-LAUNCH-COST-20261014T0120Z/` measured 24–31 us per extra launch.
107That is context, not a current resident-kernel measurement.