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#417 (code only)

closed derived e9ca276829d91586 #417

Imported from GitHub aien-dev/omega-mv#417 (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 d708443c38ec8f3e26b660f0049d629464270071 · Head d935cba97c6cc5d9c8a0a40643050e7c4ba62bce

Apply it

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

Changes

diff --git a/.crumb b/.crumb
index 9d6ad9b02..ddf62fec4 100644
--- a/.crumb
+++ b/.crumb
@@ -52,7 +52,7 @@
         },
         {
           "digest": "06530caf3f6710cdfc333d10a8e8c702571372e0926768b44396f9f971ca7573",
-          "last_commit": "e04bd502",
+          "last_commit": "d708443c",
           "name": "docs",
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
@@ -64,7 +64,7 @@
         },
         {
           "digest": "09ea357529c7b5ad670bb41f2663e4d11210c1e71d493cded07cf6bc5dd79686",
-          "last_commit": "e04bd502",
+          "last_commit": "d708443c",
           "name": "mk",
           "purpose": "Directory mk. Purpose not yet described by a human."
         },
@@ -87,33 +87,33 @@
           "purpose": "Directory spec. Purpose not yet described by a human."
         },
         {
-          "digest": "929078f81753cba5bcf364be0c4da936d8cdff4b879ca6eccf8cbea7724a5b6c",
-          "last_commit": "e04bd502",
+          "digest": "57b39eeb7e7025692fa160cc839afbcd7d2e89704768ee50a82c0de0a0974550",
+          "last_commit": "697f5d0f",
           "name": "src",
           "purpose": "Directory src. Purpose not yet described by a human."
         },
         {
-          "digest": "38c14347e7f7885f0858c2e66c9cb8d029ad128c80cc84818ceda5e7d77de7e3",
-          "last_commit": "e04bd502",
+          "digest": "ac28446243900e9c337b343cf49932a4ef49c065bed02a6438109b028f10bd2a",
+          "last_commit": "697f5d0f",
           "name": "tests",
           "purpose": "Directory tests. Purpose not yet described by a human."
         },
         {
           "digest": "285407d8f7949613c6b57b225fa50b2bb076aaa874fded0895d82fbf285fb832",
-          "last_commit": "e04bd502",
+          "last_commit": "d708443c",
           "name": "tools",
           "purpose": "Directory tools. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:94c91b7a592ba075701e2dadb839f65ae1e99b7860fac9f99cd672d7aaf76609",
-      "compiled_at": "2026-10-12T10:51:44Z",
+      "children_root": "sha256:7b0f76f2d864c3397c600c21e2aa0dbd318bb534ef54856576fa8109667a64c9",
+      "compiled_at": "2026-10-12T11:07:56Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:49bfa3ca7946ce21bc4a18c54462583f9878efb4a68378a7cc0273752561797d",
+      "digest": "sha256:cb2ddf071e34281b0289f6fee7fca45ad91a72d2ab530486287e6abcf9374630",
       "evidence_files": 7245,
       "evidence_root": "sha256:035beef5cdb99afaefd1743640f5e7eeaaed13c4a5ec6c8b4b6a4cb0c528407a",
       "files": 9738,
-      "generated_at_commit": "e04bd5021b2a4f311fb9838887c170c4bf3164b6",
-      "source_tree": "sha256:b284014f1bbef6f8add13b7a17b7c2d5fdbc81a1072d591e0f434df7b119fadd"
+      "generated_at_commit": "697f5d0fb1d011a7625e5be897270447d6aaddec",
+      "source_tree": "sha256:934e9338228fbf4df3a6237525ab9e7d7d16d09d3eec58ffb8cb639d2282fb0a"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/.crumb b/src/.crumb
index 2ee5036fa..07f6ce488 100644
--- a/src/.crumb
+++ b/src/.crumb
@@ -176,14 +176,14 @@
         }
       ],
       "children_root": "sha256:2f64d32b2351272f4de10e1143efdb74dbc3cae56b1f0a3039ca9edcfebf6e8c",
-      "compiled_at": "2026-10-12T10:51:44Z",
+      "compiled_at": "2026-10-12T11:07:56Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:929078f81753cba5bcf364be0c4da936d8cdff4b879ca6eccf8cbea7724a5b6c",
+      "digest": "sha256:57b39eeb7e7025692fa160cc839afbcd7d2e89704768ee50a82c0de0a0974550",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 453,
-      "generated_at_commit": "e04bd5021b2a4f311fb9838887c170c4bf3164b6",
-      "source_tree": "sha256:80e3c17915d31b2335f9bfde5d01021fe1c847778292891337f80f622748d18b"
+      "generated_at_commit": "697f5d0fb1d011a7625e5be897270447d6aaddec",
+      "source_tree": "sha256:96ef4c2d69e68689e61aab88512fd6258482c7d1b0fe944e1e42cee3eaf651e4"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/omega_blackwell_codegen.h b/src/omega_blackwell_codegen.h
index d8e520134..780c5cace 100644
--- a/src/omega_blackwell_codegen.h
+++ b/src/omega_blackwell_codegen.h
@@ -6,8 +6,8 @@
 #include <stdint.h>
 #include "omega_blackwell_matmul.h"
 
-#define BW_MAX_IR_INSNS         512
-#define BW_MAX_VREGS            128
+#define BW_MAX_IR_INSNS         1024 /* cut K: the four-head hd 128 attention kernel is ~700 instructions */
+#define BW_MAX_VREGS            256
 #define BW_MAX_UVREGS           32
 #define BW_PHYS_GPR_START       2    /* Reserve R0, R1 */
 #define BW_PHYS_GPR_MAX         128
