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

closed derived a4407f4bf2ccf32a #415

Imported from GitHub aien-dev/omega-mv#415 (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 536870f1566f3255259ae5a51f24f91ea91d2323 · Head 71e9ca9d78bf715d1a22af8f8f2b369dab0f62cb

Apply it

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

Changes

diff --git a/.crumb b/.crumb
index efa8c4af6..9d299efd4 100644
--- a/.crumb
+++ b/.crumb
@@ -87,14 +87,14 @@
           "purpose": "Directory spec. Purpose not yet described by a human."
         },
         {
-          "digest": "6866b462635e41fb7045ee33236c6d7676b7f94bfa2c2425c188c3a49191a536",
-          "last_commit": "1a046294",
+          "digest": "367e186a354de5a8c64c790ec75e13f168681d09579dad58192c9e995db87ff0",
+          "last_commit": "a19147e0",
           "name": "src",
           "purpose": "Directory src. Purpose not yet described by a human."
         },
         {
-          "digest": "22f878591818477beba38c4e25f728466378d021d42e9ebcc92a98ce9bcbf90a",
-          "last_commit": "1a046294",
+          "digest": "8a71f0ad0592cd5203841779f40edd0aa2628635b6878d6f9bf18ae5fc4f709c",
+          "last_commit": "a19147e0",
           "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:3af1f55dae3a48e4a3251b801e8ea925eaf92ae993866f3d0649c21fe508deba",
-      "compiled_at": "2026-10-12T10:11:34Z",
+      "children_root": "sha256:fc31a05a0acc60e9e72ebaf03ad6cc61c1dd5467b8fddb0cfe8112d66b67ee8f",
+      "compiled_at": "2026-10-12T10:28:55Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:dd0902f85300b818a1dc55ce4c44d88c9a246d32fe937e1035e165105a6c8417",
+      "digest": "sha256:f91173a1a92e04c868eef5243b50bc9f9d49cd396cbc72b2d56af4160af27dbf",
       "evidence_files": 7245,
       "evidence_root": "sha256:035beef5cdb99afaefd1743640f5e7eeaaed13c4a5ec6c8b4b6a4cb0c528407a",
       "files": 9734,
-      "generated_at_commit": "1a0462947b0845211e7bca512e8f87e25378dc39",
-      "source_tree": "sha256:e2a8d323504ab4975d03e2689d316512157a84829aef0212d6a967c6f9a9599c"
+      "generated_at_commit": "a19147e052a95f949522bdb40a1be2483601a3d9",
+      "source_tree": "sha256:2500ae8b61aeb84142d3692d7cb33879c85cc76d269de8e04563d894ca7007c3"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/.crumb b/src/.crumb
index a3210f65c..c06123ba9 100644
--- a/src/.crumb
+++ b/src/.crumb
@@ -176,14 +176,14 @@
         }
       ],
       "children_root": "sha256:2f64d32b2351272f4de10e1143efdb74dbc3cae56b1f0a3039ca9edcfebf6e8c",
