Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
About Files History Releases Proposed changes Issues For developers
C3 gemm: wrong-transpose negative control (DRA-485)
open c48fc7867407a8b1 #13 · opened 2026-11-17 17:22 UTC
Imported from GitHub drakestapleton/omega-mv#13, by drakestapleton
Base 91f88c287d7831784a808c5b054818fd9055afb5 · Head c97e25c623f9acbcbd50b80b51edacbfcf583ce9
drakestapleton wrote on 2026-11-17 17:22 UTC
DRA-485 asks that a wrong-transpose mutant fail. The three existing GEMM mutants (dropped k step, edge leak, swapped store columns) do not cover that. This adds mutant 4: the driver packs A with the other layout's strides, so row-major A is read as column-major and the other way round.
The GEMM itself (omega_gpu_gemm, 208-shape chip tier) is already on main (ec02c799 ). This PR only adds the negative control and its receipts.
Commands run
Host: x86_64, aarch64-linux-gnu-gcc 13.3, qemu-aarch64 user mode, physics-mv at physics.lock (048e5f5e ).
make PHYSICS_DIR=../physics-mv OUT_DIR=build/c3 CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar build/c3/gpu_gemm_test
build/c3/gpu_gemm_test --host-only # C3 gemm host: PASS (166 checks)
build/c3/gpu_gemm_test --sim # C3 gemm sim: PASS (188 checks)
Mutant 4 is caught both ways (A row-major and A column-major), for BF16 and FP8, with 4,095 of 4,095 outputs wrong at 65x63x100. When mutant 4 is turned into a no-op, the sim tier fails 4 of 188, so the check is live. Logs: evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /.
Not run
Chip tier (build/gpu_gemm_test with no flag: 208 shapes, the red checks including mutant 4, speed against 115.36 and 237.52 TFLOPS). NOT_RUN: needs an authorized GB10 window on the Spark.
Known limit of the chip tier: shapes over 2^27 multiply-adds are compared on 4,096 sampled elements plus the last row and column, not in full.
Generated by Claude Code
Apply it
git checkout -b patch-c48fc7867407a8b1 91f88c287d7831784a808c5b054818fd9055afb5
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/c48fc7867407a8b1 .patch | git am
Raw patch (mbox) · Diff
Provenance
This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:
github-import 1
drakestapleton/omega-mv
13
c97e25c623f9acbcbd50b80b51edacbfcf583ce9
{"kind":"github-import","owner":"drakestapleton","repo":"omega-mv","number":13,"url":"https://github.com/drakestapleton/omega-mv/pull/13","export_sha256":"7a4dc05cfaafc4ff4b6c7811f8b55128091a7d4d233c7761f900f26220660f83 ","imported_utc":"2026-11-18T16:39:50Z"}
Changes
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index aa4a7bd38 ..b9b280431 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -139,3 +139,4 @@ Update this table in the same commit as the work it credits.
| Claude Opus 5.5 | Repaired the source-aware legacy guard after #525 (OSC IR v6, #451) and #962 (checker2 some-path leaks and mutable aliases, #465): `src/compiler/osc_ir.c` re-pinned and `osc_ir.h`, `src/checker2/c2_check.c` pinned by the SHA-256 of their merged content, so `translation-g1` passes on main again; the 60-fixture IR byte-identity check against base 69790fb4 still holds, and a one-byte edit to any pinned or unpinned legacy file still fails. |
| Claude Opus 5.5 (ExecEnv, omp subagent of omp-queen-spark) | Added `execenv` (keyword 233): `execprog` with a private packed environment on AArch64 and x86linux, the `seed/host/execenv/` conductor gate (fixture, printenv ORACLE, execprog negative control, refusals, 4 omc.om mutants), keyword tables (genkw/gate18, semhash, effects) and the reseed 5f90edea -> cfd96b48 with repin. |
| Claude Opus 5.5 (EffectsClosure, omp subagent of omega-node) | Brought `seed/effects` current with keywords 227-232: table rows `eventfd` (fd, eventfd2 19), `vfioctl`/`vfioirq` (device, ioctl 29) and `vfiomap`/`vfiomapw` (device, mmap 222) with probes; `fma` excluded from closure as non-host arithmetic with a no-syscall probe, like `cpufence`/`cpurelax`. `seed/effects/check.sh` FAIL 2/50 -> PASS 50/50; compiler unchanged. |
+| Claude Opus 5.5 | DRA-485 (C3 GEMM): wrong-transpose negative control, mutant 4 (the driver packs A with the other layout's strides), checked in codegen (host tier), the warp simulator and the chip tier, both directions (A row- and column-major), BF16 and FP8. Host 166 and sim 188 PASS under qemu-aarch64; the 208-shape chip run stays NOT_RUN. |
diff --git a/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /01-host-only.log b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /01-host-only.log
new file mode 100644
index 000000000 ..23165720f
--- /dev/null
+++ b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /01-host-only.log
@@ -0,0 +1,47 @@
+commit b232bc84f02157abe3bfbe0522392f2ced6f9b33
+command: build/c3/gpu_gemm_test --host-only
+build: make PHYSICS_DIR=../physics-mv OUT_DIR=build/c3 CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar build/c3/gpu_gemm_test
+host: x86_64 6.18.44-fc-v553, aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, qemu-aarch64 version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18); physics 048e5f5e881b092733baaf65d0ace46abda7f908
+binary sha256: a598a72e2e47c8ca086a78e4d365547256a0f220fad17c6e8ebb0100f169f674
+date: 2026-11-17T17:20:50Z
+---
+the bf16 model is a multiply (A row B row): worst error 3.81e-07 of the magnitude sum
+the bf16 model is a multiply (A col B row): worst error 5.42e-07 of the magnitude sum
+the bf16 model is a multiply (A row B col): worst error 5.77e-07 of the magnitude sum
+the bf16 model is a multiply (A col B col): worst error 4.26e-07 of the magnitude sum
+the e4m3 model is a multiply (A row B row): worst error 3.16e-07 of the magnitude sum
+the e4m3 model is a multiply (A col B row): worst error 3.17e-07 of the magnitude sum
+the e4m3 model is a multiply (A row B col): worst error 2.44e-07 of the magnitude sum
+the e4m3 model is a multiply (A col B col): worst error 2.58e-07 of the magnitude sum
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 116 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 20 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 48 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 20 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 108 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 84 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 84 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 32, 116 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 4, 48 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 108 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 84 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 84 gprs
+C3 gemm host: PASS (166 checks)
+exit 0
diff --git a/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /02-sim.log b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /02-sim.log
new file mode 100644
index 000000000 ..66fece582
--- /dev/null
+++ b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /02-sim.log
@@ -0,0 +1,63 @@
+commit b232bc84f02157abe3bfbe0522392f2ced6f9b33
+command: build/c3/gpu_gemm_test --sim
+build: make PHYSICS_DIR=../physics-mv OUT_DIR=build/c3 CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar build/c3/gpu_gemm_test
+host: x86_64 6.18.44-fc-v553, aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, qemu-aarch64 version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18); physics 048e5f5e881b092733baaf65d0ace46abda7f908
+binary sha256: a598a72e2e47c8ca086a78e4d365547256a0f220fad17c6e8ebb0100f169f674
+date: 2026-11-17T17:20:50Z
+---
+the bf16 model is a multiply (A row B row): worst error 3.81e-07 of the magnitude sum
+the bf16 model is a multiply (A col B row): worst error 5.42e-07 of the magnitude sum
+the bf16 model is a multiply (A row B col): worst error 5.77e-07 of the magnitude sum
+the bf16 model is a multiply (A col B col): worst error 4.26e-07 of the magnitude sum
+the e4m3 model is a multiply (A row B row): worst error 3.16e-07 of the magnitude sum
+the e4m3 model is a multiply (A col B row): worst error 3.17e-07 of the magnitude sum
+the e4m3 model is a multiply (A row B col): worst error 2.44e-07 of the magnitude sum
+the e4m3 model is a multiply (A col B col): worst error 2.58e-07 of the magnitude sum
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 116 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 20 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 48 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 20 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 108 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 84 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 84 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 32, 116 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 4, 48 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 108 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 84 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 84 gprs
+simulator bf16 rt 2 ct 4 wm 2 wn 2: 40 multiplies, 0 wrong
+simulator bf16 rt 1 ct 1 wm 1 wn 1: 10 multiplies, 0 wrong
+simulator bf16 rt 4 ct 1 wm 1 wn 4: 10 multiplies, 0 wrong
+simulator e4m3 rt 2 ct 4 wm 2 wn 2: 40 multiplies, 0 wrong
+simulator e4m3 rt 1 ct 1 wm 1 wn 1: 10 multiplies, 0 wrong
+simulator e4m3 rt 4 ct 1 wm 1 wn 4: 10 multiplies, 0 wrong
+simulator red check: bf16 mutant 1 (A row B row) is caught (4095 wrong)
+simulator red check: bf16 mutant 2 (A row B row) is caught (4095 wrong)
+simulator red check: bf16 mutant 3 (A row B row) is caught (4095 wrong)
+simulator red check: bf16 mutant 4 (A row B row) is caught (4095 wrong)
+simulator red check: bf16 mutant 4 (A col B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 1 (A row B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 2 (A row B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 3 (A row B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 4 (A row B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 4 (A col B row) is caught (4095 wrong)
+C3 gemm sim: PASS (188 checks)
+exit 0
diff --git a/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /03-sim-mutant4-disabled.log b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /03-sim-mutant4-disabled.log
new file mode 100644
index 000000000 ..b3566372c
--- /dev/null
+++ b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /03-sim-mutant4-disabled.log
@@ -0,0 +1,64 @@
+commit b232bc84 with one line changed and not committed: src/omega_gpu_gemm.c mutant 4 test 'c->mutant == 4' replaced by 'c->mutant == 99' (mutant 4 does nothing)
+purpose: show the wrong-transpose red check is live: with mutant 4 a no-op it must FAIL
+command: build/c3n/gpu_gemm_test --sim
+---
+the bf16 model is a multiply (A row B row): worst error 3.81e-07 of the magnitude sum
+the bf16 model is a multiply (A col B row): worst error 5.42e-07 of the magnitude sum
+the bf16 model is a multiply (A row B col): worst error 5.77e-07 of the magnitude sum
+the bf16 model is a multiply (A col B col): worst error 4.26e-07 of the magnitude sum
+the e4m3 model is a multiply (A row B row): worst error 3.16e-07 of the magnitude sum
+the e4m3 model is a multiply (A col B row): worst error 3.17e-07 of the magnitude sum
+the e4m3 model is a multiply (A row B col): worst error 2.44e-07 of the magnitude sum
+the e4m3 model is a multiply (A col B col): worst error 2.58e-07 of the magnitude sum
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 4 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 116 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 20 gprs
+bf16 rt 1 ct 1 wm 1 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 48 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 20 gprs
+bf16 rt 4 ct 1 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 108 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 1 ct 4 wm 4 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 84 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+bf16 rt 2 ct 2 wm 1 wn 4 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 0, 84 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 4 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 32, 116 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+e4m3 rt 1 ct 1 wm 1 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 4, 48 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 28 gprs
+e4m3 rt 4 ct 1 wm 2 wn 2 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 108 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 1 ct 4 wm 4 wn 1 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 84 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 0 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 1 mutant 0: codegen 0, encode 0, qmma patches 0, 40 gprs
+e4m3 rt 2 ct 2 wm 1 wn 4 kernel 2 mutant 0: codegen 0, encode 0, qmma patches 16, 84 gprs
+simulator bf16 rt 2 ct 4 wm 2 wn 2: 40 multiplies, 0 wrong
+simulator bf16 rt 1 ct 1 wm 1 wn 1: 10 multiplies, 0 wrong
+simulator bf16 rt 4 ct 1 wm 1 wn 4: 10 multiplies, 0 wrong
+simulator e4m3 rt 2 ct 4 wm 2 wn 2: 40 multiplies, 0 wrong
+simulator e4m3 rt 1 ct 1 wm 1 wn 1: 10 multiplies, 0 wrong
+simulator e4m3 rt 4 ct 1 wm 1 wn 4: 10 multiplies, 0 wrong
+simulator red check: bf16 mutant 1 (A row B row) is caught (4095 wrong)
+simulator red check: bf16 mutant 2 (A row B row) is caught (4095 wrong)
+simulator red check: bf16 mutant 3 (A row B row) is caught (4095 wrong)
+FAIL: simulator red check: bf16 mutant 4 (A row B row) is caught (0 wrong)
+simulator red check: bf16 mutant 4 (A row B row) is caught (0 wrong)
+FAIL: simulator red check: bf16 mutant 4 (A col B row) is caught (0 wrong)
+simulator red check: bf16 mutant 4 (A col B row) is caught (0 wrong)
+simulator red check: e4m3 mutant 1 (A row B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 2 (A row B row) is caught (4095 wrong)
+simulator red check: e4m3 mutant 3 (A row B row) is caught (4095 wrong)
+FAIL: simulator red check: e4m3 mutant 4 (A row B row) is caught (0 wrong)
+simulator red check: e4m3 mutant 4 (A row B row) is caught (0 wrong)
+FAIL: simulator red check: e4m3 mutant 4 (A col B row) is caught (0 wrong)
+simulator red check: e4m3 mutant 4 (A col B row) is caught (0 wrong)
+C3 gemm sim: FAIL (4 of 188)
+exit 1
diff --git a/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /README.md b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /README.md
new file mode 100644
index 000000000 ..e5a852453
--- /dev/null
+++ b/evidence/C3-GEMM-WRONG-TRANSPOSE-b232bc84 /README.md
@@ -0,0 +1,22 @@
+# C3 GEMM: wrong-transpose negative control (DRA-485)
+
+DRA-485 asks that a wrong-transpose mutant fail. Mutant 4 does this. The driver
+(`omega_gpu_gemm_drive`) packs A with the strides of the other layout, so a
+row-major A is read as column-major, and the other way round. Every element it
+reads stays inside A. The kernels do not change.
+
+| Log | What it checks | Result |
+|---|---|---|
+| 01-host-only | the earlier host checks, plus codegen and encode with mutant 4 for every tile shape and both types | PASS, 166 checks |
+| 02-sim | the earlier simulator checks, plus mutant 4 caught both ways (A row-major and A column-major), BF16 and FP8 | PASS, 188 checks; mutant 4 makes 4,095 of 4,095 outputs wrong |
+| 03-sim-mutant4-disabled | the control of the control: with mutant 4 turned into a no-op (tree not clean, stated in the log) the four new red checks fail | FAIL, 4 of 188, as expected |
+| chip | 208 shapes (26 per type and layout, 1 to 8192), the red checks with mutant 4, speed against 115.36 TFLOPS (BF16) and 237.52 TFLOPS (FP8) | NOT_RUN: needs a GB10 window |
+
+Where it ran: x86_64, `aarch64-linux-gnu-gcc` 13.3, `qemu-aarch64` user mode,
+physics-mv at `physics.lock` (048e5f5e ). This is a host and emulator result.
+It is not hardware qualification.
+
+Known limit of the chip tier, as written: shapes over 2^27 multiply-adds are
+compared on 4,096 sampled elements plus the last row and column, not in full.
+
+Chip command, under the GB10 lock in an authorized window: `build/gpu_gemm_test` with no flag.
diff --git a/src/omega_gpu_gemm.c b/src/omega_gpu_gemm.c
index 42b47a7d6 ..a3cac2c5c 100644
--- a/src/omega_gpu_gemm.c
+++ b/src/omega_gpu_gemm.c
@@ -22,7 +22,7 @@ void omega_gpu_gemm_default_cfg(OmegaGpuGemmType type, OmegaGemmCfg *cfg) {
int omega_gpu_gemm_cfg_ok(const OmegaGemmCfg *c) {
return c && (c->type == OMEGA_GPU_GEMM_BF16 || c->type == OMEGA_GPU_GEMM_E4M3) && pow124(c->rt) && pow124(c->ct) &&
- pow124(c->wm) && pow124(c->wn) && c->stall >= 1u && c->stall <= 15u && c->mutant >= 0 && c->mutant <= 3 &&
+ pow124(c->wm) && pow124(c->wn) && c->stall >= 1u && c->stall <= 15u && c->mutant >= 0 && c->mutant <= 4 &&
4u * (4u * c->rt + 2u * c->ct + c->rt * c->ct) <= 100u; /* registers: two operand sets + accumulators, R2..R127 in all */
}
@@ -237,7 +237,8 @@ int omega_gpu_gemm_drive(const OmegaGemmCfg *c, unsigned layout, uint32_t M, uin
/* A element (m, k): row-major m K + k, column-major k M + m */
memset(a, 0, sizeof a);
put64(a, 0, a_va); put64(a, 2, ap_va); a[4] = M; a[5] = K;
- a[6] = layout & OMEGA_GPU_GEMM_A_COL ? 1u : K; a[7] = layout & OMEGA_GPU_GEMM_A_COL ? M : 1u; a[8] = p.KS2;
+ const unsigned acol = (layout & OMEGA_GPU_GEMM_A_COL) ^ (c->mutant == 4 ? OMEGA_GPU_GEMM_A_COL : 0u); /* 4: wrong transpose */
+ a[6] = acol ? 1u : K; a[7] = acol ? M : 1u; a[8] = p.KS2;
if (launch(ctx, OMEGA_GEMM_K_PACK_A, a, p.grid[0][0], p.grid[0][1], p.threads[0]) != 0) return OMEGA_GPU_GEMM_CHIP_FAIL;
/* B element (k, n) as packed row n: row-major k N + n, column-major n K + k */
memset(a, 0, sizeof a);
diff --git a/src/omega_gpu_gemm.h b/src/omega_gpu_gemm.h
index 66a6b0485 ..3663d3ef4 100644
--- a/src/omega_gpu_gemm.h
+++ b/src/omega_gpu_gemm.h
@@ -50,7 +50,8 @@ typedef enum { OMEGA_GEMM_K_PACK_A = 0, OMEGA_GEMM_K_PACK_B, OMEGA_GEMM_K_MAIN,
* with 4 (4 rt + 2 ct + rt ct) <= 100 (the registers of two operand sets and the accumulators; rt 2 ct 4 is the largest),
* stall: issue cycles after each tensor-core op (1 .. 15).
* mutant (red checks): 1 MAIN drops the second step of every k pair, 2 the packs let element 0 in past the edges (instead of zero),
- * 3 MAIN stores each column pair swapped. */
+ * 3 MAIN stores each column pair swapped, 4 the driver packs A with the other layout's strides (a wrong transpose: row-major
+ * read as column-major and back; every element read stays inside A). */
typedef struct { OmegaGpuGemmType type; uint32_t rt, ct, wm, wn, stall; int mutant; } OmegaGemmCfg;
void omega_gpu_gemm_default_cfg(OmegaGpuGemmType type, OmegaGemmCfg *cfg);
int omega_gpu_gemm_cfg_ok(const OmegaGemmCfg *cfg);
diff --git a/tests/gpu_gemm_test.c b/tests/gpu_gemm_test.c
index b60f70964 ..bafdf87a3 100644
--- a/tests/gpu_gemm_test.c
+++ b/tests/gpu_gemm_test.c
@@ -4,7 +4,7 @@
* --host-only no device: refusals, every kernel (both types, several shapes of tile, the red-check mutants) through our
* code generator and encoder, register counts
* --sim the real kernels in the warp simulator (tensor-core ops computed with the chip-exact models), small shapes
- * over every edge case, all four layouts, three tile configurations; the three mutants must be caught
+ * over every edge case, all four layouts, three tile configurations; the four mutants must be caught
* (no flag) the GB10: at least 200 shapes with M, N, K from 1 to 8192, both types, all four layouts. Every output word
* must be written; shapes up to 2^27 multiply-adds are compared in full, larger ones on 4096 sampled
* elements plus the last row and column. Speed: 2 M N K / kernel time, as a fraction of the measured
@@ -130,7 +130,7 @@ static void host_only(void) {
check(!omega_gpu_gemm_cfg_ok(&big), "a tile past the register budget (rt 4 ct 2) refused");
for (int t = 0; t < 2; t++)
for (size_t s = 0; s < sizeof shapes / sizeof shapes[0]; s++)
- for (int mut = 0; mut <= 3; mut++)
+ for (int mut = 0; mut <= 4; mut++)
for (int k = 0; k < OMEGA_GEMM_K_COUNT; k++) {
OmegaGemmCfg c = shapes[s]; c.type = (OmegaGpuGemmType)t; c.mutant = mut;
BlackwellIRProgram *p = calloc(1, sizeof *p);
@@ -232,14 +232,15 @@ static void sim_tier(void) {
}
/* red checks: each mutant must change a result the real kernels get right */
for (int t = 0; t < 2; t++)
- for (int mut = 1; mut <= 3; mut++) {
+ for (int mut = 1; mut <= 4; mut++)
+ for (unsigned lay = 0; lay < (mut == 4 ? 2u : 1u); lay++) { /* the wrong transpose both ways: A row- and column-major */
OmegaGemmCfg cfg; omega_gpu_gemm_default_cfg((OmegaGpuGemmType)t, &cfg); cfg.mutant = mut;
SimCtx c; memset(&c, 0, sizeof c);
const uint32_t M = 65, N = 63, K = 100;
fill(cfg.type, A, M * K, 77); fill(cfg.type, B, K * N, 78);
- int built = sim_build(&c, &cfg) == 0, rc = built ? sim_gemm(&c, &cfg, 0, M, N, K, A, B, C) : -1;
- uint64_t checked = 0, bad = rc == 0 ? compare(cfg.type, 0, M, N, K, A, B, C, &checked, first, sizeof first) : 1;
- snprintf(w, sizeof w, "simulator red check: %s mutant %d is caught (%" PRIu64 " wrong)", tname(cfg.type), mut, bad);
+ int built = sim_build(&c, &cfg) == 0, rc = built ? sim_gemm(&c, &cfg, lay, M, N, K, A, B, C) : -1;
+ uint64_t checked = 0, bad = rc == 0 ? compare(cfg.type, lay, M, N, K, A, B, C, &checked, first, sizeof first) : 1;
+ snprintf(w, sizeof w, "simulator red check: %s mutant %d (%s) is caught (%" PRIu64 " wrong)", tname(cfg.type), mut, lname(lay), bad);
check(built && bad > 0, w);
printf("%s\n", w);
sim_free(&c);
@@ -300,14 +301,15 @@ static void chip_tier(int quick) {
}
printf("%d shapes, both types, all four layouts: %s\n", shapes, g_failed == before ? "PASS" : "FAIL");
for (int t = 0; t < 2; t++)
- for (int mut = 1; mut <= 3; mut++) {
+ for (int mut = 1; mut <= 4; mut++)
+ for (unsigned lay = 0; lay < (mut == 4 ? 2u : 1u); lay++) { /* the wrong transpose both ways: A row- and column-major */
OmegaGemmCfg cfg; omega_gpu_gemm_default_cfg((OmegaGpuGemmType)t, &cfg); cfg.mutant = mut;
omega_gpu_gemm_test_set_cfg((OmegaGpuGemmType)t, &cfg);
const uint32_t M = 65, N = 63, K = 100;
fill((OmegaGpuGemmType)t, A, M * K, 77); fill((OmegaGpuGemmType)t, B, K * N, 78);
- int rc = omega_gpu_gemm((OmegaGpuGemmType)t, 0, M, N, K, A, B, C, NULL);
- char first[200]; uint64_t checked = 0, bad = rc == 0 ? compare((OmegaGpuGemmType)t, 0, M, N, K, A, B, C, &checked, first, sizeof first) : 1;
- snprintf(w, sizeof w, "chip red check: %s mutant %d is caught (%s, %" PRIu64 " wrong)", tname((OmegaGpuGemmType)t), mut, omega_gpu_gemm_rc_name(rc), bad);
+ int rc = omega_gpu_gemm((OmegaGpuGemmType)t, lay, M, N, K, A, B, C, NULL);
+ char first[200]; uint64_t checked = 0, bad = rc == 0 ? compare((OmegaGpuGemmType)t, lay, M, N, K, A, B, C, &checked, first, sizeof first) : 1;
+ snprintf(w, sizeof w, "chip red check: %s mutant %d (%s) is caught (%s, %" PRIu64 " wrong)", tname((OmegaGpuGemmType)t), mut, lname(lay), omega_gpu_gemm_rc_name(rc), bad);
check(bad > 0, w);
printf("%s\n", w);
omega_gpu_gemm_test_set_cfg((OmegaGpuGemmType)t, NULL);