interplane.Get Omega
Read in your language

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

GitHub aien-dev/omega-mv#414 (code only)

closed derived bbe1b51e17195db5 #414

Imported from GitHub aien-dev/omega-mv#414 (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 dec2577dc71b5d732f1db0fae53575c77d488c9b · Head da70c11659114cbd15dfde00c1989ec664c85ec5

Apply it

git checkout -b patch-bbe1b51e17195db5 dec2577dc71b5d732f1db0fae53575c77d488c9b
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/bbe1b51e17195db5.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
aien-dev/omega-mv
414
da70c11659114cbd15dfde00c1989ec664c85ec5
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":414,"url":"https://github.com/aien-dev/omega-mv/pull/414","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:48Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index f7901259d..efa8c4af6 100644
--- a/.crumb
+++ b/.crumb
@@ -87,14 +87,14 @@
           "purpose": "Directory spec. Purpose not yet described by a human."
         },
         {
-          "digest": "7f1978d218d30126cc74ab22cfd18fe2283632fec4ba3518685dc3e5121c03e0",
-          "last_commit": "32a2a62a",
+          "digest": "6866b462635e41fb7045ee33236c6d7676b7f94bfa2c2425c188c3a49191a536",
+          "last_commit": "1a046294",
           "name": "src",
           "purpose": "Directory src. Purpose not yet described by a human."
         },
         {
-          "digest": "ba0c62a71a9a3f069b7afd3ea71d0900f34321f2e5b0f55bad347c9487879fef",
-          "last_commit": "32a2a62a",
+          "digest": "22f878591818477beba38c4e25f728466378d021d42e9ebcc92a98ce9bcbf90a",
+          "last_commit": "1a046294",
           "name": "tests",
           "purpose": "Directory tests. Purpose not yet described by a human."
         },
@@ -105,15 +105,15 @@
           "purpose": "Directory tools. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:b68cc59a22835e3342cddb4d6607df0352f62a5d17dc5b2fc19177c306dc325f",
-      "compiled_at": "2026-10-12T09:36:47Z",
+      "children_root": "sha256:3af1f55dae3a48e4a3251b801e8ea925eaf92ae993866f3d0649c21fe508deba",
+      "compiled_at": "2026-10-12T10:11:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:6bfafa6e43ae0a9cf9fe7a5f69a3f62cd94203c9651ecbbbc7900c50d7e96317",
+      "digest": "sha256:dd0902f85300b818a1dc55ce4c44d88c9a246d32fe937e1035e165105a6c8417",
       "evidence_files": 7245,
       "evidence_root": "sha256:035beef5cdb99afaefd1743640f5e7eeaaed13c4a5ec6c8b4b6a4cb0c528407a",
       "files": 9734,
-      "generated_at_commit": "32a2a62a7b2d306884cd58743bfa51917dff3487",
-      "source_tree": "sha256:8a5db9e1d0a438a9157e8dc683ed598af1f24528eca38df120281da4ab943ea4"
+      "generated_at_commit": "1a0462947b0845211e7bca512e8f87e25378dc39",
+      "source_tree": "sha256:e2a8d323504ab4975d03e2689d316512157a84829aef0212d6a967c6f9a9599c"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/.crumb b/src/.crumb
index 35d6d1e0c..a3210f65c 100644
--- a/src/.crumb
+++ b/src/.crumb
@@ -176,14 +176,14 @@
         }
       ],
       "children_root": "sha256:2f64d32b2351272f4de10e1143efdb74dbc3cae56b1f0a3039ca9edcfebf6e8c",