-      "compiled_at": "2026-10-12T10:11:34Z",
+      "compiled_at": "2026-10-12T10:28:55Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:6866b462635e41fb7045ee33236c6d7676b7f94bfa2c2425c188c3a49191a536",
+      "digest": "sha256:367e186a354de5a8c64c790ec75e13f168681d09579dad58192c9e995db87ff0",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 451,
-      "generated_at_commit": "1a0462947b0845211e7bca512e8f87e25378dc39",
-      "source_tree": "sha256:a40437c6b2b7fbd24c04d37c59f7da04b2d1fffe5ae78db786c3b7c042bb357a"
+      "generated_at_commit": "a19147e052a95f949522bdb40a1be2483601a3d9",
+      "source_tree": "sha256:8702307ccaecffa8ada606d7a60079af5078a7cc311c60407f05b8cbd1416fa1"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/src/omega_gpu_attention_api.c b/src/omega_gpu_attention_api.c
index 868e0a796..fcc554d7a 100644
--- a/src/omega_gpu_attention_api.c
+++ b/src/omega_gpu_attention_api.c
@@ -330,16 +330,16 @@ static void gen_attention(Em *e, const KSpec *k) {
     wide(e, ca, t1, 1, D);
     ldg(e, ctx, ca, udesc);
     if (part) {
-        /* This sequence's own split count s_own = min(S, pow2floor(chunks / 2)), chunks = ceil(ctx / HD), from its own
+        /* This sequence's own split count s_own = min(S, pow2floor(chunks)), chunks = ceil(ctx / HD), from its own
          * context alone (the host picks the launch S the same way over the batch); per = roundup(ceil(ctx / s_own), HD)
          * whole chunks per split; this CTA's slice is [kb, kend), kend = min(ctx, kb + per) through the sign bit of
          * ctx - (kb + per). Splits past s_own get kb >= kend: an empty partial. Branch-free: candidate 2^c replaces
-         * per when chunks / 2 >= 2^c; the candidates nest, so the largest that fits wins. */
+         * per when chunks >= 2^c; the candidates nest, so the largest that fits wins. */
         int per = V(e), x = V(e), cand = V(e), dd = V(e), lt = V(e), cH1 = V(e), cK = V(e);
         kb = V(e); kend = V(e);
         movi(e, cH1, HD - 1u);
         iadd3(e, per, ctx, cH1); lop3andi(e, per, per, ~(HD - 1u)); /* roundup(ctx, HD): one split takes it all */
-        shri(e, x, per, log2hd + 1u);                                /* chunks / 2 */
+        shri(e, x, per, log2hd);                                     /* chunks (cut J: one whole chunk per split) */
         for (uint32_t c = 1; c <= LS; c++) {
             movi(e, cK, (1u << c) - 1u); iadd3(e, cand, ctx, cK); shri(e, cand, cand, c);
             iadd3(e, cand, cand, cH1); lop3andi(e, cand, cand, ~(HD - 1u)); /* roundup(ceil(ctx / 2^c), HD) */
@@ -849,13 +849,21 @@ int omega_gpu_attention_reserve(uint32_t max_context, uint32_t max_seqs, uint32_
         if (paged > per_seq) per_seq = paged;
     }
     const size_t pool = per_seq * max_seqs;
-    const size_t qo = (size_t)max_seqs * num_q_heads * head_dim * 4u;
+    /* q rows for every sequence, and the output buffer sized for the paged path's partials of one launch
+     * (cut J: up to 2^MAX_LOG2SPLIT partials of head_dim + 2 words per (sequence, head), at most
+     * MAX_CTAS / num_q_heads sequences per launch; the rows reserve usually asks for more). */
+    const size_t q_bytes = (size_t)max_seqs * num_q_heads * head_dim * 4u;
+    size_t launch_seqs = OMEGA_GPU_ATTN_MAX_CTAS / num_q_heads;
+    if (launch_seqs == 0) launch_seqs = 1;
+    if (launch_seqs > max_seqs) launch_seqs = max_seqs;
+    const size_t partials = launch_seqs * num_q_heads * ((size_t)1u << OMEGA_GPU_ATTN_MAX_LOG2SPLIT) * ((size_t)head_dim + 2u) * 4u;
+    const size_t qo = q_bytes > partials ? q_bytes : partials;
     const size_t tab = ((size_t)max_seqs * max_context + max_seqs) * 4u;
     LOCK();
     rc = OMEGA_GPU_ATTN_OK;
     if (g_sim) rc = OMEGA_GPU_ATTN_OK; /* the simulator stages in host memory: nothing to reserve */
     else if (dev_open_locked() != OMEGA_GPU_ATTN_OK) rc = OMEGA_GPU_ATTN_CHIP_FAIL;
-    else if (omega_gpu_session_scratch_reserve(&g_pool, pool) || omega_gpu_session_scratch_reserve(&g_q, qo) ||
+    else if (omega_gpu_session_scratch_reserve(&g_pool, pool) || omega_gpu_session_scratch_reserve(&g_q, q_bytes) ||
              omega_gpu_session_scratch_reserve(&g_out, qo) || omega_gpu_session_scratch_reserve(&g_tab, tab < 8 ? 8 : tab)) {
         /* roll back this API's own buffers: a failed reserve leaves nothing flagged (growth allowed as before) */
         omega_gpu_session_scratch_unreserve(&g_pool); omega_gpu_session_scratch_unreserve(&g_q);
@@ -1031,9 +1039,9 @@ int omega_gpu_gqa_attention_rows_f32(const float *q, const float *k_cache, const
 /* Paged path shared by the single and batched entries. tables[s] has n_blocks[s] entries
  * (already filtered of negatives), ctx[s] the context length. */
 /* cut F: a sequence's own split count from its context alone (the kernel computes the same): log2 of the largest
- * power of two <= min(2^MAX_LOG2SPLIT, chunks / 2), chunks = ceil(ctx / HD). */
+ * power of two <= min(2^MAX_LOG2SPLIT, chunks), chunks = ceil(ctx / HD) (cut J: one whole chunk per split; cut F took two). */
 static uint32_t own_log2split(uint32_t ctx, uint32_t HD) {
-    uint32_t x = ((ctx + HD - 1) / HD) / 2, l = 0;
+    uint32_t x = (ctx + HD - 1) / HD, l = 0;
     while (l < OMEGA_GPU_ATTN_MAX_LOG2SPLIT && (2u << l) <= x) l++;
     return l;
 }
@@ -1110,7 +1118,7 @@ static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayou
     }
     uint32_t seqs_per_launch = OMEGA_GPU_ATTN_MAX_CTAS / num_q_heads;
     if (seqs_per_launch == 0) seqs_per_launch = 1;
-    /* cut F: split each (sequence, head) over 2^log2split CTAs along the context: at least two whole chunks per
+    /* cut F: split each (sequence, head) over 2^log2split CTAs along the context: at least one whole chunk per
      * split, from the longest context in the call, within the split launch bound (the test hook forces it). */
     uint32_t log2split = 0;
     if (g_split >= 0) log2split = (uint32_t)g_split;
diff --git a/src/omega_gpu_attention_api.h b/src/omega_gpu_attention_api.h
index d913ebfd3..18e16c715 100644
--- a/src/omega_gpu_attention_api.h
+++ b/src/omega_gpu_attention_api.h
@@ -84,12 +84,13 @@ enum {
 #define OMEGA_GPU_ATTN_HEAD_DIM_128 128u /* the second supported head_dim (Qwen3-4B) */
 #define OMEGA_GPU_ATTN_MAX_CTAS 64u
 /* Cut F (2026-10-12): a paged call splits each (sequence, head) over up to 2^MAX_LOG2SPLIT CTAs along the context
- * (whole chunks each, at least two chunks per split; the launch takes the largest count in the batch) within
+ * (whole chunks each, at least one chunk per split since cut J, 2026-10-12, which also raised the cap from 8 to 16: at
+ * 1268 tokens the busiest CTA went from three chunks to two; the launch takes the largest count in the batch) within
  * SPLIT_MAX_CTAS CTAs per launch (the rows path proved 1024 on the chip); the CTAs write unnormalised partials
  * (acc[head_dim], running max, running sum) that the host combines, also when the split is 1 (the gqa f32 and rows
  * kernels keep the direct output and are byte for byte the ones before). Each sequence picks its own split count
  * from its own context, so a result never depends on the other sequences in a launch. */
-#define OMEGA_GPU_ATTN_MAX_LOG2SPLIT 3u
+#define OMEGA_GPU_ATTN_MAX_LOG2SPLIT 4u
 #define OMEGA_GPU_ATTN_SPLIT_MAX_CTAS 1024u
 #define OMEGA_GPU_ATTN_MAX_Q_HEADS 64u
 #define OMEGA_GPU_ATTN_MAX_GQA_CTX 4096u /* contiguous path: one block of 2^12 slots */
diff --git a/tests/.crumb b/tests/.crumb
index 61851786f..790472a55 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -290,14 +290,14 @@
         }
       ],
       "children_root": "sha256:9597c068d5bf4eb27f1d91842813a2b10269c2ccae421dceefb4308030ec0fc2",
-      "compiled_at": "2026-10-12T10:11:34Z",
+      "compiled_at": "2026-10-12T10:28:55Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:22f878591818477beba38c4e25f728466378d021d42e9ebcc92a98ce9bcbf90a",
+      "digest": "sha256:8a71f0ad0592cd5203841779f40edd0aa2628635b6878d6f9bf18ae5fc4f709c",
       "evidence_files": 16,
       "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a",
       "files": 1024,
-      "generated_at_commit": "1a0462947b0845211e7bca512e8f87e25378dc39",
-      "source_tree": "sha256:69eb424bc661f3ddadbc6abd791bf3f2f38d560a96e20bab4817894b49c915a6"
+      "generated_at_commit": "a19147e052a95f949522bdb40a1be2483601a3d9",
+      "source_tree": "sha256:c2abb5b543c07e0b4dfd1fdb44eebd1d007d522fafcc8707b47a48a6cc2fb095"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/gpu_attention_test.c b/tests/gpu_attention_test.c
index 87487a0b9..92f901566 100644
--- a/tests/gpu_attention_test.c
+++ b/tests/gpu_attention_test.c
@@ -2,6 +2,8 @@
  *
  *   ./gpu_attention_test --host-only          refusals, codegen (both kernel families and every
  *                                             mutant), register budget, nvdisasm listing check
+ *   ./gpu_attention_test --split-timing [--hd 128] [--spin-us N] [--out r.json]  paged bf16 32q/8kv at ATTN_SPLIT_CTX
+ *                                             (default 1268): 100 calls per forced split 1,2,4,8 + auto, parity
  *   ./gpu_attention_test --timing [--out r.json] cut 4b gate: 1 query x 32 heads x 2048 ctx, 100 calls
  *                                             through the persistent session, median under 3 ms
  *   ./gpu_attention_test --sweep [--out s.json]  head-scaling sweep: paged bf16 at head_dim 64 over q heads
@@ -251,12 +253,22 @@ static const char *mutant_name(int m) { return omega_gpu_attention_mutant_name((
 
 /* Runs the mutants listed in `ms` (terminated by 0) through `run` and counts the catches. */
 typedef int (*RunFn)(void *ctx, float *got, OmegaGpuAttnInfo *info);
+/* The forced launch split the battery currently holds (the engine hook has no getter); -1 = automatic. */
+static int g_forced_split = -1;
+static void set_split(int log2split) { g_forced_split = log2split; omega_gpu_attention_test_set_split(log2split); }
+
 static void run_mutants(Case *c, const int *ms, RunFn run, void *ctx, float *got, const float *want, size_t n, double rel, double abs_tol) {
     size_t pos = strlen(c->mutant_note); /* appends: a case may call this more than once */
     for (int i = 0; ms[i]; i++) {
         OmegaGpuAttnInfo info; double w;
         omega_gpu_attention_test_set_mutant((OmegaGpuAttnMutant)ms[i]);
+        /* cut J (one chunk per split): a paged call at up to 16 chunks gives every CTA one chunk, so the in-kernel
+         * rescale between chunks never runs and the NO_RESCALE mutant would be invisible. That mutant runs with the
+         * whole context in one CTA per head (forced split 1), where the rescale happens on every chunk after the first. */
+        const int one_cta = ms[i] == OMEGA_GPU_ATTN_MUTANT_NO_RESCALE;
+        if (one_cta) omega_gpu_attention_test_set_split(0);
         int rc = run(ctx, got, &info);
+        if (one_cta) omega_gpu_attention_test_set_split(g_forced_split);
         size_t bad = compare(got, want, n, rel, abs_tol, &w);
         int caught = rc != OMEGA_GPU_ATTN_OK || bad > 0;
         omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_NONE);
@@ -504,8 +516,8 @@ static int chip(const char *out_path) {
         record(c, out); free(pool); free(ids); free(q); free(got); free(want);
     }
     /* 3b. context split (cut F): the 32q/8kv shape at ctx 1000 under every forced split against the oracle, the
-     * CTA count per launch grows with the split, the automatic choice at this context is 4 (hd 128: 8 chunks) or
-     * 8 (hd 64: 16 chunks), and a short context (ctx 100, one chunk) stays unsplit. A forced launch split at or above
+     * CTA count per launch grows with the split, the automatic choice at this context is 8 (hd 128: 8 chunks) or
+     * 16 (hd 64: 16 chunks; cut J, one chunk per split), and a short context (ctx 100, one chunk) stays unsplit. A forced launch split at or above
      * the sequence's own count gives the same bits (the extra CTAs write empty partials that add exact zeros). */
     {
         uint32_t nqh = 32, nkv = 8, bs = 16, layers = 2, layer = 1;
@@ -525,11 +537,11 @@ 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;
-            while (want_log2 < OMEGA_GPU_ATTN_MAX_LOG2SPLIT && (2u << want_log2) <= chunks / 2) want_log2++;
+            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);
             for (int ls = 0; ls <= (int)OMEGA_GPU_ATTN_MAX_LOG2SPLIT; ls++) {
-                omega_gpu_attention_test_set_split(ls);
+                set_split(ls);
                 OmegaGpuAttnInfo fi;
                 char name[96]; snprintf(name, sizeof name, "paged_bf16_split%d_32q8kv_ctx%u", 1 << ls, ctx);
                 Case c = { .name = strdup(name), .n = n };
@@ -545,8 +557,9 @@ static int chip(const char *out_path) {
                 } else run_mutants(&c, no_mutants, run_paged, &pc, got, want, n, 2e-4, 2e-5);
                 record(c, out);
             }
-            omega_gpu_attention_test_set_split(-1);
-            if (ci == 1) CHECK(ai.ctas_last_launch == nqh, "ctx %u: one chunk stays unsplit (%u CTAs)", ctx, ai.ctas_last_launch);
+            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);
             free(pool); free(ids); free(q); free(got); free(want); free(auto_got);
         }
     }
@@ -619,9 +632,9 @@ static int chip(const char *out_path) {
         CHECK(c.blk_logical == logical && c.blk_unique == expect_unique, "%s: %u logical references, %u unique staged (expected %u/%u)", name, c.blk_logical, c.blk_unique, logical, expect_unique);
         CHECK(c.kv_naive == (uint64_t)logical * ly.layer_stride_bytes && c.kv_staged == (uint64_t)expect_unique * ly.layer_stride_bytes && c.kv_staged < c.kv_naive,
               "%s: staged %" PRIu64 " < naive %" PRIu64 " bytes (saved %" PRIu64 ")", name, c.kv_staged, c.kv_naive, c.kv_naive - c.kv_staged);
-        /* cut F: the output traffic is the partials, launch split = the largest own split in the call (hd 64: ctx 193 and 207 are 4 chunks, 2 splits; hd 128: 1) */
+        /* cut F: the output traffic is the partials, launch split = the largest own split in the call (cut J: hd 64: ctx 193 and 207 are 4 chunks, 4 splits; hd 128: 2 chunks, 2 splits) */
         uint32_t ls_max = 0;
-        for (uint32_t s = 0; s < nseq; s++) { uint32_t x = (((uint32_t)ctxs5[s] + hd - 1) / hd) / 2, l = 0; while (l < OMEGA_GPU_ATTN_MAX_LOG2SPLIT && (2u << l) <= x) l++; if (l > ls_max) ls_max = l; }
+        for (uint32_t s = 0; s < nseq; s++) { uint32_t x = ((uint32_t)ctxs5[s] + hd - 1) / hd, l = 0; while (l < OMEGA_GPU_ATTN_MAX_LOG2SPLIT && (2u << l) <= x) l++; if (l > ls_max) ls_max = l; }
         const uint64_t out_expect = (uint64_t)nseq * nqh * (1u << ls_max) * (hd + 2) * 4;
         CHECK(info.kv_source == OMEGA_GPU_ATTN_KV_STAGED && info.q_bytes == n * 4 && info.out_bytes == out_expect && info.tab_bytes > 0, "%s: q/out/table traffic accounted (q=%" PRIu64 " out=%" PRIu64 " tab=%" PRIu64 ")", name, info.q_bytes, info.out_bytes, info.tab_bytes);
         /* negative control: legacy per-sequence staging duplicates the shared prefix; same answer, more bytes */
@@ -780,6 +793,66 @@ static int sim_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAt
  * oracle; gate: median wall time per call under 3 ms, one device open per process. */
 static double now_ms(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return t.tv_sec * 1e3 + t.tv_nsec / 1e6; }
 static int cmp_d(const void *a, const void *b) { double x = *(const double *)a, y = *(const double *)b; return x < y ? -1 : x > y; }
+/* --split-timing: the paged bf16 decode shape (32 q / 8 kv heads at the current head_dim, one sequence, context
+ * ATTN_SPLIT_CTX, default 1268: the campaign's document tasks) through the persistent session, 100 calls per
+ * forced launch split 1, 2, 4, 8 and the automatic choice; median wall and mean chip time per call, every call
+ * against the oracle. A measurement for the decode-speed work (2026-10-12): whether the kernel's time at this
+ * context falls with more CTAs per (sequence, head) or stays flat (bandwidth bound: the four query heads of a
+ * kv head each read its slice). */
+static int split_timing(const char *out_path) {
+    FILE *out = out_path ? fopen(out_path, "w") : NULL;
+    if (out_path && !out) { printf("cannot open %s\n", out_path); return 2; }
+    enum { N = 100 };
+    const uint32_t hd = g_hd, nqh = 32, nkv = 8, bs = 16, layers = 2, layer = 1;
+    const char *ce = getenv("ATTN_SPLIT_CTX");
+    const uint32_t ctx = ce && atoi(ce) > 0 ? (uint32_t)atoi(ce) : 1268u;
+    const uint32_t nblk = (ctx + bs - 1) / bs, pool_blocks = nblk + 3;
+    uint32_t seed = 0x5b17c0deu;
+    OmegaGpuKvLayout ly = layout_for(pool_blocks, bs, layers, nkv, hd);
+    uint8_t *pool = malloc(ly.pool_bytes); uint16_t *pw = (uint16_t *)pool;
+    for (size_t i = 0; i < ly.pool_bytes / 2; i++) pw[i] = f2bf(frand(&seed, -1.0f, 1.0f));
+    uint32_t *ids = malloc(nblk * 4);
+    for (uint32_t b = 0; b < nblk; b++) ids[b] = (b * 5 + 1) % pool_blocks;
+    const size_t n = (size_t)nqh * hd;
+    float *q = malloc(n * 4), *got = malloc(n * 4), *want = malloc(n * 4);
+    for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f);
+    oracle_paged(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, want);
+    PagedCtx pc = { q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv };
+    if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_SPLIT_TIMING_V1\",\"hd\":%u,\"ctx\":%u,\"calls\":%d,\"spin_us\":%u,\"cases\":[",
+                     hd, ctx, N, omega_gpu_session_spin_us());
+    int first = 1;
+    for (int ls = -1; ls <= (int)OMEGA_GPU_ATTN_MAX_LOG2SPLIT; ls++) {
+        set_split(ls);
+        OmegaGpuAttnInfo info;
+        int rc0 = run_paged(&pc, got, &info); /* warm-up: opens the device, generates this split's kernel */
+        CHECK(rc0 == OMEGA_GPU_ATTN_OK, "split-timing split=%d first call rc=%s err=\"%s\"", ls, omega_gpu_attention_rc_name(rc0), omega_gpu_attention_last_error());
+        double samples[N]; int ok_calls = 0; size_t bad_total = 0; double worst = 0; uint64_t chip_sum = 0;
+        for (int i = 0; i < N; i++) {
+            double t0 = now_ms();
+            int rc = run_paged(&pc, got, &info);
+            samples[i] = now_ms() - t0;
+            double w; size_t bad = compare(got, want, n, 2e-4, 2e-5, &w);
+            if (w > worst) worst = w;
+            bad_total += bad; chip_sum += info.elapsed_ns;
+            if (rc == OMEGA_GPU_ATTN_OK && bad == 0) ok_calls++;
+        }
+        qsort(samples, N, sizeof samples[0], cmp_d);
+        const double median = samples[N / 2], p90 = samples[N * 9 / 10], mn = samples[0], mx = samples[N - 1];
+        const int pass = ok_calls == N && bad_total == 0;
+        CHECK(pass, "split-timing split=%d ctx=%u ok_calls=%d/%d violations=%zu", ls, ctx, ok_calls, N, bad_total);
+        printf("%s split-timing split=%s ctas=%u ctx=%u ok_calls=%d/%d worst_scaled_err=%g median_ms=%.3f p90_ms=%.3f min_ms=%.3f max_ms=%.3f chip_us_mean=%.1f\n",
+               pass ? "PASS" : "FAIL", ls < 0 ? "auto" : (const char *[]){ "1", "2", "4", "8", "16" }[ls], info.ctas_last_launch, ctx, ok_calls, N, worst,
+               median, p90, mn, mx, chip_sum / 1e3 / N);
+        if (out) fprintf(out, "%s{\"split\":%d,\"ctas\":%u,\"ok_calls\":%d,\"violations\":%zu,\"worst_scaled_err\":%g,\"median_ms\":%.4f,\"p90_ms\":%.4f,\"min_ms\":%.4f,\"max_ms\":%.4f,\"chip_us_mean\":%.1f,\"pass\":%s}",
+                         first ? "" : ",", ls, info.ctas_last_launch, ok_calls, bad_total, worst, median, p90, mn, mx, chip_sum / 1e3 / N, pass ? "true" : "false");
+        first = 0;
+    }
+    set_split(-1);
+    free(pool); free(ids); free(q); free(got); free(want);
+    if (out) { fprintf(out, "],\"checks\":%d,\"failed\":%d,\"verdict\":\"%s\"}\n", g_checks, g_failed, g_failed == 0 ? "OMEGA_GPU_ATTENTION_SPLIT_TIMING_PASS" : "OMEGA_GPU_ATTENTION_SPLIT_TIMING_FAIL"); fclose(out); }
+    return 0;
+}
+
 static int timing(const char *out_path) {
     FILE *out = out_path ? fopen(out_path, "w") : NULL;
     if (out_path && !out) { printf("cannot open %s\n", out_path); return 2; }
@@ -1079,22 +1152,27 @@ static void hd_codegen_checks(void) {
 
 
 int main(int argc, char **argv) {
-    const char *out_path = NULL; int host = 0, sim = 0, timing_mode = 0, sweep_mode = 0;
+    const char *out_path = NULL; int host = 0, sim = 0, timing_mode = 0, sweep_mode = 0, split_timing_mode = 0;
+    uint32_t spin_us = 0;
     for (int i = 1; i < argc; i++) {
         if (strcmp(argv[i], "--host-only") == 0) host = 1;
         else if (strcmp(argv[i], "--sim") == 0) sim = 1;
         else if (strcmp(argv[i], "--divergent") == 0) g_divergent = 1;
         else if (strcmp(argv[i], "--timing") == 0) timing_mode = 1;
+        else if (strcmp(argv[i], "--split-timing") == 0) split_timing_mode = 1;
         else if (strcmp(argv[i], "--sweep") == 0) sweep_mode = 1;
         else if (strcmp(argv[i], "--hd") == 0 && i + 1 < argc) g_hd = (uint32_t)atoi(argv[++i]);
+        else if (strcmp(argv[i], "--spin-us") == 0 && i + 1 < argc) spin_us = (uint32_t)atoi(argv[++i]);
         else if (strcmp(argv[i], "--out") == 0 && i + 1 < argc) out_path = argv[++i];
     }
     if (g_hd != 64 && g_hd != 128) { printf("--hd must be 64 or 128\n"); return 2; }
-    if (g_hd == 128 && (timing_mode || sweep_mode)) { printf("--hd 128 supports the battery and --host-only (timing and sweep are head_dim 64 only)\n"); return 2; }
+    if (g_hd == 128 && (timing_mode || sweep_mode)) { printf("--hd 128 supports the battery, --split-timing and --host-only (timing and sweep are head_dim 64 only)\n"); return 2; }
+    if (spin_us && omega_gpu_session_set_spin_us(spin_us) != 0) { printf("--spin-us %u refused\n", spin_us); return 2; }
     if (g_divergent) omega_gpu_attention_test_set_divergent(1);
     if (sim) { g_sim_mode = 1; omega_gpu_attention_test_set_simulator(g_divergent ? ws_attn_launch : sim_launch); }
     if (sim && g_divergent && !host) divergent_negative_control();
     if (host) { host_only(); hd_codegen_checks(); }
+    else if (split_timing_mode) { if (split_timing(out_path) != 0) return 2; }
     else if (timing_mode) { if (timing(out_path) != 0) return 2; }
     else if (sweep_mode) { if (sweep(out_path) != 0) return 2; }
     else { if (chip(out_path) != 0) return 2; if (g_hd == 128) hd128_checks(); }