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 / bw-matmul-realize-om / 2026-11-06 / README.md

224 lines · 14843 bytes Raw Blame History Rendered
1<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
2
3# Blackwell matmul/realization and native-header migration
4
5IMPLEMENTED and host EXERCISED; not chip QUALIFIED, MERGED or DEPLOYED.
6Base b774723, stacked on regalloc #309 at 63d18a2. The first registration commit is
746b6286. The stack merge is b1c4232. No API signature or wire structure changes.
8
9## Ownership and overlap
10
11The #310 PR is not the cmdlist-program port. The actual cmdlist-program PR is
12#304 (581c048); it does not modify the assigned native/codelist/allocation headers.
13EngineSubmit2 owns platform.c and engine/submit/wait/memory/serving implementations.
14Their source is unchanged here. #309 already owns the `omega_cg_bind` encodings,
15validation, dispatch and vector launch geometry. This branch uses that unit rather
16than introducing a second encoding. It adds hashing of the cg_bind wire only.
17
18## Complete executable inventory
19
20| Assigned file/function | Default hosted owner | C remaining |
21|---|---|---|
22| matmul.c `omega_matmul_spec_init` | cg_bind kind 0; bw_identity SHA | null guard, struct stores |
23| matmul.c `omega_fp16_to_fp32` | bw_scalar 1; bounded scalar normalization, no loop | bit memcpy |
24| matmul.c `omega_bf16_to_fp32` | bw_scalar 2 | bit memcpy |
25| matmul.c `omega_fp32_to_fp16` | existing native_f16 | bit memcpy |
26| matmul.c `omega_fp32_to_bf16` | bw_scalar 3 via rne wrapper | bit memcpy |
27| matmul.h inline `omega_fp32_to_bf16_rne` | bw_scalar 3 | bit reinterpretation |
28| matmul.c `omega_blackwell_bind_matmul_realization` | cg_bind kinds 1/2/9; bw_identity SHA | fixed copies and pointer checks |
29| matmul.c `omega_blackwell_codegen_matmul` | cg_bind kind 3 | dispatch to existing generated encoders |
30| matmul.c `omega_blackwell_kernel_free` | host allocation release | pointer check, free, memset |
31| matmul.c `omega_matmul_cpu_oracle_i32/f16/bf16` | bw_cpui/bw_cpuf16/bw_cpubf16 runtime views; bw_scalar16/17 extent arithmetic | null guards and ABI calls; C loops only freestanding/default-OFF oracle |
32| realize.c `omega_blackwell_get_machine_id` | cg_bind kind 2; bw_identity SHA | null guard |
33| realize.c `omega_blackwell_realization_compute_id` | cg_bind kind 1; bw_identity SHA | fixed wire copies |
34| realize.c `omega_blackwell_realize_vector` | cg_bind kinds 4/9 and existing Omega vector encoder | struct projection, pointer guards |
35| code_alloc.h `omega_gpu_code_alloc_bytes` | bw_scalar 4 | size_t conversion; default-OFF existing NO_TAIL mutant selector |
36| native_runtime.h `omega_native_cache_call` | existing native_cache; bw_scalar 7 | pointer projection and signed bit copy |
37| native_runtime.h `omega_native_context` | fixed native ABI fields | memset, epoch host call, architecture constant |
38| native_runtime.h `omega_native_cache_refresh` | native_cache op17 | fixed request packing |
39| native_runtime.h `omega_native_shape_key` | bw_scalar15 bounds, existing native_key, bw_scalar8 status | pointer guard and bounded memcpy |
40| native_runtime.h `omega_native_cache_reserve` | native_cache18, bw_scalar9 slot normalization | fixed request packing, reservation-owner load |
41| native_runtime.h `omega_native_cache_finish` | bw_scalar10 selects commit/abort; native_cache | fixed token packing |
42| native_runtime.h `omega_native_cache_victim` | bw_scalar11 selects victim/erase; native_cache | fixed token packing |
43| native_runtime.h `omega_native_cache_lease` | native_slotrev, bw_scalar12 | lease struct construction and epoch host call |
44| native_runtime.h `omega_native_live_call` | native_lease, bw_scalar13 boolean, bw_scalar7 status | pointer guards, token packing, signed bit copy |
45| native_runtime.h `omega_native_lease_op` | preceding helpers | request storage |
46| native_runtime.h `omega_native_payload` | native_validate, bw_scalar8 status | pointer guard |
47| native_runtime.h `omega_native_admitted` | bw_name bounded terminator scan, bw_scalar14 size admission, native_templates/native_validate, bw_scalar8 | pointer guards, fixed wire projection; strnlen only freestanding/default-OFF oracle |
48| native_runtime.h `omega_native_launch` | native_binding, bw_scalar8 | pointer projection |
49| native_runtime.h `omega_native_bound` | existing payload/lease units and bw_scalar4 charge | pointer guards and fixed request packing |
50| matmul.h / realize.h / gpu_platform.h / gpu_cmdlist_native.h other content | declarations/types/constants only | no further executable decision/arithmetic/encode functions |
51
52New omega_bw_policy.h is ABI/pointer/bit glue, not a second policy implementation.
53Its failed scalar ABI trap is fail-closed; identity maps checked status through
54bw_scalar8. Default-OFF C_BIND preserves the #309 C oracle. Independent frozen C
55matmul/realize sources live under tests and compile only when
56CUDAPP_MIGRATION_PENDING_BW_MATMUL=1 is explicitly requested by the differential.
57The independent policy oracle is also only in the guarded differential test.
58The final fixed snapshot-name scan is registered separately in a1e2601, using
59the published hosted checked-view profile. `CUDAPP_MIGRATION_PENDING_BW_NAME`
60is default-OFF. `OMEGA_GPU_NO_POSIX` keeps the explicit bounded strnlen exception
61pending omega-bridge#72; no #72 converter or compiler is adopted.
62
63
64## Converter pin and explicit freestanding exception
65
66Main explicitly authorized bridge#73 at 79e8c3613a6f6f9e8eaaa9c013fc25bcb39e0538.
67Separate pin commit e2c0e70 updates the lock and regenerates the existing fixed-view
68units. Registration commit 31ce9df adds the hosted CPU runtime-view units. The PR
69is pending omega-bridge#71 and #73 merge. The seeded compiler remains e5b32567.
70The generator uses the published `bridge-seeded --runtime-views` profile, not a
71private generator convention. Numeric fixed-view units retain their existing path.
72
73Under OMEGA_GPU_NO_POSIX, checked hosted views cannot provide aggregate SHA/binding
74or runtime CPU-view units. The C_BIND encoding/hash path and the three named CPU
75reference loops remain explicit **freestanding exceptions pending omega-bridge#72
76and an authorized pin**. No #72 pin is adopted. Hosted/default uses the registered
77.om units with checked SHA identities. Scalar half/bfloat conversion and native
78allocator/header policies use import-free .om on both builds.
79
80The hosted CPU loops use three unsized typed views (six physical slots). For
81positive dimensions, a=m*k, b=k*n, c=m*n imply n²=b*c/a. The shape helper cancels
82gcd(a,b), then gcd(the remaining a,c), refuses an uncancelled denominator or
83overflow, and takes an integer square root. It verifies an exact square, exact
84k=b/n and m=a/k divisions, all three extents, and u32 dimensions. This avoids
85overflow even for general u32 dimensions; no envelope restriction or extra shape
86ABI is introduced. Zero dimensions retain the original -1 refusal.
87
88The old C arithmetic wraps uint32 input/output indices and integer accumulation.
89The .om dot helpers preserve those masks explicitly; integer multiply/add widens
90to ulong before masking. Float operations round separately through the generated
91volatile f32 arithmetic helper. Literal u32/u64 loop bounds plus explicit extent
92returns avoid the seeded one-million guard on implicit runtime-valued `for` loops,
93without changing a compiler limit or a gate. A dot beyond that guard is exercised.
94The pressure fix follows the consultant's decisive point: pass the flat output
95index to the dot helper instead of packing coordinates in the call expression.
96
97### CPU reference buffer contract
98
99Output must be disjoint from both inputs; read-only inputs may overlap. Main
100approved this checked-view contract after a caller audit. submit.c:405/648 allocates
101separate h_expected buffers; cubin_probe.c:120-121 separately allocates A/B/ref;
102regalloc_om/sim.c:42/54 declares separate inputs and expected arrays; the focused
103differential uses distinct arrays. No caller supplies aliased output. Direct ABI
104and all three public wrappers have alias-refusal red controls. Header and API.md
105section 10 carry the contract. These are INTERNAL verification helpers, not
106manifest entries, so the public manifest is intentionally unchanged.
107
108## Case partition and numerical rules
109
110Differential: every binary16 input, every bf16 expansion input, targeted f32
111zero/subnormal/normal/tie/overflow/infinity/NaN boundaries and deterministic f32
112bit samples. Non-NaNs compare exact bits; NaNs compare class. Compilation uses
113-ffp-contract=off. Spec dimensions cover zero, UINT32_MAX and each extent limit
114plus neighbors. Hash checks cover every wire length from zero through 256, refusal
115257, short extent and alias rejection. Realization inputs vary every struct byte,
116including architecture, before comparing the complete initialized result.
117Vector launch cases cover zero, block boundary and uint32 wrap. Allocation cases
118cover tail/page boundaries and overflow; scalar status/lease/admission predicates
119cover zero, signed limits, both decisions, invalid op and every admission bound.
120CPU tests cover deterministic rectangular shapes with random integer/half/bfloat
121contents, NaN-class comparison, all null/zero refusals, full-u32 shape admission,
122and invalid reconstructed extents (non-square quotient and k mismatch), without
123touching the output on refusal. The original C loops remain independent oracles.
124Dispatch covers all three precisions and invalid precision, nulls, byte equality
125and free(NULL). There is no device access.
126The snapshot-name scan checks every possible terminator position in its 64-byte
127field against the independent C strnlen oracle, plus unterminated and short-view
128refusals. Its terminator-predicate mutant must compile and fail the differential.
129
130## C-oracle coverage
131
132The O0 `--coverage` receipts are `repeat-om_bw_matmul_oracle.c.gcov` and
133`repeat-om_bw_realize_oracle.c.gcov`. Matmul reaches every line, branch and branch outcome.
134Realization reaches every line and branch site. Three refusal outcomes cannot be
135selected by any caller input:
136
137- Oracle line 40: `omega_blackwell_get_machine_id(&out_real->machine_id)` cannot
138 receive NULL after the outer `out_real` guard; this callee only refuses NULL.
139- Oracle line 48: the fixed vector encoder receives a non-NULL stack buffer with
140 exactly `OMEGA_BW_VECADD_CODE_SIZE` capacity and has no caller-dependent input.
141 Its failure would require corrupting the fixed encoder or its generated ABI.
142- Oracle line 49: digest input/output pointers are non-NULL stack/member storage,
143 and the successful fixed encoder supplies its known nonzero code length.
144 The digest helper's NULL/zero-length refusals are therefore unreachable here.
145
146These are justified unreachable outcomes, not claimed covered or killed mutants.
147The live encoder's guards are in `src/omega_blackwell_encoder.c`; no gate or
148production behavior is weakened to force them.
149
150
151WolframLanguageEvaluator queries:
152- `Integrate[x^2,{x,0,1}] -> 1/3` (mount verification).
153- `127-15+1 -> 113` (binary16 subnormal exponent base).
154- `{2^64-1,2^64-4096,2^63,2^32-1} -> {18446744073709551615,18446744073709547520,9223372036854775808,4294967295}`.
155- `{FullSimplify[(k n) (m n)/(m k),Assumptions->m>0&&k>0&&n>0],(2^32-1)^2,2^64-1,8192*16384*262144^2,2^54,2*3/1,1*8/2} -> {n^2,18446744065119617025,18446744073709551615,9223372036854775808,18014398509481984,6,4}`. The stated envelope product is 2^63, not 2^54; gcd cancellation handles the broader u32 domain.
156- `{(2^32-1)^2+(2^32-1),(2^32-1)^2+(2^32-1)<2^64} -> {18446744069414584320,True}` bounds the widened integer multiply/accumulate.
157All test counters are integer bookkeeping, not modeled performance.
158
159## Final host receipts
160
161All commands below use the exact bwrap/taskset/nice prefix in Reproduction and
162the pinned environment below. `hosted-final-gates.log` records this complete
163command with rc 0:
164
165```
166sh om/units.sh --check &&
167make -j3 test-om-bw-matmul test-om-bw-matmul-mutants \
168 test-om-bw-matmul-coverage test-gpu-code-alloc test-gpu-cmdlist \
169 test-gpu-decode-graph test-gpu-native-runtime test-gpu-engine-sim \
170 test-gpu-matmul-api test-native-artifact-manifest test-codegen-freestanding
171```
172
173Observed: byte-for-byte regeneration PASS; 12 compiled semantic mutants killed;
174the differential red binary exits 1 as required; existing requested oracles pass;
175matmul API 178 checks and its R4 receipt 7 checks pass; native session platform
17627 passed/0 failed; all bf16 bit patterns match the hosted cast. The final line is
177`PASS: freestanding codegen contract (14 fixtures, 0 failing checks)`.
178
179That run exposed a stale gcov profile checksum warning after the test source
180changed. Commit 8a5930f fixes the owned coverage target by clearing only its own
181`diff-*.gcda` files before each run. `coverage-repeat-regression.log` records the
182post-fix command with rc 0, including the added partial-output-alias refusal and
183read-only-input-alias success cases:
184
185```
186make -j3 test-om-bw-matmul test-om-bw-matmul-mutants \
187 test-om-bw-matmul-coverage &&
188make -j3 test-om-bw-matmul-coverage
189```
190
191Observed final differential: `PASS bw matmul realization differential checks=521475`.
192Red check killed; 12 mutants killed; repeated coverage has no checksum warning.
193Both coverage runs report matmul 100% of 112 lines and 96 branch outcomes,
194realization 100% of 32 lines and branch sites, 81.25% of 16 branch outcomes,
195with the three unreachable refusal outcomes justified above. The final line is
196`Lines executed:100.00% of 144`. Earlier receipts are retained separately rather
197than rewritten. The name-unit development failures (compiler rc 16 for reserved
198`out`, then converter rc 24 for the legacy profile) were fixed before these gates:
199the local is `dst` and the registered profile is `--runtime-views`.
200
201## Chip runbook — NOT_RUN
202
203No GPU/window permission exists. The host gates always hide devices using the
204bwrap command below. Integrator3 owns full make test; it is not run by this lane.
205After an explicitly authorized exclusive chip window, the operator must use the
206current GPU/session gate and pinned firmware/driver/board identity, then run the
207existing real matmul/vector execution oracles with the three precisions, compare
208output to the named CPU oracles, record actual-versus-expected refusal cases and
209receipts. This document grants no live-service, lock, driver or GPU authority.
210
211## Reproduction
212
213Every test/generator gate is run with:
214
215```
216bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 COMMAND
217```
218
219Generation/mutants use OMEGA_OMC=~/work/cudastack/omega-mv/seed/out/omc,
220OMEGA_BRIDGE=~/work/cudastack/lanes/BridgeDynViews and
221OMEGA_SEED=~/work/cudastack/omega-bridge/build/bootstrap/omc. The pinned omc is
222e5b32567, SHA256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f.
223Focused acceptance targets are in mk/om-bw-matmul.mk. Integrator3 owns the full
224integration gate and the cross-repository harness converter-guide refresh.