-      "compiled_at": "2026-10-12T09:36:47Z",
+      "compiled_at": "2026-10-12T10:11:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:7f1978d218d30126cc74ab22cfd18fe2283632fec4ba3518685dc3e5121c03e0",
+      "digest": "sha256:6866b462635e41fb7045ee33236c6d7676b7f94bfa2c2425c188c3a49191a536",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 451,
-      "generated_at_commit": "32a2a62a7b2d306884cd58743bfa51917dff3487",
-      "source_tree": "sha256:dc5a78fedde575600c2669e18b3319b95a2a7df44e50ef34203aa3340a5e9216"
+      "generated_at_commit": "1a0462947b0845211e7bca512e8f87e25378dc39",
+      "source_tree": "sha256:a40437c6b2b7fbd24c04d37c59f7da04b2d1fffe5ae78db786c3b7c042bb357a"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/omega_blackwell_codegen.c b/src/omega_blackwell_codegen.c
index 62efccaa9..2667257c8 100644
--- a/src/omega_blackwell_codegen.c
+++ b/src/omega_blackwell_codegen.c
@@ -2182,6 +2182,23 @@ void omega_matmul_frag_pack_a_f32(const float *a, uint32_t m, uint32_t k, uint32
 void omega_matmul_frag_pack_a_row0(const uint16_t *a, uint32_t k, uint32_t kp, uint16_t *dst) {
     FRAG_PACK_A_ROW0_BODY(FRAG_ID);
 }
+size_t omega_matmul_result_sentinels(float *cd, uint32_t m, uint32_t n, uint32_t np, float poison, int set) {
+    /* one word per 16 x 8 fragment tile that holds a real output word: the tile's last real row and column */
+    size_t count = 0;
+    if (m == 0 || n == 0) return 0;
+    const uint32_t mt = (m + 15u) / 16u, nt = (n + 7u) / 8u;
+    for (uint32_t ti = 0; ti < mt; ti++) {
+        uint32_t r = ti * 16u + 15u; if (r >= m) r = m - 1u;
+        float *row = cd + (size_t)r * np;
+        for (uint32_t tj = 0; tj < nt; tj++) {
+            uint32_t c = tj * 8u + 7u; if (c >= n) c = n - 1u;
+            if (set) { row[c] = poison; count++; }
+            else if (row[c] == poison) count++;
+        }
+    }
+    return count;
+}
+
 void omega_matmul_frag_pack_a_row0_f32(const float *a, uint32_t k, uint32_t kp, uint16_t *dst) {
     FRAG_PACK_A_ROW0_BODY(frag_f32_to_bf16);
 }
diff --git a/src/omega_blackwell_codegen.h b/src/omega_blackwell_codegen.h
index b1baf21b1..d8e520134 100644
--- a/src/omega_blackwell_codegen.h
+++ b/src/omega_blackwell_codegen.h
@@ -256,6 +256,12 @@ void omega_matmul_frag_pack_a_f32(const float *a, uint32_t m, uint32_t k, uint32
  * zeros past k); the caller tracks that the zeros are there (omega_gpu_matmul_api.c, m = 1 path). */
 void omega_matmul_frag_pack_a_row0(const uint16_t *a, uint32_t k, uint32_t kp, uint16_t *dst);
 void omega_matmul_frag_pack_a_row0_f32(const float *a, uint32_t k, uint32_t kp, uint16_t *dst);
+/* Result sentinels (host side of the poison check): one word per 16 x 8 fragment tile that holds a real
+ * output word, at the tile's last real row and column, in the row-major m x np result. set != 0 writes
+ * poison into every sentinel and returns their count; set == 0 returns how many still hold poison. The
+ * kernel's epilogue stores a fragment tile as one straight-line run of STG.E words, so a tile whose
+ * sentinel survived was never stored. */
+size_t omega_matmul_result_sentinels(float *cd, uint32_t m, uint32_t n, uint32_t np, float poison, int set);
 /* b: k x n row-major. dst: the column tiles [nt0, nt1), (nt1 - nt0) * kp * 8 elements, fully
  * written; it is the part of the packed tensor starting at element nt0 * kp * 8. */
 void omega_matmul_frag_pack_b(const uint16_t *b, uint32_t k, uint32_t n, uint32_t kp,
diff --git a/src/omega_gpu_matmul_api.c b/src/omega_gpu_matmul_api.c
index 907ccb19c..b9f4944c3 100644
--- a/src/omega_gpu_matmul_api.c
+++ b/src/omega_gpu_matmul_api.c
@@ -415,8 +415,12 @@ static int matmul_core(uint32_t m, const uint16_t *a16, const float *a32, const
         else omega_matmul_frag_pack_a(a16, m, k, mp, kp, ad);
         g.a_row0_ready = one_row; g.a_row0_kp = kp; g.a_row0_cpu = ad;
     }
+    /* result sentinels: one poison word per 16 x 8 fragment tile holding a real output word, at the tile's
+     * last real row and column (omega_matmul_result_sentinels). The kernel stores a tile as one straight-line
+     * run of STG.E words, so a tile whose sentinel survives was never stored. Poisoning and scanning every
+     * word was three passes over m x np (12.6 MB at m = 128, n = 24576: about 2 ms per prefill call, 2026-10-12). */
     float *cd = g.c_buf.mem.cpu;
-    for (size_t i = 0; i < (size_t)m * np; i++) cd[i] = POISON_F32;
+    omega_matmul_result_sentinels(cd, m, n, np, POISON_F32, 1);
     __asm__ volatile("dsb sy" ::: "memory");
 
     for (uint32_t r0 = 0; r0 < mp && rc == OMEGA_GPU_MATMUL_OK; r0 += rows_per_launch) {
@@ -431,14 +435,10 @@ static int matmul_core(uint32_t m, const uint16_t *a16, const float *a32, const
         if (info) info->chip_calls++;
     }
     if (rc == OMEGA_GPU_MATMUL_OK) {
-        /* the chip must have written every real output word (poison check, as the engine does) */
-        size_t unchanged = 0;
-        for (uint32_t r = 0; r < m; r++) {
-            const float *row = &cd[(size_t)r * np];
-            for (uint32_t j = 0; j < n; j++) if (row[j] == POISON_F32) unchanged++;
-            memcpy(&c[(size_t)r * n], row, (size_t)n * sizeof *c);
-        }
+        /* the chip must have stored every fragment tile with a real output word (sentinel check) */
+        size_t unchanged = omega_matmul_result_sentinels(cd, m, n, np, POISON_F32, 0);
         if (unchanged && FAILAT("output poison survived")) rc = OMEGA_GPU_MATMUL_CHIP_FAIL;
+        else for (uint32_t r = 0; r < m; r++) memcpy(&c[(size_t)r * n], &cd[(size_t)r * np], (size_t)n * sizeof *c);
     }
     omega_gpu_session_unlock();
     return rc;
diff --git a/tests/.crumb b/tests/.crumb
index 83acdba42..61851786f 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -290,14 +290,14 @@
         }
       ],
       "children_root": "sha256:9597c068d5bf4eb27f1d91842813a2b10269c2ccae421dceefb4308030ec0fc2",
-      "compiled_at": "2026-10-12T09:36:47Z",
+      "compiled_at": "2026-10-12T10:11:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ba0c62a71a9a3f069b7afd3ea71d0900f34321f2e5b0f55bad347c9487879fef",
+      "digest": "sha256:22f878591818477beba38c4e25f728466378d021d42e9ebcc92a98ce9bcbf90a",
       "evidence_files": 16,
       "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a",
       "files": 1024,
-      "generated_at_commit": "32a2a62a7b2d306884cd58743bfa51917dff3487",
-      "source_tree": "sha256:411a0a7092a3167a5049fd52829df6d07bec1c0214c27b4e279757b709cfc726"
+      "generated_at_commit": "1a0462947b0845211e7bca512e8f87e25378dc39",
+      "source_tree": "sha256:69eb424bc661f3ddadbc6abd791bf3f2f38d560a96e20bab4817894b49c915a6"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/gpu_matmul_api_test.c b/tests/gpu_matmul_api_test.c
index c987a60c1..427f3c605 100644
--- a/tests/gpu_matmul_api_test.c
+++ b/tests/gpu_matmul_api_test.c
@@ -64,7 +64,40 @@ static double e2e_max_rel(uint32_t m, uint32_t k, uint32_t n, const float *a, co
  * table for mma.m16n8k16 (.bf16 A: a0,a1 row g cols 2t,2t+1; a2,a3 row g+8; a4,a5 row g cols
  * 2t+8,2t+9; a6,a7 row g+8. B: b0,b1 rows 2t,2t+1 col g; b2,b3 rows 2t+8,2t+9; g = lane>>2,
  * t = lane&3), independently of the packers: pack then unpack must give the matrix back. */
+/* Result sentinels: one poison word per 16 x 8 fragment tile that holds a real output word, inside the
+ * tile's real rows and columns; the scan counts exactly the survivors. */
+static void sentinel_host_checks(void) {
+    static const uint32_t shapes[][2] = { { 1u, 24576u }, { 1u, 4096u }, { 16u, 151936u }, { 128u, 24576u }, { 116u, 4096u }, { 3u, 20u }, { 17u, 9u } };
+    const float poison = -999.0f;
+    for (size_t s = 0; s < sizeof shapes / sizeof shapes[0]; s++) {
+        const uint32_t m = shapes[s][0], n = shapes[s][1], mp = (m + 15u) / 16u * 16u, np = (n + 7u) / 8u * 8u;
+        const uint32_t mt = (m + 15u) / 16u, nt = (n + 7u) / 8u;
+        float *cd = calloc((size_t)mp * np, sizeof *cd);
+        const size_t set = omega_matmul_result_sentinels(cd, m, n, np, poison, 1);
+        CHECK(set == (size_t)mt * nt, "sentinel count m=%u n=%u: %zu != %u", m, n, set, mt * nt);
+        /* every fragment tile with a real word holds exactly one sentinel, inside its real rows and columns */
+        size_t tiles_ok = 0, outside = 0;
+        for (uint32_t ti = 0; ti < mt; ti++)
+            for (uint32_t tj = 0; tj < nt; tj++) {
+                size_t in_tile = 0;
+                for (uint32_t r = ti * 16u; r < ti * 16u + 16u; r++)
+                    for (uint32_t c = tj * 8u; c < tj * 8u + 8u; c++)
+                        if (cd[(size_t)r * np + c] == poison) { if (r < m && c < n) in_tile++; else outside++; }
+                if (in_tile == 1) tiles_ok++;
+            }
+        CHECK(tiles_ok == (size_t)mt * nt && outside == 0, "sentinel placement m=%u n=%u: %zu tiles ok, %zu outside", m, n, tiles_ok, outside);
+        CHECK(omega_matmul_result_sentinels(cd, m, n, np, poison, 0) == set, "sentinel scan m=%u n=%u: all survive", m, n);
+        /* clearing one tile's sentinel removes exactly one survivor; a fully written result has none */
+        cd[(size_t)(m - 1u) * np + (n - 1u)] = 0.0f;
+        CHECK(omega_matmul_result_sentinels(cd, m, n, np, poison, 0) == set - 1u, "sentinel scan m=%u n=%u: one cleared", m, n);
+        for (size_t i = 0; i < (size_t)mp * np; i++) cd[i] = 1.5f;
+        CHECK(omega_matmul_result_sentinels(cd, m, n, np, poison, 0) == 0, "sentinel scan m=%u n=%u: none survive", m, n);
+        free(cd);
+    }
+}
+
 static void frag_host_checks(void) {
+    sentinel_host_checks();
     /* row-0 pack (one-row decode call): a full one-row pack of A2 equals a full pack of A1 followed by the
      * row-0 pack of A2, bf16 and f32 inputs, including a width with padding columns */
     {