diff --git a/src/omega_gpu_attention_api.c b/src/omega_gpu_attention_api.c
index fcc554d7a..52a26dc28 100644
--- a/src/omega_gpu_attention_api.c
+++ b/src/omega_gpu_attention_api.c
@@ -268,9 +268,22 @@ typedef struct { bool f32; uint32_t log2bs, log2gqa; int mutant; int divergent;
  * an unnormalised partial (acc[hd], running max, running sum; an empty slice writes acc 0, max -inf) and the host
  * combines them, also when split == 0. */
 
+/* cut K (2026-10-12, GQA group): at head_dim 128 one CTA serves the GC query heads of one kv head, GC =
+ * min(2^log2gqa, 4), so every K and V byte of a launch is read once instead of once per query head. The KV
+ * pool is GPU-uncached (host-written), so the four CTAs of a GQA group were four DRAM reads of the same
+ * bytes: 21 MB per call at 1268 tokens, the memory ceiling (sc leg smoke-ctx-chunk: 152 us per call).
+ * Grid x is the head group (num_q_heads / GC CTAs per sequence and split). Shared memory: q, scores and
+ * warp partials per head, token offsets once. GC = 1 (every hd 64 kernel, hd 128 with gqa 1) emits exactly
+ * the program before this cut (digest fixtures). */
+static uint32_t heads_per_cta(uint32_t hd, uint32_t log2gqa) { return hd == 128u ? (1u << (log2gqa < 2u ? log2gqa : 2u)) : 1u; }
+static uint32_t shared_bytes_for(uint32_t hd, uint32_t log2gqa) { return (3u * heads_per_cta(hd, log2gqa) + 1u) * hd * 4u; }
+uint32_t omega_gpu_attention_heads_per_cta(uint32_t head_dim, uint32_t log2_gqa) { return heads_per_cta(head_dim, log2_gqa); }
+
 static void gen_attention(Em *e, const KSpec *k) {
     const uint32_t elem = k->f32 ? 4u : 2u;
-    const uint32_t HD = k->hd, SH_S = HD * 4u, SH_O = HD * 8u, SH_R = HD * 12u; /* warps per CTA: HD / 32 */
+    const uint32_t HD = k->hd, GC = heads_per_cta(HD, k->log2gqa), log2gc = GC == 4u ? 2u : GC == 2u ? 1u : 0u;
+    const uint32_t HB = HD * 4u; /* bytes of one per-head shared array */
+    const uint32_t SH_S = GC * HB, SH_O = 2u * GC * HB, SH_R = SH_O + HB; /* warps per CTA: HD / 32 */
     int udesc = UV64(e), A = V64(e), B = V64(e), C = V64(e), D = V64(e);
     int tid = V(e), h = V(e), seq = V(e);
     int p_maxb = V(e), scale = V(e), p_bstride = V(e), p_tstride = V(e), p_kvp = V(e), p_hstride = V(e), p_nqh = V(e), p_ctxoff = V(e);
@@ -297,30 +310,46 @@ static void gen_attention(Em *e, const KSpec *k) {
 
     /* q[tid] -> shared; out address kept for the end. Row = seq * num_q_heads + head for
      * both q and out (flattened head-major, the oracle's layout). The head-wiring mutants
-     * swap the row of head h with h ^ 1 on one side only. */
-    int tid4 = V(e), qrow = V(e), qoff = V(e), qaddr = V64(e), qv = V(e), oaddr = V64(e);
+     * swap the row of head h with h ^ 1 on one side only. GC > 1: head g of the group is
+     * h * GC + g; q goes to SH_Q + g * HB; the output rows are derived in the epilogue. */
+    int tid4 = V(e), qrow = V(e), qoff = V(e), qaddr = V64(e), qv = V(e), oaddr = GC == 1 ? V64(e) : -1;
     int hq = h, ho = h;
-    if (k->mutant == OMEGA_GPU_ATTN_MUTANT_Q_ROW) { hq = V(e); lop3xor(e, hq, h, c1); }
-    if (k->mutant == OMEGA_GPU_ATTN_MUTANT_OUT_ROW) { ho = V(e); lop3xor(e, ho, h, c1); }
+    if (GC == 1 && k->mutant == OMEGA_GPU_ATTN_MUTANT_Q_ROW) { hq = V(e); lop3xor(e, hq, h, c1); }
+    if (GC == 1 && k->mutant == OMEGA_GPU_ATTN_MUTANT_OUT_ROW) { ho = V(e); lop3xor(e, ho, h, c1); }
     imadi(e, tid4, tid, 4, NOREG);
-    imadr(e, qrow, seq, p_nqh, hq);
-    imadi(e, qoff, qrow, HD * 4, tid4);
-    wide(e, qaddr, qoff, 1, A);
-    ldg(e, qv, qaddr, udesc);
-    sts32(e, tid4, qv); /* SH_Q + tid*4 */
-    if (!part) { /* direct output address; partial mode derives its row in the epilogue */
-        if (ho == hq) wide(e, oaddr, qoff, 1, C);
-        else {
-            int orow = V(e), ooff = V(e);
-            imadr(e, orow, seq, p_nqh, ho);
-            imadi(e, ooff, orow, HD * 4, tid4);
-            wide(e, oaddr, ooff, 1, C);
+    if (GC == 1) {
+        imadr(e, qrow, seq, p_nqh, hq);
+        imadi(e, qoff, qrow, HD * 4, tid4);
+        wide(e, qaddr, qoff, 1, A);
+        ldg(e, qv, qaddr, udesc);
+        sts32(e, tid4, qv); /* SH_Q + tid*4 */
+        if (!part) { /* direct output address; partial mode derives its row in the epilogue */
+            if (ho == hq) wide(e, oaddr, qoff, 1, C);
+            else {
+                int orow = V(e), ooff = V(e);
+                imadr(e, orow, seq, p_nqh, ho);
+                imadi(e, ooff, orow, HD * 4, tid4);
+                wide(e, oaddr, ooff, 1, C);
+            }
+        }
+    } else {
+        int h0 = V(e), hg = V(e), qsh = V(e);
+        imadi(e, h0, h, GC, NOREG);
+        for (uint32_t g = 0; g < GC; g++) {
+            imadi(e, hg, c1, g, h0);
+            if (k->mutant == OMEGA_GPU_ATTN_MUTANT_Q_ROW) lop3xor(e, hg, hg, c1);
+            imadr(e, qrow, seq, p_nqh, hg);
+            imadi(e, qoff, qrow, HD * 4, tid4);
+            wide(e, qaddr, qoff, 1, A);
+            ldg(e, qv, qaddr, udesc);
+            imadi(e, qsh, c1, g * HB, tid4);
+            sts32(e, qsh, qv);
         }
     }
 
     /* kv head offset, this sequence's table row and context length */
     int kvh = V(e), kvoff = V(e), t1 = V(e), tab = V64(e), ca = V64(e), ctx = V(e), vb = V64(e);
-    shri(e, kvh, h, k->log2gqa);
+    shri(e, kvh, h, k->log2gqa - log2gc); /* GC heads per CTA: kv head = (h * GC) >> log2gqa */
     if (k->mutant == OMEGA_GPU_ATTN_MUTANT_KV_HEAD) lop3xor(e, kvh, kvh, c1);
     imadr(e, kvoff, kvh, p_hstride, NOREG);
     imadr(e, t1, seq, p_maxb, NOREG);
@@ -360,20 +389,31 @@ static void gen_attention(Em *e, const KSpec *k) {
     wide(e, vb, tid, elem, B);
     wide(e, vb, p_kvp, 1, vb);
 
-    int M = V(e), L = V(e), acc = V(e), base = V(e), sOff = V(e), oOff = V(e), rOff = V(e);
-    movi(e, M, F32_NEG_INF);
-    if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) movrz(e, L); else movf(e, L, 1.0f); /* alpha = 0 on the first chunk clears it */
-    movrz(e, acc); if (part) iadd3(e, base, kb, zero); else movrz(e, base);
+    /* running max, sum and accumulator per head of the group (GC = 1: one of each, as before) */
+    int M[4], L[4], acc[4];
+    for (uint32_t g = 0; g < GC; g++) M[g] = V(e);
+    for (uint32_t g = 0; g < GC; g++) L[g] = V(e);
+    for (uint32_t g = 0; g < GC; g++) acc[g] = V(e);
+    int base = V(e), sOff = V(e), oOff = V(e), rOff = V(e);
+    for (uint32_t g = 0; g < GC; g++) movi(e, M[g], F32_NEG_INF);
+    for (uint32_t g = 0; g < GC; g++) { if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) movrz(e, L[g]); else movf(e, L[g], 1.0f); } /* alpha = 0 on the first chunk clears it */
+    for (uint32_t g = 0; g < GC; g++) movrz(e, acc[g]);
+    if (part) iadd3(e, base, kb, zero); else movrz(e, base);
     iadd3(e, sOff, tid4, c256); iadd3(e, oOff, tid4, c512); iadd3(e, rOff, tid4, c768);
     bar_sync(e); /* q visible to every thread */
     if (part) isetp_ge_u32(e, kb, kend); else isetp_ge_u32(e, zero, ctx); /* empty range: out = 0 (an empty partial) */
     int bZ = bra_fwd_if_p0(e);
 
     /* ---------------- chunk loop ---------------- */
-    int j = V(e), s = V(e), koff = V(e);
-    int bi = V(e), sl = V(e), ta = V64(e), blk = V(e), ka = V64(e), dot = V(e), d = V(e);
+    int j = V(e), s[4], koff;
+    for (uint32_t g = 0; g < GC; g++) s[g] = V(e);
+    koff = V(e);
+    int bi = V(e), sl = V(e), ta = V64(e), blk = V(e), ka = V64(e), dot[4], d;
+    for (uint32_t g = 0; g < GC; g++) dot[g] = V(e);
+    d = V(e);
     int lo = V(e), hi = V(e), qa = V(e), j1 = V(e);
     int dneg = V(e), over = V(e), ot = V(e), ctxm1 = V(e), cm1 = V(e), cninf = V(e), nb = V(e), ns = V(e);
+    int tsh = GC > 1 ? V(e) : -1; /* per-head shared address temporary (GC > 1 only) */
     movi(e, cm1, 0xFFFFFFFFu); iadd3(e, ctxm1, lim, cm1); movi(e, cninf, F32_NEG_INF);
     loop_begin(e);
     int Lout = here(e);
@@ -384,7 +424,7 @@ static void gen_attention(Em *e, const KSpec *k) {
      * over = (j >= ctx) as 0/1 from the sign of ctx-1-j; out-of-range lanes read token `base`
      * (always < ctx here) and their score is forced to -inf after the dot product with s = -max(-s, nb), nb = -inf or +inf. */
     iadd3(e, j, base, tid);
-    movi(e, s, F32_NEG_INF);
+    for (uint32_t g = 0; g < GC; g++) movi(e, s[g], F32_NEG_INF);
     movrz(e, koff);
     if (k->divergent) {
         /* omega #308 R2: the lane-dependent branch, inside a reconvergence region. Lanes with
@@ -424,29 +464,33 @@ static void gen_attention(Em *e, const KSpec *k) {
      * bf16, 8 dims f32) with the first half of the matching q slice as 128-bit shared loads on SB_LD2, one
      * wait; then the second half of q, one more (short) wait. The serial loop before paid one global
      * latency per dim pair. Two halves keep the pass inside AT_GPR_BUDGET (the whole slice at once is
-     * 65 to 76 registers). qa = d * 4 is the shared byte offset of q[d]. */
+     * 65 to 76 registers). qa = d * 4 is the shared byte offset of q[d]. GC > 1: the same K pass feeds
+     * every head of the group, each from its own q slice at SH_Q + g * HB (cut K). */
     const uint32_t dims = k->f32 ? 8u : 16u; /* dims per pass: 32 bytes of K either way */
     const uint32_t nq = dims / 4u;           /* q quads per pass, loaded in two halves */
     int kx[2], qq[4];
     kx[0] = V128(e); kx[1] = V128(e);
     for (uint32_t i = 0; i < nq; i++) qq[i] = V128(e);
-    movrz(e, dot); movrz(e, d);
+    for (uint32_t g = 0; g < GC; g++) movrz(e, dot[g]);
+    movrz(e, d);
     loop_begin(e);
     int Lin = here(e);
     imadi(e, qa, d, 4, NOREG);
     ldg128_b(e, kx[0], ka, 0u, udesc, SB_GPR);
     ldg128_b(e, kx[1], ka, 16u, udesc, SB_GPR);
-    for (int h = 0; h < 2; h++) {
-        for (uint32_t i = 0; i < nq / 2u; i++) { uint32_t qi = (uint32_t)h * (nq / 2u) + i; lds128_b(e, qq[qi], qa, qi * 16u, SB_LD2); }
-        if (k->f32) {
-            for (int s = 0; s < 4; s++) e_ffma_s(e, dot, qq[h], s, kx[h], s, dot); /* dim h*4+s */
-        } else {
-            for (int s = 0; s < 4; s++) {
-                int pi = h * 4 + s; /* bf16 pair: dims 2*pi (low half) and 2*pi+1 (high half) */
-                imadi_s(e, lo, kx[h], s, 0x10000u, NOREG);   /* low bf16 -> f32: bits << 16 */
-                lop3andi_s(e, hi, kx[h], s, 0xffff0000u);    /* high bf16 -> f32: keep the top half */
-                e_ffma_s(e, dot, qq[pi / 2], (pi % 2) * 2, lo, 0, dot);
-                e_ffma_s(e, dot, qq[pi / 2], (pi % 2) * 2 + 1, hi, 0, dot);
+    for (uint32_t g = 0; g < GC; g++) {
+        for (int hh = 0; hh < 2; hh++) {
+            for (uint32_t i = 0; i < nq / 2u; i++) { uint32_t qi = (uint32_t)hh * (nq / 2u) + i; lds128_b(e, qq[qi], qa, g * HB + qi * 16u, SB_LD2); }
+            if (k->f32) {
+                for (int s4 = 0; s4 < 4; s4++) e_ffma_s(e, dot[g], qq[hh], s4, kx[hh], s4, dot[g]); /* dim hh*4+s4 */
+            } else {
+                for (int s4 = 0; s4 < 4; s4++) {
+                    int pi = hh * 4 + s4; /* bf16 pair: dims 2*pi (low half) and 2*pi+1 (high half) */
+                    imadi_s(e, lo, kx[hh], s4, 0x10000u, NOREG);   /* low bf16 -> f32: bits << 16 */
+                    lop3andi_s(e, hi, kx[hh], s4, 0xffff0000u);    /* high bf16 -> f32: keep the top half */
+                    e_ffma_s(e, dot[g], qq[pi / 2], (pi % 2) * 2, lo, 0, dot[g]);
+                    e_ffma_s(e, dot[g], qq[pi / 2], (pi % 2) * 2 + 1, hi, 0, dot[g]);
+                }
             }
         }
     }
@@ -455,56 +499,85 @@ static void gen_attention(Em *e, const KSpec *k) {
     isetp_ge_u32(e, d, c64);
     bra_back_if_not_p0(e, Lin);
     loop_end(e);
-    e_fmul(e, s, dot, scale);
+    for (uint32_t g = 0; g < GC; g++) e_fmul(e, s[g], dot[g], scale);
     if (k->divergent) {
         region_join(e); /* every lane back before the cross-lane reductions */
     } else {
         imadi(e, nb, over, 0x80000000u, cninf); /* over ? +inf : -inf (bits) */
-        e_fsub(e, ns, zero, s); e_fmax(e, ns, ns, nb); e_fsub(e, s, zero, ns);
+        for (uint32_t g = 0; g < GC; g++) { e_fsub(e, ns, zero, s[g]); e_fmax(e, ns, ns, nb); e_fsub(e, s[g], zero, ns); }
+    }
+    for (uint32_t g = 0; g < GC; g++) {
+        if (g == 0) sts32(e, sOff, s[0]);
+        else { imadi(e, tsh, c1, g * HB, sOff); sts32(e, tsh, s[g]); }
     }
-    sts32(e, sOff, s);
     sts32(e, oOff, koff);
 
-    /* chunk max */
-    int t = V(e), mw = V(e), ra = V(e), rb = V(e), mc = V(e), Mn = V(e), diff = V(e), alpha = V(e), parg = V(e), p = V(e), sw = V(e), lc = V(e);
+    /* chunk max, per head */
+    int t = V(e), mw = V(e), ra = V(e), rb = V(e), mc = V(e), Mn = V(e), diff = V(e), alpha[4], parg, p, sw, lc;
+    alpha[0] = V(e); parg = V(e); p = V(e); sw = V(e); lc = V(e);
+    for (uint32_t g = 1; g < GC; g++) alpha[g] = V(e);
     static const uint32_t steps[5] = { 16, 8, 4, 2, 1 };
-    shfl_down(e, t, s, steps[0]); e_fmax(e, mw, s, t);
-    for (int i = 1; i < 5; i++) { shfl_down(e, t, mw, steps[i]); e_fmax(e, mw, mw, t); }
-    sts32(e, rOff, mw);
+    for (uint32_t g = 0; g < GC; g++) {
+        shfl_down(e, t, s[g], steps[0]); e_fmax(e, mw, s[g], t);
+        for (int i = 1; i < 5; i++) { shfl_down(e, t, mw, steps[i]); e_fmax(e, mw, mw, t); }
+        if (g == 0) sts32(e, rOff, mw);
+        else { imadi(e, tsh, c1, g * HB, rOff); sts32(e, tsh, mw); }
+    }
     bar_sync(e);
-    lds32(e, ra, c768); lds32(e, rb, c896);
-    e_fmax(e, mc, ra, rb);
-    if (HD == 128) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); e_fmax(e, mc, mc, rc_); e_fmax(e, mc, mc, rd_); }
-    e_fmax(e, Mn, M, mc);
-    if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) {
-        movf(e, alpha, 1.0f);
-        mufu(e, BW_IR_MUFU_EX2, p, s);
-        e_fmax(e, M, Mn, mc);
-    } else {
-        e_fsub(e, diff, M, Mn);
-        mufu(e, BW_IR_MUFU_EX2, alpha, diff);
-        e_fmax(e, M, Mn, mc); /* M = Mn */
-        e_fsub(e, parg, s, Mn);
-        mufu(e, BW_IR_MUFU_EX2, p, parg);
+    for (uint32_t g = 0; g < GC; g++) {
+        const int pg = GC == 1 ? p : s[g]; /* GC > 1: p overwrites the score register of its head */
+        if (g == 0) { lds32(e, ra, c768); lds32(e, rb, c896); }
+        else { imadi(e, tsh, c1, g * HB, c768); lds32(e, ra, tsh); imadi(e, tsh, c1, g * HB, c896); lds32(e, rb, tsh); }
+        e_fmax(e, mc, ra, rb);
+        if (HD == 128) {
+            if (g == 0) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); }
+            else { imadi(e, tsh, c1, g * HB, c1024); lds32(e, rc_, tsh); imadi(e, tsh, c1, g * HB, c1152); lds32(e, rd_, tsh); }
+            e_fmax(e, mc, mc, rc_); e_fmax(e, mc, mc, rd_);
+        }
+        e_fmax(e, Mn, M[g], mc);
+        if (k->mutant == OMEGA_GPU_ATTN_MUTANT_NO_MAX) {
+            movf(e, alpha[g], 1.0f);
+            mufu(e, BW_IR_MUFU_EX2, pg, s[g]);
+            e_fmax(e, M[g], Mn, mc);
+        } else {
+            e_fsub(e, diff, M[g], Mn);
+            mufu(e, BW_IR_MUFU_EX2, alpha[g], diff);
+            e_fmax(e, M[g], Mn, mc); /* M = Mn */
+            e_fsub(e, parg, s[g], Mn);
+            mufu(e, BW_IR_MUFU_EX2, pg, parg);
+        }
     }
     bar_sync(e); /* everyone has read the max partials before they are overwritten */
-    sts32(e, sOff, p);
-    shfl_down(e, t, p, steps[0]); e_fadd(e, sw, p, t);
-    for (int i = 1; i < 5; i++) { shfl_down(e, t, sw, steps[i]); e_fadd(e, sw, sw, t); }
-    sts32(e, rOff, sw);
+    for (uint32_t g = 0; g < GC; g++) {
+        const int pg = GC == 1 ? p : s[g];
+        if (g == 0) sts32(e, sOff, pg);
+        else { imadi(e, tsh, c1, g * HB, sOff); sts32(e, tsh, pg); }
+        shfl_down(e, t, pg, steps[0]); e_fadd(e, sw, pg, t);
+        for (int i = 1; i < 5; i++) { shfl_down(e, t, sw, steps[i]); e_fadd(e, sw, sw, t); }
+        if (g == 0) sts32(e, rOff, sw);
+        else { imadi(e, tsh, c1, g * HB, rOff); sts32(e, tsh, sw); }
+    }
     bar_sync(e);
-    lds32(e, ra, c768); lds32(e, rb, c896);
-    e_fadd(e, lc, ra, rb);
-    if (HD == 128) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); e_fadd(e, lc, lc, rc_); e_fadd(e, lc, lc, rd_); }
-    e_ffma(e, L, L, alpha, lc);
-    if (k->mutant != OMEGA_GPU_ATTN_MUTANT_NO_RESCALE) e_fmul(e, acc, acc, alpha);
+    for (uint32_t g = 0; g < GC; g++) {
+        if (g == 0) { lds32(e, ra, c768); lds32(e, rb, c896); }
+        else { imadi(e, tsh, c1, g * HB, c768); lds32(e, ra, tsh); imadi(e, tsh, c1, g * HB, c896); lds32(e, rb, tsh); }
+        e_fadd(e, lc, ra, rb);
+        if (HD == 128) {
+            if (g == 0) { lds32(e, rc_, c1024); lds32(e, rd_, c1152); }
+            else { imadi(e, tsh, c1, g * HB, c1024); lds32(e, rc_, tsh); imadi(e, tsh, c1, g * HB, c1152); lds32(e, rd_, tsh); }
+            e_fadd(e, lc, lc, rc_); e_fadd(e, lc, lc, rd_);
+        }
+        e_ffma(e, L[g], L[g], alpha[g], lc);
+        if (k->mutant != OMEGA_GPU_ATTN_MUTANT_NO_RESCALE) e_fmul(e, acc[g], acc[g], alpha[g]);
+    }
 
     /* phase B (batched, 2026-10-12): dimension tid over the chunk's tokens, AT_TOK tokens per pass. The
      * token offsets of a pass come in two 128-bit shared loads (SB_LD2, one wait), then each V address is
      * computed into one register pair while the earlier V loads are in flight (emit_fixed_in_batch: the
      * read barrier orders the overwrite after the load has read it) and its load issued on SB_GPR or
      * SB_LD3; the p values follow as two more shared loads on SB_LD2; one wait for all of it. A token past
-     * ctx inside a pass has p = 0 and the offset of a real token (phase A), so it adds exactly 0. */
+     * ctx inside a pass has p = 0 and the offset of a real token (phase A), so it adds exactly 0.
+     * GC > 1: one V load per token feeds every head's accumulator from that head's p slice (cut K). */
     enum { AT_TOK = 8 };
     int kk = V(e), tt = V(e), oa = V(e), pa = V(e), ko4[2], pv4[2], va = V64(e), v[AT_TOK];
     for (int i = 0; i < 2; i++) { ko4[i] = V128(e); pv4[i] = V128(e); }
@@ -524,10 +597,18 @@ static void gen_attention(Em *e, const KSpec *k) {
         uint32_t sb = (i < AT_TOK / 2) ? SB_GPR : SB_LD3;
         if (k->f32) ldg_b(e, v[i], va, udesc, sb); else ldg16_b(e, v[i], va, udesc, sb);
     }
-    for (int i = 0; i < 2; i++) lds128_b(e, pv4[i], pa, (uint32_t)i * 16u, SB_LD2);
-    for (int i = 0; i < AT_TOK; i++) {
-        if (!k->f32) imadi(e, v[i], v[i], 0x10000u, NOREG);
-        e_ffma_s(e, acc, pv4[i / 4], i % 4, v[i], 0, acc);
+    if (GC == 1) {
+        for (int i = 0; i < 2; i++) lds128_b(e, pv4[i], pa, (uint32_t)i * 16u, SB_LD2);
+        for (int i = 0; i < AT_TOK; i++) {
+            if (!k->f32) imadi(e, v[i], v[i], 0x10000u, NOREG);
+            e_ffma_s(e, acc[0], pv4[i / 4], i % 4, v[i], 0, acc[0]);
+        }
+    } else {
+        if (!k->f32) for (int i = 0; i < AT_TOK; i++) imadi(e, v[i], v[i], 0x10000u, NOREG);
+        for (uint32_t g = 0; g < GC; g++) {
+            for (int i = 0; i < 2; i++) lds128_b(e, pv4[i], pa, g * HB + (uint32_t)i * 16u, SB_LD2);
+            for (int i = 0; i < AT_TOK; i++) e_ffma_s(e, acc[g], pv4[i / 4], i % 4, v[i], 0, acc[g]);
+        }
     }
     imadi(e, kk, c1, AT_TOK, kk);
     isetp_ge_u32(e, kk, c64);
@@ -541,37 +622,77 @@ static void gen_attention(Em *e, const KSpec *k) {
     loop_end(e);
 
     patch_fwd(e, bZ);
-    if (part) {
+    if (part && GC == 1) {
         /* partial row (seq * nqh + out head) * S + split: acc[HD] unnormalised, then M and L at words HD and HD + 1
          * (every lane stores the same CTA-wide M and L). Everything is re-derived here from the CTA ids and the
          * constant bank so no extra value lives across the chunk loop (the hd 128 kernel sits at the register budget). */
-        int cy = V(e), sq = V(e), sp = V(e), hh = V(e), nq = V(e), t4 = V(e), prow = V(e), poff = V(e);
+        int cy = V(e), sq = V(e), sp = V(e), hh = V(e), nq_ = V(e), t4 = V(e), prow = V(e), poff = V(e);
         int paddr = V64(e), maddr = V64(e), laddr = V64(e), Cp = V64(e);
-        s2r(e, cy, BW_SR_CTAID_Y); s2r(e, hh, BW_SR_CTAID_X); ldc32(e, nq, ARG_NQH); ldc64(e, Cp, ARG_OUT);
+        s2r(e, cy, BW_SR_CTAID_Y); s2r(e, hh, BW_SR_CTAID_X); ldc32(e, nq_, ARG_NQH); ldc64(e, Cp, ARG_OUT);
         if (k->mutant == OMEGA_GPU_ATTN_MUTANT_OUT_ROW) lop3xor(e, hh, hh, c1);
         if (LS) { lop3andi(e, sp, cy, S - 1u); shri(e, sq, cy, LS); } else { movrz(e, sp); iadd3(e, sq, cy, zero); }
-        imadr(e, prow, sq, nq, hh);
+        imadr(e, prow, sq, nq_, hh);
         imadi(e, prow, prow, S, sp);
         imadi(e, t4, tid, 4, NOREG);
         imadi(e, poff, prow, (HD + 2u) * 4u, t4);
         wide(e, paddr, poff, 1, Cp);
-        stg(e, paddr, acc, udesc);
+        stg(e, paddr, acc[0], udesc);
         imadi(e, poff, prow, (HD + 2u) * 4u, NOREG);
         wide(e, maddr, poff, 1, Cp);
         wide(e, maddr, c64, 4, maddr);
-        stg(e, maddr, M, udesc);
+        stg(e, maddr, M[0], udesc);
         wide(e, laddr, c1, 4, maddr);
-        stg(e, laddr, L, udesc);
-    } else {
+        stg(e, laddr, L[0], udesc);
+    } else if (part) {
+        /* GC heads: row (seq * nqh + h * GC + g) * S + split for head g (OUT_ROW: g ^ 1 on the output side) */
+        int cy = V(e), sq = V(e), sp = V(e), h0 = V(e), hg = V(e), nq_ = V(e), t4 = V(e), prow = V(e), poff = V(e);
+        int paddr = V64(e), maddr = V64(e), laddr = V64(e), Cp = V64(e);
+        s2r(e, cy, BW_SR_CTAID_Y); s2r(e, h0, BW_SR_CTAID_X); ldc32(e, nq_, ARG_NQH); ldc64(e, Cp, ARG_OUT);
+        imadi(e, h0, h0, GC, NOREG);
+        if (LS) { lop3andi(e, sp, cy, S - 1u); shri(e, sq, cy, LS); } else { movrz(e, sp); iadd3(e, sq, cy, zero); }
+        imadi(e, t4, tid, 4, NOREG);
+        for (uint32_t g = 0; g < GC; g++) {
+            imadi(e, hg, c1, g, h0);
+            if (k->mutant == OMEGA_GPU_ATTN_MUTANT_OUT_ROW) lop3xor(e, hg, hg, c1);
+            imadr(e, prow, sq, nq_, hg);
+            imadi(e, prow, prow, S, sp);
+            imadi(e, poff, prow, (HD + 2u) * 4u, t4);
+            wide(e, paddr, poff, 1, Cp);
+            stg(e, paddr, acc[g], udesc);
+            imadi(e, poff, prow, (HD + 2u) * 4u, NOREG);
+            wide(e, maddr, poff, 1, Cp);
+            wide(e, maddr, c64, 4, maddr);
+            stg(e, maddr, M[g], udesc);
+            wide(e, laddr, c1, 4, maddr);
+            stg(e, laddr, L[g], udesc);
+        }
+    } else if (GC == 1) {
         int inv = V(e), o = V(e);
-        mufu(e, BW_IR_MUFU_RCP, inv, L);
-        e_fmul(e, o, acc, inv);
+        mufu(e, BW_IR_MUFU_RCP, inv, L[0]);
+        e_fmul(e, o, acc[0], inv);
         stg(e, oaddr, o, udesc);
+    } else {
+        /* direct output, GC heads: row seq * nqh + h * GC + g (OUT_ROW: g ^ 1), re-derived from the CTA ids */
+        int inv = V(e), o = V(e), cy = V(e), h0 = V(e), hg = V(e), nq_ = V(e), t4 = V(e), orow = V(e), ooff = V(e);
+        int oa64 = V64(e), Cp = V64(e);
+        s2r(e, cy, BW_SR_CTAID_Y); s2r(e, h0, BW_SR_CTAID_X); ldc32(e, nq_, ARG_NQH); ldc64(e, Cp, ARG_OUT);
+        imadi(e, h0, h0, GC, NOREG);
+        imadi(e, t4, tid, 4, NOREG);
+        for (uint32_t g = 0; g < GC; g++) {
+            imadi(e, hg, c1, g, h0);
+            if (k->mutant == OMEGA_GPU_ATTN_MUTANT_OUT_ROW) lop3xor(e, hg, hg, c1);
+            imadr(e, orow, cy, nq_, hg);
+            imadi(e, ooff, orow, HD * 4, t4);
+            wide(e, oa64, ooff, 1, Cp);
+            mufu(e, BW_IR_MUFU_RCP, inv, L[g]);
+            e_fmul(e, o, acc[g], inv);
+            stg(e, oa64, o, udesc);
+        }
     }
     tail(e);
 }
 
-#define AT_GPR_BUDGET 64u
+#define AT_GPR_BUDGET 96u /* cut K: the GQA-group hd 128 kernel carries four heads of running state (the matmul blocked kernels launch at 108) */
 
 static int build_kernel(const KSpec *k, OmegaBlackwellKernel *kernel, BlackwellIRProgram **keep) {
     BlackwellIRProgram *prog = calloc(1, sizeof *prog);
@@ -627,6 +748,8 @@ static bool g_hooked;
 #define UNLOCK() omega_gpu_session_unlock()
 
 void omega_gpu_attention_test_set_simulator(OmegaGpuAttnSim sim) { LOCK(); g_sim = sim; UNLOCK(); }
+static uint32_t g_sim_shared_bytes; /* shared bytes the launcher would declare for the kernel the simulator is running */
+uint32_t omega_gpu_attention_test_shared_bytes(void) { return g_sim_shared_bytes; }
 void omega_gpu_attention_test_set_dedupe(bool on) { LOCK(); g_dedupe = on; UNLOCK(); }
 void omega_gpu_attention_test_set_split(int log2split) { LOCK(); g_split = (log2split >= 0 && log2split <= (int)OMEGA_GPU_ATTN_MAX_LOG2SPLIT) ? log2split : -1; UNLOCK(); }
 
@@ -797,7 +920,7 @@ static int run_launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) {
     args[6] = (uint32_t)g_tab.mem.va; args[7] = (uint32_t)(g_tab.mem.va >> 32);
     memcpy(&args[8], L->params, sizeof L->params);
     OmegaGpuLaunch GL = {
-        .code_va = ks->code.va, .gpr_count = AT_GPR_BUDGET, .threads_x = ks->k.hd, .threads_y = 1, .shared_bytes = 16u * ks->k.hd, /* 4 arrays of hd words: 1024 B for hd 64 (the QMD default), 2048 B for hd 128 */
+        .code_va = ks->code.va, .gpr_count = AT_GPR_BUDGET, .threads_x = ks->k.hd, .threads_y = 1, .shared_bytes = shared_bytes_for(ks->k.hd, ks->k.log2gqa), /* (3 GC + 1) arrays of hd words: 1024 B for hd 64, 2048 B for hd 128 gqa 1, 6656 B for hd 128 gqa 4 */
         .grid_x = L->grid_x, .grid_y = L->grid_y, .num_elements = out_words,
         .args = args, .n_args = ARG_WORDS, .timeout_ms = AT_WAIT_MS,
     };
@@ -825,7 +948,7 @@ static int launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) {
         info->q_bytes += L->q_bytes; info->tab_bytes += L->tab_bytes; info->out_bytes += L->out_bytes;
         info->kv_source = L->pool_va ? OMEGA_GPU_ATTN_KV_RESIDENT : OMEGA_GPU_ATTN_KV_STAGED;
     }
-    if (g_sim) return g_sim(ks->prog, L, info);
+    if (g_sim) { g_sim_shared_bytes = shared_bytes_for(ks->k.hd, ks->k.log2gqa); return g_sim(ks->prog, L, info); }
     return run_launch(ks, L, info);
 }
 
@@ -968,7 +1091,7 @@ int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const floa
     uint32_t tab[2] = { 0, seq_len }; /* table row {0}, then the context length at byte 4 */
     Launch L = {
         .q = q, .q_bytes = n_out * 4, .pool = pool, .pool_bytes = 2 * plane, .tab = tab, .tab_bytes = sizeof tab,
-        .out = out, .out_bytes = n_out * 4, .grid_x = num_q_heads, .grid_y = 1,
+        .out = out, .out_bytes = n_out * 4, .grid_x = num_q_heads / heads_per_cta(HD, log2gqa), .grid_y = 1,
         .params = { 1, f2u(score_scale(HD)), (uint32_t)(2 * plane), num_kv_heads * HD * 4, (uint32_t)plane, HD * 4, num_q_heads, 4 }
     };
     rc = launch(ks, &L, info);
@@ -1024,7 +1147,7 @@ int omega_gpu_gqa_attention_rows_f32(const float *q, const float *k_cache, const
         Launch L = {
             .q = q + (size_t)r0 * row, .q_bytes = (size_t)nr * row * 4, .pool = pool, .pool_bytes = 2 * plane,
             .tab = tab, .tab_bytes = (size_t)2 * nr * 4, .out = out + (size_t)r0 * row, .out_bytes = (size_t)nr * row * 4,
-            .grid_x = num_q_heads, .grid_y = nr,
+            .grid_x = num_q_heads / heads_per_cta(HD, log2gqa), .grid_y = nr,
             .params = { 1, f2u(score_scale(HD)), (uint32_t)(2 * plane), num_kv_heads * HD * 4, (uint32_t)plane, HD * 4, num_q_heads, nr * 4 }
         };
         rc = launch(ks, &L, info);
@@ -1170,7 +1293,7 @@ static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayou
                 .pool = (const uint8_t *)pool + (size_t)layer_idx * ly->layer_stride_bytes, .pool_bytes = 0,
                 .tab = tab, .tab_bytes = ((size_t)ns * maxb + ns) * 4,
                 .out = part, .out_bytes = (size_t)ns * num_q_heads * S * (HD + 2) * 4,
-                .grid_x = num_q_heads, .grid_y = ns * S,
+                .grid_x = num_q_heads / heads_per_cta(HD, log2gqa), .grid_y = ns * S,
                 .params = { maxb, f2u(score_scale(HD)), (uint32_t)ly->block_stride_bytes, (uint32_t)ly->token_stride_bytes,
                             (uint32_t)ly->kv_plane_stride_bytes, (uint32_t)ly->head_stride_bytes, num_q_heads, ns * maxb * 4 },
                 .pool_va = g_resident.va + (uint64_t)layer_idx * ly->layer_stride_bytes,
@@ -1229,7 +1352,7 @@ static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayou
             .q = q + (size_t)s0 * row, .q_bytes = (size_t)ns * row * 4, .pool = staged, .pool_bytes = (size_t)staged_bytes,
             .tab = tab, .tab_bytes = ((size_t)ns * maxb + ns) * 4,
             .out = part, .out_bytes = (size_t)ns * num_q_heads * S * (HD + 2) * 4,
-            .grid_x = num_q_heads, .grid_y = ns * S,
+            .grid_x = num_q_heads / heads_per_cta(HD, log2gqa), .grid_y = ns * S,
             .params = { maxb, f2u(score_scale(HD)), (uint32_t)ly->layer_stride_bytes, (uint32_t)ly->token_stride_bytes,
                         (uint32_t)ly->kv_plane_stride_bytes, (uint32_t)ly->head_stride_bytes, num_q_heads, ns * maxb * 4 }
         };
diff --git a/src/omega_gpu_attention_api.h b/src/omega_gpu_attention_api.h
index 18e16c715..3610af047 100644
--- a/src/omega_gpu_attention_api.h
+++ b/src/omega_gpu_attention_api.h
@@ -265,6 +265,10 @@ typedef struct {
 struct BlackwellIRProgramTag;
 typedef int (*OmegaGpuAttnSim)(const void *prog /* const BlackwellIRProgram * */, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info);
 void omega_gpu_attention_test_set_simulator(OmegaGpuAttnSim sim);
+/* The shared memory the launcher declares for the kernel the simulator is running (set before each simulated launch). */
+uint32_t omega_gpu_attention_test_shared_bytes(void);
+/* Query heads one CTA serves (cut K): hd 128 groups min(2^log2_gqa, 4) heads of one kv head; hd 64 keeps one head per CTA. */
+uint32_t omega_gpu_attention_heads_per_cta(uint32_t head_dim, uint32_t log2_gqa);
 
 /* Shared-prefix staging dedupe (attention hardening cut, 2026-10-04): within one launch
  * every (physical block, layer) slice referenced by the batch is staged once, keyed by the
diff --git a/tests/.crumb b/tests/.crumb
index d9385e8d0..96a1b5f1d 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -290,14 +290,14 @@
         }
       ],
       "children_root": "sha256:9597c068d5bf4eb27f1d91842813a2b10269c2ccae421dceefb4308030ec0fc2",
-      "compiled_at": "2026-10-12T10:51:44Z",
+      "compiled_at": "2026-10-12T11:07:56Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:38c14347e7f7885f0858c2e66c9cb8d029ad128c80cc84818ceda5e7d77de7e3",
+      "digest": "sha256:ac28446243900e9c337b343cf49932a4ef49c065bed02a6438109b028f10bd2a",
       "evidence_files": 16,
       "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a",
       "files": 1025,
-      "generated_at_commit": "e04bd5021b2a4f311fb9838887c170c4bf3164b6",
-      "source_tree": "sha256:efe76096c973d3bfeb051874d5a71de55419609a2558298731f97d413731157c"
+      "generated_at_commit": "697f5d0fb1d011a7625e5be897270447d6aaddec",
+      "source_tree": "sha256:8d3483308d1ec814689cacd7570af73bdcbcdaa9ca2080e88dbceac80eca81ce"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/gpu_attention_test.c b/tests/gpu_attention_test.c
index 92f901566..45790315a 100644
--- a/tests/gpu_attention_test.c
+++ b/tests/gpu_attention_test.c
@@ -537,9 +537,10 @@ static int chip(const char *out_path) {
             OmegaGpuAttnInfo ai;
             int arc = run_paged(&pc, auto_got, &ai);
             uint32_t chunks = (ctx + hd - 1) / hd, want_log2 = 0;
+            const uint32_t gcta = nqh / omega_gpu_attention_heads_per_cta(hd, 2); /* CTAs per split: cut K groups 4 heads per CTA at hd 128 */
             while (want_log2 < OMEGA_GPU_ATTN_MAX_LOG2SPLIT && (2u << want_log2) <= chunks) want_log2++;
-            CHECK(arc == OMEGA_GPU_ATTN_OK && ai.ctas_last_launch == (nqh << want_log2),
-                  "split auto ctx %u: rc=%s ctas=%u (expected %u)", ctx, omega_gpu_attention_rc_name(arc), ai.ctas_last_launch, nqh << want_log2);
+            CHECK(arc == OMEGA_GPU_ATTN_OK && ai.ctas_last_launch == (gcta << want_log2),
+                  "split auto ctx %u: rc=%s ctas=%u (expected %u)", ctx, omega_gpu_attention_rc_name(arc), ai.ctas_last_launch, gcta << want_log2);
             for (int ls = 0; ls <= (int)OMEGA_GPU_ATTN_MAX_LOG2SPLIT; ls++) {
                 set_split(ls);
                 OmegaGpuAttnInfo fi;
@@ -548,7 +549,7 @@ static int chip(const char *out_path) {
                 c.rc = run_paged(&pc, got, &fi);
                 c.bad = compare(got, want, n, 2e-4, 2e-5, &c.worst);
                 c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &fi);
-                CHECK(fi.ctas_last_launch == (nqh << ls) && fi.out_bytes == (uint64_t)nqh * (1u << ls) * (hd + 2) * 4,
+                CHECK(fi.ctas_last_launch == (gcta << ls) && fi.out_bytes == (uint64_t)nqh * (1u << ls) * (hd + 2) * 4,
                       "%s: ctas=%u out_bytes=%llu", name, fi.ctas_last_launch, (unsigned long long)fi.out_bytes);
                 if ((uint32_t)ls >= want_log2) CHECK(memcmp(got, auto_got, n * 4) == 0, "%s equals the automatic choice bit for bit (a larger launch split only adds empty partials)", name);
                 if (ls == 1 && ci == 0) {
@@ -558,8 +559,8 @@ static int chip(const char *out_path) {
                 record(c, out);
             }
             set_split(-1);
-            if (ci == 1 && chunks == 1) CHECK(ai.ctas_last_launch == nqh, "ctx %u: one chunk stays unsplit (%u CTAs)", ctx, ai.ctas_last_launch);
-            else if (ci == 1) CHECK(ai.ctas_last_launch == (nqh << want_log2), "ctx %u: %u chunks -> %u splits (%u CTAs)", ctx, chunks, 1u << want_log2, ai.ctas_last_launch);
+            if (ci == 1 && chunks == 1) CHECK(ai.ctas_last_launch == gcta, "ctx %u: one chunk stays unsplit (%u CTAs)", ctx, ai.ctas_last_launch);
+            else if (ci == 1) CHECK(ai.ctas_last_launch == (gcta << want_log2), "ctx %u: %u chunks -> %u splits (%u CTAs)", ctx, chunks, 1u << want_log2, ai.ctas_last_launch);
             free(pool); free(ids); free(q); free(got); free(want); free(auto_got);
         }
     }
@@ -680,11 +681,11 @@ static int chip(const char *out_path) {
  * SHFL therefore requires one path across the warp, or the simulator stops with error 7. */
 typedef struct { uint32_t r[256]; int pc; int p0; int done; uint64_t path; } SimThr;
 static uint32_t sim_cbank[256];
-static uint8_t sim_shared[4096];
+static uint8_t sim_shared[8192];
 #define SIM_TMAX 128
 #define SIM_T ((int)g_hd) /* threads per CTA = head_dim */
 static uint32_t g_smem_cap; /* negative control: pretend the QMD declared this many bytes (0 = the real 16 * head_dim) */
-#define SIM_SMEM (g_smem_cap ? g_smem_cap : 16u * g_hd) /* the shared memory the QMD declares for this kernel (launcher: shared_bytes = 16 * head_dim) */
+#define SIM_SMEM (g_smem_cap ? g_smem_cap : omega_gpu_attention_test_shared_bytes()) /* the shared memory the QMD declares for this kernel (launcher: shared_bytes_for) */
 static int g_sim_err;
 static int g_trace, g_trace_launch; static uint32_t g_trace_cx;
 static uint32_t rd(const SimThr *t, int v, const BlackwellIRProgram *p) { if (v < 0) return 0; int ph = p->regalloc.vreg_to_phys[v]; return ph < 0 ? 0 : t->r[ph & 0xff]; }
@@ -1135,7 +1136,7 @@ static void hd_codegen_checks(void) {
         /* head_dim 128: encodes, inside the register budget, a different (longer) program */
         OmegaBlackwellKernel k2; memset(&k2, 0, sizeof k2);
         int rc2 = omega_gpu_attention_codegen_hd(p->f32, p->log2bs, p->log2gqa, 128, &k2);
-        CHECK(rc2 == OMEGA_GPU_ATTN_OK && k2.code_size > 0 && k2.gpr_count <= 64 && k2.insn_count > p->insns && memcmp(k2.code_digest, k.code_digest, 32) != 0,
+        CHECK(rc2 == OMEGA_GPU_ATTN_OK && k2.code_size > 0 && k2.gpr_count <= 96 /* AT_GPR_BUDGET; cut K: the four-head kernel peaks at 84 */ && k2.insn_count > p->insns && memcmp(k2.code_digest, k.code_digest, 32) != 0,
               "hd128 %s log2bs %u log2gqa %u: kernel encodes (%zu insns vs %zu, %u gprs)", p->f32 ? "f32 " : "bf16", p->log2bs, p->log2gqa, k2.insn_count, p->insns, k2.gpr_count);
         free(k2.code);
     }