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/tern-rowmajor-20261106/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 / tern-rowmajor-20261106 / README.md` 218 lines · 11931 bytes Raw Blame History Rendered 1 # Row-major tern simulator include custody, 2026-11-06 2 3 ## Outcome and scope 4 5 IMPLEMENTED and EXERCISED, host only. No GPU qualification, merge or deployment. 6 The reported row-major mismatch is pre-existing on CUDApp main, not introduced 7 by the stacked Omega API or codegen migrations. The faulty component is the 8 simulator selected beside the external Omega test source, not the generator, 9 API packer or algebra reference. The simulator already in CUDApp main is correct. 10 11 The new regression in existing `tests/gpu_tern_sched_test.c` constructs its own 12 packed weights and expected rows. `Makefile` now tracks its simulator headers. 13 `docs/OMEGA_HOST_TESTS.md` records the include requirement. No production C or 14 Omega implementation changes were needed. This work does not port verification 15 oracles to Omega and does not change a public API, compiler pin or trust gate. 16 No omega-harness guide describes a changed interface here. 17 18 ## Source pins 19 20 - CUDApp origin/main: ``b774723f537cec16a359fe082b8100317a5b5490``, fresh detached `/tmp/tern-main`. 21 - IntegStage3 snapshot: ``84d23311052559216defa1a456b61efadd52f035``, detached copy `/tmp/tern-integ`. The live integration tree was not edited. 22 - ApiViewsRest HEAD snapshot: ``c1d68bb9854c3bc995a111f2cd7a366eb15da265``, detached copy `/tmp/tern-api`. Uncommitted lane work was not copied or edited. 23 - Regression source commit: ``eeaba533205dbbb5fb696f9758b86e64ac0a0b75``, branch `fix/tern-rowmajor`. 24 - Omega reference test and compiler source: ``e5b32567a7aff3ce594e3254a622a846a6cd190b``. 25 - `omc` SHA-256: ``2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f``. 26 - Local verification bridge: ``bc11b30b1faa9af8b875ae6fec24e5f49cf03ac4``. 27 - CUDApp simulator SHA-256: ``160fb034317c73d7861bae21ab23c4a0bdca1928af9cea93cd9d85492189b5a2``. 28 - Omega reference simulator SHA-256: ``e158dd6cd7d0fd5b06eed1f929c9cbf41b1ed9fd7e62f1fd268b3dad111d41e6``. 29 - Regression source SHA-256: ``a69d9df1dcd5c91db697ed3f7eb6fcf72e9d5b1cfe58574603f587df6cbcff5f``. 30 - Host: Linux `7.0.0-1019-nvidia`, aarch64. GCC `13.3.0` (Ubuntu `13.3.0-6ubuntu2~24.04.1`), bubblewrap `0.9.0`. 31 32 Every execution in this receipt used: 33 34 ```sh 35 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 COMMAND 36 ``` 37 38 No device, live service, GPU lock or driver was touched. Build parallelism was 39 at most `-j3`. No full `make test` was run. Log copies replace the private home 40 prefix with `~`; expand it when reproducing. Original temporary logs remain 41 under `/tmp/tern-repro` on the execution host. 42 43 ## Reproduction matrix 44 45 The external pinned `tests/gpu_tern_test.c` includes `bw_warp_sim_k.h` with 46 quotes. The preprocessor searches the external source directory before `-Itests`. 47 The stale simulator drops `in->imm` for scalar `BW_IR_LDG_E`. CUDApp main's 48 case adds the signed immediate, as do its wide-load cases. Row-major unrolled 49 weight loads need these offsets; the block-layout loads use the already-correct 50 wide-load path. 51 52 The exact external `sim_battery()` was compiled in each snapshot through a 53 verification-only entry adapter. It neither changes the test nor its reference. 54 Unreachable chip functions are discarded with function/data sections and linker 55 GC. Both the API and codegen from each named snapshot are used. The two variants 56 differ only in test-translation-unit pre-inclusion of CUDApp's simulator. 57 58 | Snapshot | External adjacent simulator | CUDApp pre-included simulator | 59 | --- | --- | --- | 60 | main | FAIL, rc 1, 34 checks, 14 failed | PASS, rc 0, 34 checks, 0 failed | 61 | IntegStage3 | FAIL, rc 1, 34 checks, 14 failed | PASS, rc 0, 34 checks, 0 failed | 62 | ApiViewsRest HEAD | FAIL, rc 1, 34 checks, 14 failed | PASS, rc 0, 34 checks, 0 failed | 63 64 See `{main,integ,api}-{stale,current}.log` and matching `-build.log` files for 65 exact compile commands and observed output. `battery-entry.c` is the adapter 66 used for those executions. Failed initial integration linkage, before completing 67 the migrated API and register-allocation source list, is not a behavior verdict. 68 The final logs contain the complete working source list. 69 70 `/tmp/integ/openpr-files.txt` identifies tern codegen/test ownership in #279 and 71 integration #280. Simulator changes also occur in #229, #282, #290 and #307. 72 PR #279's pre-existing adapter `tests/codegen_tern_sim_test.c` already selects 73 the current simulator. Its evidence directory `evidence/codegen-tern-`20261106`` 74 records the same stale-header trap. A stack bisect is therefore unnecessary: 75 unchanged origin/main reproduces the exact failure and all three snapshots pass 76 with the current simulator. No historical receipt was edited. 77 78 ## Independent arithmetic 79 80 The smallest reported failing point is k=512, n=13, layout=0, rows=2, warps=2, 81 depth=2, grid=2, order=0. The pinned battery uses weight seed 101 and activation 82 seed 108. These are source values, not estimates. 83 84 WolframLanguageEvaluator independently generated the unpacked ternary matrix 85 and signed byte activation vector, without the API packer, codegen or algebra: 86 87 ```wl 88 Module[{s=101,t=108,next,w,x}, 89 next[z_]:=Mod[`1664525` z+`1013904223`,2^32]; 90 w=Table[s=next[s];If[s=2^31,1,-1]],{13},{512}]; 92 x=Table[t=next[t];With[{v=Quotient[t,2^24]}, 93 If[v>=128,v-256,v]],{512}]; 94 {Floor[3(2^32-1)/10],w.x}] 95 ``` 96 97 Result (MODELED integer dot products, in output accumulator units): 98 99 ```text 100 {`1288490188`, 101 {-3013,2779,-1089,-2155,-1793,-2083,-240,604,-1545,1900,-156,1931,-1037}} 102 ``` 103 104 The regression uses a second, simpler independent fixture. Row r has r+1 packed 105 words with every trit +1 for even r and -1 for odd r; remaining words are zero, 106 and every activation is 1. No packer or word-offset helper is used. Queries: 107 108 ```wl 109 {Sum[2^(2i),{i,0,15}],Sum[2*2^(2i),{i,0,15}], 110 Table[16(r+1)(-1)^r,{r,0,12}]} 111 ``` 112 113 WolframLanguageEvaluator result (MODELED packed words and integer dot products): 114 115 ```text 116 {`1431655765`,`2863311530`, 117 {16,-32,48,-64,80,-96,112,-128,144,-160,176,-192,208}} 118 ``` 119 120 ## Regression and negative control 121 122 `regression-stale-build.log` compiles the new, unchanged regression against the 123 original external simulator through `-include`. `regression-stale.log` records 124 rc 1, 13 differing rows in each warp order, and `gpu_tern_sched_test: FAIL (2)`. 125 This is the exact unfixed header-selection path, not a relaxed oracle or an 126 artificial output mutation. 127 128 `regression-current.log` records the normal target: 129 130 ```sh 131 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 test-gpu-tern-sched 132 ``` 133 134 It exits 0: both orders have zero differing rows, the existing scheduling 135 checks and refusal controls pass, and the last line is 136 `gpu_tern_sched_test: PASS`. 137 138 `regression-omega.log` also runs this same new test against the default Omega 139 builder in the integration snapshot. It exits 0, with zero differing rows in 140 both orders and `gpu_tern_sched_test: PASS`. 141 142 The unchanged original test CLI was separately linked with main's library and 143 the external algebra object. `cli-stale.log` runs `--sim` and exits 1 with 144 34 checks and 14 failures. `cli-current.log` runs `--sim` and exits 0 with 145 34 checks and no failures. The algebra object is compiled separately, without 146 the simulator pre-include. Function/data sections and linker GC omit unused 147 external algebra backends. See the corresponding `cli-*-build.log` files. 148 149 `independent-rows-{stale,current}.log` records the original smallest case row 150 by row. The Wolfram values, unpacked host dot product and unchanged algebra 151 oracle agree for every row. The current simulator agrees too; the stale one 152 gets every row wrong and repeats each adjacent row value. The archived 153 `independent-rows.c` is that probe, with only archival comments and the stated 154 HOME-prefix substitution added. 155 156 ## Focused make targets 157 158 The main-based branch's codegen target is `test-codegen-freestanding` in 159 `mk/omega-gpu-engine.mk`. The stacked tern generator's focused targets in 160 `mk/codegen-tern.mk` are `test-codegen-tern-diff`, 161 `test-codegen-tern-sim` and `test-codegen-tern-mutants`. The local scheduler 162 target is defined in `Makefile`. These are the targets exercised here, not a 163 claim that unrelated attention, tensor-core or MoE codegen suites were rerun. 164 165 | Tree and target | rc | Observed final result | 166 | --- | --- | --- | 167 | main-based source, `test-gpu-tern-sched` | 0 | `gpu_tern_sched_test: PASS` | 168 | main-based source, `test-codegen-freestanding` | 0 | `PASS: freestanding codegen contract (14 fixtures, 0 failing checks)` | 169 | integration copy, `test-codegen-tern-sim` | 0 | `CODEGEN TERN SIM: 34 checks, 0 failed: PASS` | 170 | integration copy, `test-codegen-tern-mutants` | 0 | `CODEGEN TERN OMEGA MUTANTS PASS (68 source-mutant/config controls)` | 171 | integration copy, `test-codegen-tern-diff` | 0 | `CODEGEN TERN DIFF PASS (213120 programs, 14258 refusals)` | 172 173 The freestanding gate also reported byte-identical dumps for 14 fixtures, 174 24448 code bytes, all 2^32 bf16 inputs equal to the hosted cast, and its 175 malloc allowlist canary refused. The tern differential caught its record 176 negative control before printing PASS. These are MEASURED values copied 177 from the filed logs, not extrapolations. 178 179 The integration snapshot's standalone tern target source list was not yet 180 wired to newer API-shell and register-allocation bindings. The first direct 181 link attempt failed with missing `omega_apishp` and `omega_ra_{ir,run,live}`. 182 The final focused target runs used the existing `BW_CODEGEN_BINDING` plus 183 the API-shell generated bindings through a command-line source-list override. 184 No source in the integration tree was edited. Integrator4 was given the exact 185 missing interface and owns the canonical make dependency repair. The successful 186 commands below therefore prove the target behaviors with completed linkage, 187 not that the unmodified snapshot's build wiring is repaired. 188 189 Run these from the integration copy, with the pinned OMEGA_OMC, 190 OMEGA_BRIDGE and OMEGA_MV set as above: 191 192 ```sh 193 tern_sources='src/omega_blackwell_codegen_tern.c src/omega_blackwell_codegen.c src/omega_gpu_om_ir.c $(CG_TERN_SRC) $(CG_TERN_SCHED_SRC) src/cudapp_om_cg_tern_policy.c src/cudapp_om_bw_enc_sm121.c src/omega_gpu_fmt.c src/sha256.c $(BW_CODEGEN_BINDING) src/cudapp_om_apish_blk.c src/cudapp_om_apish_shp.c src/cudapp_om_apish_trit.c src/cudapp_om_apish_slot.c src/cudapp_om_apish_pack.c' 194 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 "CG_TERN_HOST_SRCS=$tern_sources" "OMEGA_MV=$OMEGA_MV" test-codegen-tern-sim 195 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 "CG_TERN_HOST_SRCS=$tern_sources" "OMEGA_MV=$OMEGA_MV" test-codegen-tern-mutants 196 bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 make -j3 "CG_TERN_HOST_SRCS=$tern_sources" "OMEGA_MV=$OMEGA_MV" test-codegen-tern-diff 197 ``` 198 199 Each `test-codegen-*.log` contains the command arguments and complete output. 200 The command header is a plain argument rendering; the shell snippet above 201 preserves the source-list argument's quoting. An earlier differential execution 202 hit an Eval deadline before completing and was stopped by exact owned PID; 203 `interrupted-diff.log` labels it INCONCLUSIVE. The final file-backed execution 204 had no deadline and completed with the PASS shown above. 205 206 The API-rest consumer correction is in that lane's 207 `tests/api_rest_families.sh`: compile the external oracle separately and 208 pre-include the local simulator only for the external test translation unit. 209 It was reported uncommitted by ApiViewsRest2 while this receipt was collected; 210 this branch does not claim to contain that separate lane's runner repair. 211 212 213 ## Hardware tier 214 215 NOT_RUN. No GPU window is authorized. This simulator regression does not claim 216 chip qualification. A future operator-authorized chip receipt should use the 217 pinned original `gpu_tern_test` chip battery on the selected integrated source, 218 retain its existing admission/refusal checks and record that exact revision.