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 / mathlibs-host-20261106 / README.md

221 lines · 15085 bytes Raw Blame History Source

Mathlibs host policy and planner migration

Date: 2026-11-06. Branch: feat/mathlibs-host-om.

Scope and provenance

Base: feat/mathlibs-gaps (#317), 3d28358d48814779106588b19c94f62fc363d960. git merge-base --is-ancestor origin/feat/mathlibs-rfft-2d-philox HEAD returned 0: this base already contains #303's RFFT, 2D and Philox additions. Stack order is #303, then #317, then this draft; do not merge this directly onto a main revision that omits either prerequisite.

664f21c3 registers the seeded unit first. 27919d0a adds its typed ABI entries, generated bindings and differential gate before the C cutover. The cutover and this receipt follow those commits. sources.sha256 records the exercised implementation and test source identities.

No public API or capability changes: public headers, manifest and API.md are intentionally unchanged. The README describes the default path and focused gate; ROADMAP has one dated note and no status-row upgrades. No language, compiler, bridge pin, host word or harness protocol changes are introduced.

Implementation boundary

om/mathlibs/host.om owns the computation. Its six small entry units are host_scalar.om, host_walk.om, host_step.om, host_many.om, host_index.om and host_fft.om. Separate typed entries follow the pinned bridge's existing single-export/fixed-view ABI; there is no new converter or second pin. om/units.sh registers them and generates six committed C units, private declarations and identity receipts. Every entry is a strong reference.

CUDAPP_MIGRATION_PENDING_C_MATHLIBS_HOST defaults to 0. The old C computation is retained only behind that flag as the differential oracle. The default adapter serializes inputs, calls Omega and performs effects: clock_gettime, session locking, codegen/cache calls, allocation/free, byte loads/stores/copies, callbacks, device launch, scratch transfers and synchronization. It does not fall back to C when an Omega entry is absent or refuses an input. Clock reads remain C effects; seconds/nanoseconds and elapsed-time arithmetic use Omega. No new production dependency or GPU launcher is introduced.

The fixed PlanMany output workspace has 8192 ulong cells. Like the existing g_words effect workspace, it is protected by the session lock; completed launches and table bytes are materialized into owned storage before public callbacks. This avoids both a per-plan workspace allocation and a large per-thread stack frame. No plan record survives by referencing the workspace. The unit initializes all consumed fields and records; stale unused cells are not read. The descriptor bound is 204 records; the source-derived conservative upper bound for admitted rank-three transforms is 96, including table records. At most nine distinct table keys are needed, below the existing 16-key cache. These are modeled bounds, not hardware measurements; queries appear below.

Reproduce the exercised commands

All commands ran in this private worktree. The wrapper hides NVIDIA/VFIO nodes, pins CPUs 10-14 and lowers priority. Builds use at most three jobs. The runner refuses visible NVIDIA/VFIO nodes and executes its compilation, coverage, differential, red, link-negative and mutant children inside the same wrapper. No full make test, chip command or live service action was run. Paths in retained logs replace /home/drakestapleton with ~.

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="$HOME/work/cudastack/omega-bridge" \
  make test-mathlibs-host-om

bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 \
  make -j3 test-gpu-mathlibs

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="$HOME/work/cudastack/omega-bridge" \
  sh om/units.sh --check
Command / tierrcObserved final result
make test-mathlibs-host-om inside wrapper0MATHLIBS-HOST-OM GATE PASS: differential, red, strong-link negative, gcov, 8 killed .om mutants
Differential child, -O0 --coverage -ffp-contract=off0MATHLIBS-HOST-OM PASS cases=2477
Intentional wrong-index red child1, expectedFAIL line 232 case 2477: omega_mh_index(l,e,1,1)==2
Missing-six-units link child1, expectedcollect2: error: ld returned 1 exit status
make -j3 test-gpu-mathlibs inside wrapper0mathlibs sim: PASS (6265 checks)
sh om/units.sh --check inside wrapper0PASS portable Omega units regenerate byte for byte
crumb compile . && crumb verify . before commits0crumb verify: OK: 39 crumbs current

The missing-unit log contains unresolved omega_native_mhval, mhwalk, mhstep, mhmany, mhidx and mhfft references, including references from the production API object. No weak-symbol or C fallback passes the control. acceptance.log retains the complete combined command output; differential.log, red.log, missing-unit.log and mutants.tsv retain the focused results.

The unchanged family gate also reports host RNG fixture 792 rows / zero mismatches, Philox fixture 1024 rows / zero mismatches and the existing Philox distribution negative controls. Its normal-double fixture rows are explicitly not compared because that existing IR has no f64 normal path; this receipt does not turn that inherited limitation into a PASS.

Source-derived partitions

SurfaceExercised values / comparison
Legacy FFTEvery power of two 4..2048, both directions, all legacy modes; invalid dimensions and nonpowers; rank 1..3, summed-log bound rejection; batches 0, 1, 1023, 1024, 1025. Compare rc, byte requirements, every launch field and twiddle bytes.
PlanMany shapes2, 3, 5, 6, 7, 8, 11, 16, 30, 64, 127, 1024, 2047, 2048, 2049, 4095, 4096; rank 1..3 and C2C/R2C/C2R, both directions, in/out of place. Multi-Bluestein axis pairs (13,11), (11,31), (31,11) exercise workspace growth/reuse and distinct table keys.
Layout fieldsFor stride, distance, embed, rank and each dimension axis: 0, 1, 2, 3, 4, 5, 15, 16, 17, 4095, 4096, 4097, UINT32_MAX. Include zero stride, overlapping rows/batches and explicit collision bitmaps. Compare admission codes; successful plans compare all launches, bytes and table bytes.
Global and scratch productsn=4 batch 33554431/33554432/33554433; Bluestein n=11 batch 8388607/8388608/8388609; layout distance 268435451/268435452/268435453. These surround the source's point, scratch and byte-range bounds without allocating those extents in rejected cases.
RNG admission / seedEvery RNG kind and invalid kinds; stream bound 131071/131072/131073, zero and UINT32_MAX; per-stream limits and adjacent values; seeds 0, 1, UINT64_MAX and wrap-boundary values. Compare unsigned seed increment, poison predicates and count arithmetic against C.
Public effectful API admissionDefault and C-oracle RNG, Philox and FFT calls with null/invalid inputs, bad sizes/types and overlapping valid host buffers. These return before GPU effects. Valid device execution remains NOT_RUN.
Failure controlsNull plan/bytes/dimensions, invalid mode/type/rank/inverse/in-place values; callback abort propagation; intentional wrong index; omitted mandatory unit symbols.
Float classesPoison-scan words include positive/negative zero, subnormal, infinity and NaN encodings. These are raw sentinel classification/count tests, not a new floating arithmetic path: different NaN payloads are not asserted numerically equal. Plan/twiddle payloads compare exactly; existing simulator numeric checks remain unchanged. Compilation disables FP contraction.

Coverage limits and branch dispositions

coverage.log is gcov from the separately compiled C-oracle/test translation unit, not a claim of Omega branch coverage or whole-library chip coverage. It reports 68.22% of 1010 lines overall; the API oracle alone reports 60.28% of 798 lines. many_build, all many layout/index helpers, many_axis, many_copy, many_scan, lg_in and rng_args_ok have 100% line execution; walk_locked has 98.53% of 68 lines. Line coverage is not branch coverage. omega_gpu_mathlibs_api.c.gcov retains the annotated oracle source. coverage-disposition.tsv enumerates every uncovered oracle branch and maps it to a disposition below; none is silently counted as covered.

DispositionWhy not exercised
ALLOCAllocation-failure injection is not part of this gate; normal/reallocation paths and callback effects are exercised. Internal collector capacity is bounded by admitted IR steps.
TABLE_INTERNALCache overflow requires more than 16 distinct keys, but admitted rank-three plans need at most nine. Other untaken legs require allocation failure or refusal of a validated internal table request.
FACTOR_INTERNALInvalid factor/radix/divisor responses require corrupted internal IR; validated dimensions supply nonzero divisors and valid factors. Remaining legs propagate allocation/IR failure. The real workspace-size rejection is exercised.
COPY_INTERNALZero extents cannot reach copy construction from admitted nonempty dimensions; reciprocal-generation refusal requires invalid internal divisors.
BASIC_BOUNDThe basic dense-layout embed bound is looser than the preceding global point bound, including the real in-place padding. Thus its overflow refusal is unreachable for admitted default layouts.
PLAN_FAILUREAllocation/internal-IR failure propagation remains unexercised. The loop's rc-failure condition is bypassed by its explicit break. Both real length-versus-half-length outcomes are exercised.
WALK_INTERNALUntaken internal-codegen legs require malformed/refused validated IR or table allocation failure. Callback abort is injected at the first launch; later-stage callback-abort return legs are not separately injected.
EFFECT_NOT_RUNOutside the pure-planner oracle comparison: device/session/launch/scratch/sync and cache/codegen effect management or their failure legs. Production host/sim codegen checks run separately; real device effects remain NOT_RUN.

Omega source mutants

Each mutation is unique in host.om, regenerated through the pinned bridge and compiled successfully. A regeneration or compilation failure is not counted as a kill. Every executable below returned 1 instead of PASS.

MutantGenerate rcCompile rcRun rcResult
RNG stream limit 131072 -> 131073001KILLED: admission mismatch
Seed increment i+1 -> i+2001KILLED: seed mismatch
64-bit poison constant last digit001KILLED: sentinel mismatch
Chunk grid bound 1024 -> 1023001KILLED: launch mismatch
Zero-stride predicate 0 -> 1001KILLED: admission mismatch
Real half-length +1 -> +0001KILLED: plan byte mismatch
Axis rotation chooses wrong first axis001KILLED: plan collection mismatch
Overlap bitmap bit mask 7 -> 6001KILLED: fill/index mismatch

Pins and arithmetic receipts

WolframLanguageEvaluator queries (integer bounds/counts, not measurements):

{FromDigits["ffbadbad",16],FromDigits["00badbad",16],FromDigits["ffbadbadffbadbad",16],2^28,2^27,1024*128,2^32,2^32-1,FromDigits["9e3779b97f4a7c15",16]}
-> {4290436013,12245933,18427282365706066861,268435456,134217728,131072,4294967296,4294967295,11400714819323198485}

{2^28-4,2^28-4+{-1,0,1},Floor[(8192-32)/40],3*(4+3*Ceiling[13/2])+12+9,2^32-1,2^28-1}
-> {268435452,{268435451,268435452,268435453},204,96,4294967295,268435455}

{2^27/4,2^27/4+{-1,0,1},2^28/32,2^28/32+{-1,0,1}}
-> {33554432,{33554431,33554432,33554433},8388608,{8388607,8388608,8388609}}

{3*3,8192*8,Floor[(8192-32)/40],3*(4+3*Ceiling[13/2])+12+3*3}
-> {9,65536,204,96}

The last query gives table-key count, workspace bytes, output capacity and conservative maximum records. The maximum Stockham pass count uses M<=8192; each admitted axis contributes at most four other Bluestein records and three Stockham sequences. Twelve copy/rotation records and nine table records are reserved conservatively.

Chip runbook — NOT_RUN

There is no authorized GPU window for this lane. The mandatory wrapper hides devices and cannot produce hardware qualification. Do not remove that masking, stop a serving process, touch the chip lock or load/unload a driver to run this receipt. No historical authorization is reused.

A future operator must first obtain a current exclusive hardware window and follow the then-current GPU/session authorization procedure, including service ownership and permitted device nodes. Build the same committed revision and retain its source/binding identities in a new evidence directory. With the operator-approved device-visible execution wrapper, the existing executable's chip tier is selected by omitting --sim and --host-only:

./build/gpu_mathlibs_test --out <new-chip-receipt-directory>

This is a runbook command, not a command run by this lane. There is no --chip flag. Preserve the executable's RNG, FFT, Philox, real/ND, poison, repeat and negative-control receipts; unexpected refusal, mismatch or untouched output is FAIL/INCONCLUSIVE, never PASS. Record device/driver identity and restore services only under the operator's current instructions.

That existing chip entry point does not cover the complete PlanMany matrix. Before qualifying PlanMany, an authorized device run must additionally exercise C2C/R2C/C2R, Stockham and multi-Bluestein ranks, explicit layouts, overlap refusals and batch/stride boundaries through the public API against the host reference, including repeat/poison controls. The current host plans and simulator results are not substitutes for that hardware check. All hardware results, including PlanMany, remain NOT_RUN here; the integrator also owns the full combined repository gate, which this focused lane did not run.