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/omega-mv/patches/53a8e7dd2c4970eb # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/omega-mv#487 (code only) merged derived `53a8e7dd2c4970eb` #487 Imported from GitHub aien-dev/omega-mv#487 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `d0ffdd3c3ad61b9cdc717ea9e46637e9c445bc7d` ยท Head `d0ffdd3c3ad61b9cdc717ea9e46637e9c445bc7d` github-advanced-security[bot] commented on `src/omega_blackwell_codegen_tgemm.c` line 21 on 2026-10-16 20:56 UTC ## CodeQL / Multiplication result converted to larger type Multiplication result may overflow 'unsigned int' before it is converted to 'unsigned long'. Show more details - reviewed (COMMENTED) on - Independent review of PR head `88c90355` (fresh checkout; no GPU runs). Verdict: no blockers. The kernel is correct by design and by the evidence for the shapes it accepts. Four should-fix items, mostly about guards and what the evidence and description say. ## Blockers None. ## Should-fix - 32-bit index overflow is accepted without a refusal. `src/omega_blackwell_codegen_tgemm.c:199-200` computes `(row0 + tid/SPAN) * N + cx*SPAN + ...` with a 32-bit IMAD before the wide `*4`. `src/omega_blackwell_codegen_tgemm.c:78` does the same for the B start, `(kb0*128 + 8t) * N + n0w`. `omega_gpu_tgemm_spec` (`src/omega_gpu_tgemm_api.c:20-22`) bounds m only by 65535 tiles and n by 2^17. So any call with m*n >= 2^32 is accepted and silently writes to the wrong rows of C. No trainer shape is near this today (largest is about 8192x50304 = 4.1e8). A table with large kb0 times N has the same problem on the B side. Fix: refuse `(uint64_t)m * n >= 2^32` in `omega_gpu_tgemm_spec`, and document `kb0*128*n < 2^32` for caller-built tables. Confidence 85. - The module tile table is used outside the session lock. `src/omega_gpu_tgemm_api.c:66-67` frees, reallocates and rewrites the shared `g.tab` before `omega_gpu_session_lock()` at :69. A second thread calling `omega_gpu_tgemm` can free or overwrite the table while the first thread's kernel is reading it. pfgemm avoids this because its caller owns the table. Fix: build and sync the table under the lock (if the lock is recursive), or state "single caller thread" in the header. Confidence 80. - The evidence and the PR body disagree. - The body says "1024x768x50304 (rt 4 x 8 warps)". `k50304.log:1` says `rt 8 warps 16`, because n = 768 is a multiple of 256. `tools/run_gpu_tgemm_chip.sh:11` says "warps 8" as well. As a result, the default path for n % 256 != 0 (rt 4 x 8 warps, which the lm_head forward with N = 50304 will take) only ran on the chip through the forced knob (`warps8.log`, at N 768). N = 50304 never ran on the chip. - `rt2.log:1,4` is a FAIL. The uncached setup hit a channel-creation CHIP_FAIL. The run is informational, but the PR body does not mention it. - On that early return (`tests/gpu_tgemm_test.c:187`), `ad/bd/cd`, `poison`, `y1/y2` and the problem buffers are leaked. Fix: correct the body and the script comment, say what happened in rt2, add a chip shape with n % 256 != 0, and free the buffers on the setup-failure path. - The IMAD.HI.U32 sim/chip divergence is only noted locally. The IR enum comment (`src/omega_blackwell_codegen.h:84`) and all four simulators (`tests/bw_warp_sim.h:142`, `bw_warp_sim_tc.h:169`, `bw_warp_sim_k.h:148`, `bw_warp_sim_pa.h:158`) still model a 32-bit Rc. Only `src/omega_blackwell_codegen_tgemm.c:120-121` and the PR body record the chip behaviour. The one live user (`src/omega_gpu_elementwise_api.c:354`) passes Rc = RZ, so it is safe today. Any future IMAD.HI with a register Rc would pass the simulator and fail on the chip. The "Rc is a 64-bit pair" explanation also comes from a single failing run, not from a probe. This PR cannot touch the enum or the sims (scope), so please open a follow-up issue: a chip probe of IMAD.HI with Rc != RZ, then either model it or have the sims refuse a non-RZ Rc. Also add a Cortex lesson. ## Nits - `tests/gpu_tgemm_test.c:10,233`: the default `--peak 120.64` is labelled "peak.log". 120.64 is in `peak-window1.log`; `peak.log` best is 117.26. A run without `--peak` would show percentages about 3% low against the gate window. - `src/omega_gpu_tgemm_api.c:11`: `omega_gpu_tgemm_bm()` returns 128 when the default picks rt 4 (n % 256 != 0, bm 64). Padding to 128 is still a valid multiple, but the name suggests it is exact. - Kernel K loop (`src/omega_blackwell_codegen_tgemm.c:143,166-168`): `nkb = 0` in a caller-built table (the `fill_launch_locked` path) wraps the counter and runs about 2^32 blocks past A and B until the timeout. Kernel-side clamping, or a header warning next to `tiles_va`, would help. - `tests/gpu_tgemm_test.c:60-63`: the "production" spec list has `k 50304 n 768 rt 4 w 8`, but the API picks rt 8 x 16 warps for n 768. The real production pick for the lm_head forward (`k 768 n 50304`, rt 4 w 8) is not in the budget list. - The instruction-count gate (`src/omega_blackwell_codegen_tgemm.c:213`) is enforced but never shown to fire in a test. The GPR gate is shown to fire (rt 8 x 8 warps is refused). - `device.txt` records `dirty=1`. This is most likely the untracked evidence folder the script creates before running `git status` (`tools/run_gpu_tgemm_chip.sh:18-20`). Running `git status` before `mkdir` would remove the doubt. `build.log` only records "gpu_tc_peak_test is up to date", so it does not show the test binary being built at `5b10b824`. - CI: `make test-gpu-tgemm` (`Makefile:2568`) is not called by any workflow. I grepped `.github/workflows` and found no tgemm or pfgemm test call. The host and sim proofs only run when the chip script runs. Please add it to a host-suites job (it needs the physics checkout for headers). ## Verification done - Scope. The diff touches only the new tgemm files, the Makefile block, crumbs, evidence and the chip script. `omega_gpu_matmul_api.*`, the encoder, the IR enum, `omega_bw_em.h` and the patch step are untouched. `tests/gpu_tc_peak_test.c` is not changed by this PR (it comes from main, `5faa0f70`). - 1. Shared memory. The footprint is 2 x 16 x rt x 32 x 2 bytes = 2048 x rt: rt 8 = 16384 B, rt 4 = 8192 B, rt 2 = 4096 B. The epilogue uses 32 x span bytes (8192 B at 16 warps, 4096 B at 8 warps), and `spec_ok` requires this to fit within the staging buffers (`tgemm.c:24`). - `spec_ok` refuses anything over 16384 (`tgemm.c:23`). The QMD builder refuses the same (`src/omega_blackwell_qmd.c:116`) and programs SHIFTED7 = 128. Word 36 keeps the min/target SM config of 32 KB, so rt 8 sits exactly at the cap. - I checked bounds by hand. The highest STS32 byte is 16383 and the highest LDS.128 byte is 8191 + BUF. Epilogue slots stay under 32 x span. Mutant 3 (`i^1`) stays in range for even rt. - The simulator enforces `smem_bytes` exactly (`tests/bw_warp_sim_tc.h:150`). - tc2's rt 8 needed 32 KB (kc 128), which is why it could not run on chip; this kernel's kc 32 halves the footprint. - 2. Gates. `prog->count > 1000` returns -1 (`tgemm.c:213`). Declared registers > 128, or a declared/peak mismatch, return -1 (`:215`). The API refuses threads x declared > 65536 (`api.c` fill_launch). I rebuilt and got the same numbers: 800 instructions, peak 125, declared 128. - 3. Tiling. There are no partial tiles. m % bm, n % span and k % 128 are refused, so m = 50304 gives 393 tiles at bm 128. I traced A, B and C addressing, the double-buffer barriers, the last-block re-read (which stays in bounds) and the epilogue column map (E.c0, O.c0, E.c1, O.c1 matches the m16n8 C layout). - 4. Peak probe. HMMA count = ctas x warps x iters x chains, times 4096 FLOP (2 x 16 x 8 x 16). Every output is checked against 16 x iters, so each HMMA is really issued. Timing is the same session chip-time median as the GEMM. Recomputed: 384 x 8 x 4096 x 16 x 4096 / 7.0325 ms = 117.26 TFLOPS. - 5. Two logged numbers recomputed. 2 x 8192 x 768 x 2304 / 0.556 ms = 52.14 TFLOPS (log 52.15 from unrounded ns), and 52.15 / 117.26 = 44.47%. 2 x 8192 x 3072 x 768 / 1.011 ms = 38.23 TFLOPS (log 38.25), 32.6%. Both match. - 6. Harness. I ran `make test-gpu-tgemm` locally (physics at `6d7cf0d`): host-only PASS and sim PASS, identical to `host-only.log` and `sim.log`. An extra mutant of my own (dropping `+ 8h` from the epilogue row offset) failed the sim: 131072 of 131072 outputs differ. Extra sim cases at the production rt 8 x 16 warps with nkb 3 (kb0 1) were bit-identical in both orders. rt 8 with aqn 2 was refused by codegen, as expected. All local edits were reverted. - 7. Determinism. There are no atomics. Each output element is written by exactly one thread (row = 16i + 8h + tid/span + 2j, col = tid % span, disjoint across CTAs and tiles). Epilogue slots are unique per (g, warp, t, w), and barriers guard every slot reuse. The HMMA order is fixed by the program. - 8. IMAD.HI. See should-fix 4. Reviewed by an independent Claude Opus 5.5 reviewer for the orchestrator. github-advanced-security[bot] reviewed (COMMENTED) on 2026-10-16 20:56 UTC ### Code The head commit is on main: `d0ffdd3c3ad61b9cdc717ea9e46637e9c445bc7d` . ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 487 d0ffdd3c3ad61b9cdc717ea9e46637e9c445bc7d ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":487,"url":"https://github.com/aien-dev/omega-mv/pull/487","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:02Z","metadata":"unavailable","state_derived":true} ``` ### Changes There is no diff: the head commit is already on main.