From e09adff92bf966b6b3471c129f8eb6ba1a211fb7 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 6 Oct 2026 21:42:06 -0500 Subject: [PATCH 1/4] gpu: 2 KB instruction-prefetch tail after every kernel's code buffer (omega#323 Xid 31 lead) The SM instruction cache prefetches past the last instruction of a kernel. NVIDIA's guidance, as recorded by Mesa NVK (src/nouveau/vulkan/nvk_device.c, shader heap): "the I-cache pre-fetches and NVIDIA has informed us overallocating shaders BOs by 2K is sufficient". Every omega code upload sized its buffer as page_up(code) or a fixed capacity with no tail: the hd 128 attention kernel (2688 B) left 1408 B, hd 64 (2560 B) 1536 B. omega#323 GB10 window 2026-10-07: Xid 31, GPCCLIENT_GCC FAULT_PTE read at a page boundary during the first hd 128 multi-chunk launch; the host then waited 600 s. Cause INFERRED until a padded build turns the fault off and the unpadded baseline turns it back on, on the chip. - src/omega_gpu_code_alloc.h: omega_gpu_code_alloc_bytes(code) = page_up(code + 2048), overflow refused; omega_gpu_session_alloc_code zero-fills the tail. - Six variable-size upload sites (attention, elementwise, matmul, submit x2, accelerator world) and five fixed-capacity sites (numeric, reduce, divsqrt, ldst, resident seat) allocate capacity + tail; capacities passed to the builders are unchanged. - rx_resident_gpu: refuse a seat program larger than its 16 KB code buffer (the memcpy had no bound). - make test-gpu-code-alloc (CI host-suites): size rule, NO_TAIL mutant must fail (5 checks), source scan refuses the old page-only sizing idioms (11 hits on c0369e6, 0 here). Co-Authored-By: Claude Opus 5.5 Co-authored-by: Drake Stapleton --- .github/workflows/host-suites.yml | 2 ++ mk/omega-gpu-code-alloc.mk | 18 ++++++++++++++++ src/omega_accelerator_world.c | 7 +++--- src/omega_blackwell_submit.c | 11 ++++++---- src/omega_gpu_attention_api.c | 2 +- src/omega_gpu_code_alloc.h | 36 +++++++++++++++++++++++++++++++ src/omega_gpu_elementwise_api.c | 2 +- src/omega_gpu_matmul_api.c | 2 +- src/omega_gpu_session.c | 9 ++++++++ src/omega_gpu_session.h | 3 +++ src/omega_numeric_divsqrt_gb10.c | 3 ++- src/omega_numeric_gb10.c | 5 +++-- src/omega_numeric_ldst_gb10.c | 3 ++- src/omega_numeric_reduce_gb10.c | 5 +++-- src/runtime/rx_resident_gpu.c | 11 +++++++++- tests/test_omega_gpu_code_alloc.c | 31 ++++++++++++++++++++++++++ 16 files changed, 133 insertions(+), 17 deletions(-) create mode 100644 mk/omega-gpu-code-alloc.mk create mode 100644 src/omega_gpu_code_alloc.h create mode 100644 tests/test_omega_gpu_code_alloc.c diff --git a/.github/workflows/host-suites.yml b/.github/workflows/host-suites.yml index aaa31fd93..5edf58202 100644 --- a/.github/workflows/host-suites.yml +++ b/.github/workflows/host-suites.yml @@ -144,6 +144,8 @@ jobs: run: make PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 test-gpu-wait - name: GPU completion wait real-code mutants (each flagged build of the real code must fail) run: make PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 test-gpu-wait-mutants + - name: GPU code buffer prefetch tail (host-only, NO_TAIL mutant must die, source scan) + run: make PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 test-gpu-code-alloc train: runs-on: ubuntu-24.04-arm diff --git a/mk/omega-gpu-code-alloc.mk b/mk/omega-gpu-code-alloc.mk new file mode 100644 index 000000000..3b217c32d --- /dev/null +++ b/mk/omega-gpu-code-alloc.mk @@ -0,0 +1,18 @@ +# GPU code buffer sizing (src/omega_gpu_code_alloc.h): the 2 KB instruction prefetch tail after every +# kernel (omega#323). Host only: no device, no physics headers. Three parts: the size rule, a NO_TAIL +# mutant that must fail it, and a source scan that refuses the page-only code sizing idioms the six +# variable-size upload sites and five fixed-size sites used before. +CODE_ALLOC_SCAN_SRC := src/*.c src/runtime/*.c +CODE_ALLOC_SCAN_RE := code_size \+ 0x[fF]{3}|session_alloc\([^,]*code_size|alloc[a-z_]*\([^,]*, *(0x[0-9a-fA-F]+|OMEGA_DS_MAX_CODE_BYTES), *&[a-z_>.-]*code_mem\) +.PHONY: test-gpu-code-alloc +build/test_omega_gpu_code_alloc: tests/test_omega_gpu_code_alloc.c src/omega_gpu_code_alloc.h + @mkdir -p build + gcc -std=gnu11 -O2 -Wall -Wextra -Werror -Isrc -o $@ tests/test_omega_gpu_code_alloc.c +test-gpu-code-alloc: build/test_omega_gpu_code_alloc + ./build/test_omega_gpu_code_alloc + @gcc -std=gnu11 -O2 -Wall -Wextra -Werror -DOMEGA_GPU_CODE_ALLOC_MUTANT_NO_TAIL -Isrc -o build/test_omega_gpu_code_alloc_no_tail tests/test_omega_gpu_code_alloc.c + @if ./build/test_omega_gpu_code_alloc_no_tail >build/test_omega_gpu_code_alloc_no_tail.log 2>&1; then echo "MUTANT SURVIVED: NO_TAIL"; exit 1; fi + @echo "NO_TAIL mutant: killed ($$(grep -c '^FAIL:' build/test_omega_gpu_code_alloc_no_tail.log) failing checks)" + @if grep -nE '$(CODE_ALLOC_SCAN_RE)' $(CODE_ALLOC_SCAN_SRC); then echo "code buffer sized without the prefetch tail (use omega_gpu_code_alloc_bytes)"; exit 1; fi + @echo "source scan: no page-only code sizing" + @echo "OMEGA_GPU_CODE_ALLOC_GATE PASS" diff --git a/src/omega_accelerator_world.c b/src/omega_accelerator_world.c index 2f2188f50..cf39f377d 100644 --- a/src/omega_accelerator_world.c +++ b/src/omega_accelerator_world.c @@ -1,4 +1,5 @@ #include "omega_accelerator_world.h" +#include "omega_gpu_code_alloc.h" #include "omega_blackwell_qmd.h" #include "omega_blackwell_encoder.h" #include "omega_blackwell_codegen.h" @@ -368,9 +369,8 @@ int omega_world_register_code(OmegaAcceleratorWorld *world, if (free_slot < 0) return OMEGA_WORLD_ERR_NO_MEM; OmegaCodeEntry *entry = &world->code_entries[free_slot]; - if (code_size > SIZE_MAX - 0xfffULL) return OMEGA_WORLD_ERR_BOUNDS; - size_t alloc_bytes = (code_size + 0xfffULL) & ~0xfffULL; - if (alloc_bytes < 0x1000) alloc_bytes = 0x1000; + size_t alloc_bytes = omega_gpu_code_alloc_bytes(code_size); /* code + 2 KB prefetch tail, page rounded */ + if (alloc_bytes == 0) return OMEGA_WORLD_ERR_BOUNDS; /* GB10: GPU-cacheable system memory is not coherent with CPU mappings (nvos.h:1115-1118, hive-phases I37). */ if (nvrm_alloc_gpu_uncached(&world->m16.rm, alloc_bytes, &entry->mem) != 0) { @@ -378,6 +378,7 @@ int omega_world_register_code(OmegaAcceleratorWorld *world, } memcpy(entry->mem.cpu, code_bytes, code_size); + memset((uint8_t *)entry->mem.cpu + code_size, 0, alloc_bytes - code_size); entry->object_id = (uint32_t)free_slot; if (entry->generation == 0) { diff --git a/src/omega_blackwell_submit.c b/src/omega_blackwell_submit.c index 5ab382629..077f39b4e 100644 --- a/src/omega_blackwell_submit.c +++ b/src/omega_blackwell_submit.c @@ -11,6 +11,7 @@ #include #include #include +#include "omega_gpu_code_alloc.h" /* Second completion marker payload for the C3 tail (marker page + 0x10), the same value as * src/omega_blackwell_engine.c BE_MARKER2_PAYLOAD and src/omega_numeric_divsqrt_gb10.c:1152. */ @@ -197,8 +198,8 @@ int omega_blackwell_execute_matmul(const OmegaMatMulSpec *spec, if (b_bytes < 0x1000) b_bytes = 0x1000; size_t c_bytes = ((size_t)spec->m * spec->n * sizeof(uint32_t) + 0xFFFULL) & ~0xFFFULL; if (c_bytes < 0x1000) c_bytes = 0x1000; - size_t code_bytes = (kernel->code_size + 0xFFFULL) & ~0xFFFULL; - if (code_bytes < 0x1000) code_bytes = 0x1000; + size_t code_bytes = omega_gpu_code_alloc_bytes(kernel->code_size); /* code + 2 KB prefetch tail, page rounded */ + if (code_bytes == 0) return -1; NvrmMem code_mem, cbank_mem, a_mem, b_mem, c_mem, marker_mem, qmd_mem; if (nvrm_alloc_gpu_uncached(&ctx.rm, code_bytes, &code_mem) != 0) { m16_native_close(&ctx); return -1; } @@ -211,6 +212,7 @@ int omega_blackwell_execute_matmul(const OmegaMatMulSpec *spec, /* Copy dynamic machine code into code_mem */ memcpy(code_mem.cpu, kernel->code, kernel->code_size); + memset((uint8_t *)code_mem.cpu + kernel->code_size, 0, code_bytes - kernel->code_size); /* Populate input buffers A, B and initialize C with poison */ memcpy(a_mem.cpu, h_a, (size_t)spec->m * spec->k * sizeof(uint32_t)); @@ -448,8 +450,8 @@ int omega_blackwell_execute_matmul_tensor(const OmegaMatMulSpec *spec, if (b_bytes < 0x1000) b_bytes = 0x1000; size_t c_bytes = ((c_elems * 4) + 0xFFFULL) & ~0xFFFULL; if (c_bytes < 0x1000) c_bytes = 0x1000; - size_t code_bytes = (kernel->code_size + 0xFFFULL) & ~0xFFFULL; - if (code_bytes < 0x1000) code_bytes = 0x1000; + size_t code_bytes = omega_gpu_code_alloc_bytes(kernel->code_size); /* code + 2 KB prefetch tail, page rounded */ + if (code_bytes == 0) return -1; NvrmMem code_mem, cbank_mem, a_mem, b_mem, c_mem, marker_mem, qmd_mem; if (nvrm_alloc_gpu_uncached(&ctx.rm, code_bytes, &code_mem) != 0) { m16_native_close(&ctx); return -1; } @@ -462,6 +464,7 @@ int omega_blackwell_execute_matmul_tensor(const OmegaMatMulSpec *spec, /* Copy dynamic machine code into code_mem */ memcpy(code_mem.cpu, kernel->code, kernel->code_size); + memset((uint8_t *)code_mem.cpu + kernel->code_size, 0, code_bytes - kernel->code_size); /* Populate input buffers A, B and initialize C with poison */ memcpy(a_mem.cpu, h_a, a_elems * 2); diff --git a/src/omega_gpu_attention_api.c b/src/omega_gpu_attention_api.c index 64249473c..96fae92af 100644 --- a/src/omega_gpu_attention_api.c +++ b/src/omega_gpu_attention_api.c @@ -541,7 +541,7 @@ static int kernel_for(bool f32, uint32_t log2bs, uint32_t log2gqa, bool upload, *hit = false; } if (upload && !s->code.cpu) { - if (omega_gpu_session_alloc(s->kernel.code_size, &s->code) != 0) return OMEGA_GPU_ATTN_CHIP_FAIL; + if (omega_gpu_session_alloc_code(s->kernel.code_size, &s->code) != 0) return OMEGA_GPU_ATTN_CHIP_FAIL; memcpy(s->code.cpu, s->kernel.code, s->kernel.code_size); __asm__ volatile("dsb sy" ::: "memory"); } diff --git a/src/omega_gpu_code_alloc.h b/src/omega_gpu_code_alloc.h new file mode 100644 index 000000000..60be2332e --- /dev/null +++ b/src/omega_gpu_code_alloc.h @@ -0,0 +1,36 @@ +/* Size of a GPU code buffer. Header only: no device, no physics headers. + * + * The SM instruction cache prefetches past the last instruction of a kernel, so the code buffer must + * stay mapped for 2 KB after the code. Source (NVIDIA guidance as recorded by Mesa NVK, + * src/nouveau/vulkan/nvk_device.c, shader heap set-up): "the I-cache pre-fetches and NVIDIA has + * informed us overallocating shaders BOs by 2K is sufficient". A page-rounded buffer alone leaves + * whatever happens to be left in the last page (2560 B of code: 1536 B; 2688 B: 1408 B). + * + * omega#323 (2026-10-07): GB10 Xid 31, GPCCLIENT_GCC FAULT_PTE read on a page boundary while the + * head_dim 128 attention kernel (2688 B) ran; that this tail is the cause is INFERRED until the + * padded build turns the fault off on the chip. Every code upload sizes its buffer here so no site + * can drop the tail (tests/test_omega_gpu_code_alloc.c also scans src/ for page-rounded code sizes). + */ +#ifndef OMEGA_GPU_CODE_ALLOC_H +#define OMEGA_GPU_CODE_ALLOC_H + +#include +#include + +#define OMEGA_GPU_CODE_PREFETCH_TAIL 2048u +#define OMEGA_GPU_CODE_PAGE 0x1000u + +/* Bytes to allocate for code_size bytes of code: code + 2 KB, rounded up to a page, at least one page. + * 0 when the sum would overflow (callers refuse the upload). */ +static inline size_t omega_gpu_code_alloc_bytes(size_t code_size) { +#ifdef OMEGA_GPU_CODE_ALLOC_MUTANT_NO_TAIL + const size_t tail = 0; /* mutant: the page-rounded size every site used before omega#323 */ +#else + const size_t tail = OMEGA_GPU_CODE_PREFETCH_TAIL; +#endif + if (code_size > SIZE_MAX - tail - (OMEGA_GPU_CODE_PAGE - 1u)) return 0; + size_t b = (code_size + tail + (OMEGA_GPU_CODE_PAGE - 1u)) & ~(size_t)(OMEGA_GPU_CODE_PAGE - 1u); + return b < OMEGA_GPU_CODE_PAGE ? OMEGA_GPU_CODE_PAGE : b; +} + +#endif diff --git a/src/omega_gpu_elementwise_api.c b/src/omega_gpu_elementwise_api.c index b16c70205..6002d3ed8 100644 --- a/src/omega_gpu_elementwise_api.c +++ b/src/omega_gpu_elementwise_api.c @@ -927,7 +927,7 @@ static int kernel_for(OmegaGpuEwOp op, bool upload, Slot **out, bool *hit) { *hit = false; } if (upload && !s->code.cpu) { - if (omega_gpu_session_alloc(s->kernel.code_size, &s->code) != 0) return OMEGA_GPU_EW_CHIP_FAIL; + if (omega_gpu_session_alloc_code(s->kernel.code_size, &s->code) != 0) return OMEGA_GPU_EW_CHIP_FAIL; memcpy(s->code.cpu, s->kernel.code, s->kernel.code_size); __asm__ volatile("dsb sy" ::: "memory"); } diff --git a/src/omega_gpu_matmul_api.c b/src/omega_gpu_matmul_api.c index bb797d4c9..d27f2912f 100644 --- a/src/omega_gpu_matmul_api.c +++ b/src/omega_gpu_matmul_api.c @@ -147,7 +147,7 @@ static int kernel_for(uint32_t kp, uint32_t np, uint32_t grid_x, CacheSlot **out if (omega_blackwell_codegen_matmul_tensor_loop(&spec, grid_x, g.mutant, &kernel) != 0 || !kernel.code || kernel.code_size == 0) return OMEGA_GPU_MATMUL_CODEGEN_FAIL; NvrmMem code; - if (omega_gpu_session_alloc(kernel.code_size, &code) != 0) { omega_blackwell_kernel_free(&kernel); return OMEGA_GPU_MATMUL_CHIP_FAIL; } + if (omega_gpu_session_alloc_code(kernel.code_size, &code) != 0) { omega_blackwell_kernel_free(&kernel); return OMEGA_GPU_MATMUL_CHIP_FAIL; } memcpy(code.cpu, kernel.code, kernel.code_size); CacheSlot *s = &g.cache[g.cache_next]; g.cache_next = (g.cache_next + 1) % CACHE_SLOTS; diff --git a/src/omega_gpu_session.c b/src/omega_gpu_session.c index 29207d021..2ecb66d20 100644 --- a/src/omega_gpu_session.c +++ b/src/omega_gpu_session.c @@ -7,6 +7,7 @@ * is now a parameter. Nothing about the sequence changed in this cut. */ #include "omega_gpu_session.h" +#include "omega_gpu_code_alloc.h" #include "omega_blackwell_qmd.h" #include "omega_blackwell_submit.h" #include "nvrm.h" @@ -73,6 +74,14 @@ int omega_gpu_session_alloc(size_t bytes, NvrmMem *out) { return 0; } +int omega_gpu_session_alloc_code(size_t code_size, NvrmMem *out) { + size_t bytes = omega_gpu_code_alloc_bytes(code_size); + if (bytes == 0) { omega_gpu_session_set_error("code size overflow"); memset(out, 0, sizeof *out); return -1; } + if (omega_gpu_session_alloc(bytes, out) != 0) return -1; + memset((uint8_t *)out->cpu + code_size, 0, bytes - code_size); + return 0; +} + void omega_gpu_session_free(NvrmMem *m) { if (m->cpu && g_open && !g_blocked) (void)nvrm_free(&g_s.ctx.rm, m); memset(m, 0, sizeof *m); diff --git a/src/omega_gpu_session.h b/src/omega_gpu_session.h index b48faf52f..949fe1ff0 100644 --- a/src/omega_gpu_session.h +++ b/src/omega_gpu_session.h @@ -92,6 +92,9 @@ int omega_gpu_session_is_blocked(void); /* Caller holds the lock, device open. GPU-uncached allocation, page rounded. */ int omega_gpu_session_alloc(size_t bytes, NvrmMem *out); +/* Caller holds the lock, device open. A GPU code buffer for code_size bytes with the 2 KB instruction + * prefetch tail (omega_gpu_code_alloc.h), the tail zero-filled; the caller copies the code to out->cpu. */ +int omega_gpu_session_alloc_code(size_t code_size, NvrmMem *out); void omega_gpu_session_free(NvrmMem *m); /* no-op when latched or closed; zeroes *m */ /* Caller holds the lock, device open. Makes s->mem at least `bytes` long diff --git a/src/omega_numeric_divsqrt_gb10.c b/src/omega_numeric_divsqrt_gb10.c index 39a4c0989..e8b8a07de 100644 --- a/src/omega_numeric_divsqrt_gb10.c +++ b/src/omega_numeric_divsqrt_gb10.c @@ -23,6 +23,7 @@ #ifndef OMEGA_NUMERIC_CPU_ONLY #include "omega_blackwell_submit.h" #include "omega_numeric_native.h" +#include "omega_gpu_code_alloc.h" #endif /* Recorded after tools/divsqrt_nvdisasm_check.sh matched every word of the @@ -1525,7 +1526,7 @@ int omega_ds_gb10_run(OmegaDsOp op, const uint32_t *a, const uint32_t *b, uint32 ctx.pb_mem = large_pb; size_t bytes = (count * 4 + 0xfffULL) & ~0xfffULL; NvrmMem code_mem, cbank_mem, a_mem, b_mem, out_mem, marker_mem, qmd_mem; - if (nvrm_alloc(&ctx.rm, OMEGA_DS_MAX_CODE_BYTES, &code_mem) != 0 || + if (nvrm_alloc(&ctx.rm, omega_gpu_code_alloc_bytes(OMEGA_DS_MAX_CODE_BYTES), &code_mem) /* + 2 KB prefetch tail */ != 0 || nvrm_alloc(&ctx.rm, 0x1000, &cbank_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &a_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &b_mem) != 0 || diff --git a/src/omega_numeric_gb10.c b/src/omega_numeric_gb10.c index bd6b236db..f774f32b5 100644 --- a/src/omega_numeric_gb10.c +++ b/src/omega_numeric_gb10.c @@ -24,6 +24,7 @@ #include #include #include +#include "omega_gpu_code_alloc.h" #define OMEGA_BW_SETUP_WORDS_COUNT 18 /* Device-failure diagnostics (M20 GB10 instrumentation). Every @@ -115,7 +116,7 @@ int omega_gb10_execute_simt_op(const char *op_name, if (bytes < 0x1000) bytes = 0x1000; NvrmMem code_mem, cbank_mem, a_mem, b_mem, c_mem, out_mem, marker_mem, qmd_mem; - if (nvrm_alloc(&ctx.rm, 0x1000, &code_mem) != 0 || + if (nvrm_alloc(&ctx.rm, omega_gpu_code_alloc_bytes(0x1000), &code_mem) != 0 || /* 4 KB of code + 2 KB prefetch tail */ nvrm_alloc(&ctx.rm, 0x1000, &cbank_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &a_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &b_mem) != 0 || @@ -134,7 +135,7 @@ int omega_gb10_execute_simt_op(const char *op_name, /* Calibrated sm_121 vecadd with this op's patch; no default instruction. */ size_t out_code_len = 0; - if (omega_numeric_build_kernel(info->op, code_mem.cpu, code_mem.size, &out_code_len) != OMEGA_NUMERIC_OK) { + if (omega_numeric_build_kernel(info->op, code_mem.cpu, 0x1000, &out_code_len) != OMEGA_NUMERIC_OK) { return GB10_FAIL("build_kernel", 1, -1); } diff --git a/src/omega_numeric_ldst_gb10.c b/src/omega_numeric_ldst_gb10.c index 870f66c76..3c68e4250 100644 --- a/src/omega_numeric_ldst_gb10.c +++ b/src/omega_numeric_ldst_gb10.c @@ -13,6 +13,7 @@ #ifndef OMEGA_NUMERIC_CPU_ONLY #include "omega_blackwell_submit.h" #include "omega_numeric_native.h" +#include "omega_gpu_code_alloc.h" #endif #define NINSN 24u @@ -274,7 +275,7 @@ int omega_ldst_gb10_run(const OmegaLdstSpec *s, const uint8_t *in_buf, size_t in size_t in_dev = in_len > count * 4 ? in_len : count * 4; size_t in_bytes = (in_dev + 0xfffULL) & ~0xfffULL, out_bytes = (out_len + 0xfffULL) & ~0xfffULL; NvrmMem code_mem, cbank_mem, a_mem, out_mem, marker_mem, qmd_mem; - if ((drc = nvrm_alloc(&ctx.rm, OMEGA_DS_MAX_CODE_BYTES, &code_mem)) != 0 || (drc = nvrm_alloc(&ctx.rm, 0x1000, &cbank_mem)) != 0 || + if ((drc = nvrm_alloc(&ctx.rm, omega_gpu_code_alloc_bytes(OMEGA_DS_MAX_CODE_BYTES), &code_mem) /* + 2 KB prefetch tail */) != 0 || (drc = nvrm_alloc(&ctx.rm, 0x1000, &cbank_mem)) != 0 || (drc = nvrm_alloc(&ctx.rm, in_bytes, &a_mem)) != 0 || (drc = nvrm_alloc(&ctx.rm, out_bytes, &out_mem)) != 0 || (drc = nvrm_alloc_gpu_uncached(&ctx.rm, 0x1000, &marker_mem)) != 0 || (drc = nvrm_alloc(&ctx.rm, 0x10000, &qmd_mem)) != 0) { omega_numeric_native_close(&ctx); diff --git a/src/omega_numeric_reduce_gb10.c b/src/omega_numeric_reduce_gb10.c index fa1796f8c..931affc26 100644 --- a/src/omega_numeric_reduce_gb10.c +++ b/src/omega_numeric_reduce_gb10.c @@ -48,6 +48,7 @@ #include #include #include +#include "omega_gpu_code_alloc.h" static unsigned g_last_launches; @@ -335,7 +336,7 @@ static int run_chunk(OmegaReduceOp op, const float *in, float *out_res, size_t c size_t bytes = (count * sizeof(float) + 0xfffULL) & ~0xfffULL; if (bytes < 0x1000) bytes = 0x1000; NvrmMem code_mem, cbank_mem, a_mem, b_mem, c_mem, out_mem, marker_mem, qmd_mem; - if (nvrm_alloc(&ctx.rm, 0x1000, &code_mem) != 0 || nvrm_alloc(&ctx.rm, 0x1000, &cbank_mem) != 0 || + if (nvrm_alloc(&ctx.rm, omega_gpu_code_alloc_bytes(0x1000), &code_mem) != 0 || nvrm_alloc(&ctx.rm, 0x1000, &cbank_mem) != 0 || /* code: 4 KB + 2 KB prefetch tail */ nvrm_alloc(&ctx.rm, bytes, &a_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &b_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &c_mem) != 0 || nvrm_alloc(&ctx.rm, bytes, &out_mem) != 0 || nvrm_alloc_gpu_uncached(&ctx.rm, 0x1000, &marker_mem) != 0 || nvrm_alloc(&ctx.rm, 0x10000, &qmd_mem) != 0) { @@ -346,7 +347,7 @@ static int run_chunk(OmegaReduceOp op, const float *in, float *out_res, size_t c memset(out_mem.cpu, 0x55, count * sizeof(float)); size_t code_len = 0; - if (omega_blackwell_encode_vecadd(code_mem.cpu, code_mem.size, &code_len) != 0 || + if (omega_blackwell_encode_vecadd(code_mem.cpu, 0x1000, &code_len) != 0 || code_len < OMEGA_NUMERIC_PATCH_OFFSET + (size_t)np * 16u) { return GB10_FAIL("build_kernel", 1, -1); } diff --git a/src/runtime/rx_resident_gpu.c b/src/runtime/rx_resident_gpu.c index 9a8272001..f022c2849 100644 --- a/src/runtime/rx_resident_gpu.c +++ b/src/runtime/rx_resident_gpu.c @@ -8,6 +8,7 @@ #include "omega_blackwell_codegen.h" #include "omega_blackwell_qmd.h" #include "omega_blackwell_submit.h" +#include "omega_gpu_code_alloc.h" #include "m16_native.h" #include @@ -17,6 +18,9 @@ #include #include +/* Code capacity of a seat (the code buffer adds the 2 KB prefetch tail on top). */ +#define RX_GPU_CODE_CAP 0x4000u + #define LDG_CTL 0x001ea800u #define CRC_POLY 0x82F63B78u /* Safety stop if shutdown is never posted. A real shutdown leaves sooner. @@ -722,7 +726,7 @@ static void *launch_main(void *arg) { RxGpuSeat *s = job->seat; M16NativeContext *ctx = &s->ctx; if (!job->have_mem) { - if (nvrm_alloc(&ctx->rm, 0x4000, &job->code_mem) != 0 || + if (nvrm_alloc(&ctx->rm, omega_gpu_code_alloc_bytes(RX_GPU_CODE_CAP), &job->code_mem) != 0 || /* + 2 KB prefetch tail */ nvrm_alloc(&ctx->rm, 0x1000, &job->cbank_mem) != 0 || nvrm_alloc(&ctx->rm, 0x10000, &job->qmd_mem) != 0 || nvrm_alloc_gpu_uncached(&ctx->rm, 0x1000, &job->marker_mem) != 0 || @@ -1021,6 +1025,11 @@ int rx_gpu_seat_begin(RxWorld *w, RxGpuSeat **out) { free(code); return -1; } + if (emitted > RX_GPU_CODE_CAP) { /* the seat's code buffer holds RX_GPU_CODE_CAP bytes; refuse rather than overrun it */ + fprintf(stderr, "seat: program is %zu bytes, the code buffer holds %u\n", emitted, (unsigned)RX_GPU_CODE_CAP); + free(code); + return -1; + } seat_scoreboard(code, emitted); if (!first_is_lane_check(code, emitted)) { free(code); diff --git a/tests/test_omega_gpu_code_alloc.c b/tests/test_omega_gpu_code_alloc.c new file mode 100644 index 000000000..00c78e9c8 --- /dev/null +++ b/tests/test_omega_gpu_code_alloc.c @@ -0,0 +1,31 @@ +/* GPU code buffer sizing (src/omega_gpu_code_alloc.h): code + 2 KB instruction prefetch tail, page rounded. + * Host only. The NO_TAIL mutant (the page-rounded size used before omega#323) must fail. */ +#include "omega_gpu_code_alloc.h" +#include +#include + +static int fails; +#define CHECK(c, ...) do { if (!(c)) { fails++; printf("FAIL: "); printf(__VA_ARGS__); printf("\n"); } } while (0) + +int main(void) { + /* the two attention kernels of omega#323: 2560 B (head_dim 64) and 2688 B (head_dim 128) */ + CHECK(omega_gpu_code_alloc_bytes(2560) == 8192, "2560 B of code -> 8192 (got %zu)", omega_gpu_code_alloc_bytes(2560)); + CHECK(omega_gpu_code_alloc_bytes(2688) == 8192, "2688 B of code -> 8192 (got %zu)", omega_gpu_code_alloc_bytes(2688)); + CHECK(omega_gpu_code_alloc_bytes(2048) == 4096, "2048 B of code fits one page with the tail (got %zu)", omega_gpu_code_alloc_bytes(2048)); + CHECK(omega_gpu_code_alloc_bytes(2049) == 8192, "2049 B of code needs a second page (got %zu)", omega_gpu_code_alloc_bytes(2049)); + CHECK(omega_gpu_code_alloc_bytes(0) == 4096, "empty code -> one page (got %zu)", omega_gpu_code_alloc_bytes(0)); + CHECK(omega_gpu_code_alloc_bytes(0x4000) == 0x5000, "16 KB capacity -> 20 KB (got %zu)", omega_gpu_code_alloc_bytes(0x4000)); + CHECK(omega_gpu_code_alloc_bytes(SIZE_MAX) == 0, "overflow refused"); + CHECK(omega_gpu_code_alloc_bytes(SIZE_MAX - 2048) == 0, "overflow near the limit refused"); + /* every size: at least 2 KB mapped after the code, page multiple, no more than one extra page */ + for (size_t n = 1; n <= 64 * 1024; n += 16) { + size_t b = omega_gpu_code_alloc_bytes(n); + if (b < n + OMEGA_GPU_CODE_PREFETCH_TAIL || b % OMEGA_GPU_CODE_PAGE != 0 || b > n + OMEGA_GPU_CODE_PREFETCH_TAIL + OMEGA_GPU_CODE_PAGE) { + CHECK(0, "%zu B of code -> %zu B (needs >= code + 2048, page multiple)", n, b); + break; + } + } + if (fails) { printf("OMEGA_GPU_CODE_ALLOC FAIL (%d)\n", fails); return 1; } + printf("OMEGA_GPU_CODE_ALLOC PASS\n"); + return 0; +} From f1d57c56c8ff277dfd1fc97b3d01c739e29f9900 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 6 Oct 2026 21:42:07 -0500 Subject: [PATCH 2/4] crumb: recompile Co-Authored-By: Claude Opus 5.5 --- .crumb | 26 +++++++++++++------------- mk/.crumb | 10 +++++----- src/.crumb | 16 ++++++++-------- src/runtime/.crumb | 8 ++++---- tests/.crumb | 12 ++++++------ 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.crumb b/.crumb index e3af66e3c..e8dc98a1c 100644 --- a/.crumb +++ b/.crumb @@ -52,7 +52,7 @@ }, { "digest": "acb4b39846f70c6ed1388aed49c2be8e94bacc05c56e1ac4c5d596717882c1f3", - "last_commit": "21baec6", + "last_commit": "c0369e6", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -63,8 +63,8 @@ "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "2e4b0cb0c91b5da2ddd89f9fe8adf08eb30a8652e2a226fd0396257b3081109a", - "last_commit": "62b6a28", + "digest": "f2d9839725a355ae85e54d047a70e3641d94cb6547df33eb532e16d925f544fe", + "last_commit": "e09adff", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, @@ -87,14 +87,14 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "48c4ef0ed53e3daac0f20dab1d5534e8288398c9d89a6fe4cadb99325372efb3", - "last_commit": "21baec6", + "digest": "b029d6586df469b9c198b733749582f7fe724c1a35b62af7583a08c1df67b392", + "last_commit": "e09adff", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "48a04fe5705d3aa90132af9e80604e233dcbb29adfa9ebeeb1c0ef960acb01d8", - "last_commit": "21baec6", + "digest": "bcc2c5b959587ff0b115cd4664886cbca17cf7fc0f36a601f1b5c7edb9f05b7d", + "last_commit": "e09adff", "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:4d78d3bf3efba57eb7348576f91dd88cdc6765c91f69c86bdcff69a8ebcf7c11", - "compiled_at": "2026-10-06T19:14:24Z", + "children_root": "sha256:87e095b4a1eae6ee1dd0f225c362771e49ee3ac542c4d125f0760fcdc009161b", + "compiled_at": "2026-10-07T02:42:06Z", "compiler": "crumb-compile/1", - "digest": "sha256:42ebf3db0a3abb954904fc66d5c6ffbfdf36c16b935eebd1a6931efc33110568", + "digest": "sha256:8812e0794080481543c8ba1cf2d9103f9d96757495a5d5ba90a62b96e1078080", "evidence_files": 4743, "evidence_root": "sha256:34547c38b5669eb80fad819b39b679c1b425c66bc3e69d11431d684390b900e9", - "files": 6580, - "generated_at_commit": "aa2d134f49ce50c441da54ddd8292ccacfdc86e4", - "source_tree": "sha256:02a300da6607c023cd282e97a1ccd1bfa6a2ddd9f63c7c1ff7b622699f4f561c" + "files": 6583, + "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", + "source_tree": "sha256:537d365b1471fcc12ed68e1ce28e32c3595796414b070245b0b918e4d0c43c16" }, "owner_lane": "", "provenance": { diff --git a/mk/.crumb b/mk/.crumb index 5dcc05c9b..58d54f96a 100644 --- a/mk/.crumb +++ b/mk/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-06T02:24:19Z", + "compiled_at": "2026-10-07T02:42:06Z", "compiler": "crumb-compile/1", - "digest": "sha256:2e4b0cb0c91b5da2ddd89f9fe8adf08eb30a8652e2a226fd0396257b3081109a", + "digest": "sha256:f2d9839725a355ae85e54d047a70e3641d94cb6547df33eb532e16d925f544fe", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 59, - "generated_at_commit": "df6bc1cd3e0fbb70807274858bd734eb677be72c", - "source_tree": "sha256:cf008ab8f3f0b846e5762f4209ec3929f9c0f860a1f1b5923df9744ee5782d67" + "files": 60, + "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", + "source_tree": "sha256:d0122a82af21d75c1155b949e87e9e60e0839977259af31d54afe657497a79ca" }, "owner_lane": "", "provenance": { diff --git a/src/.crumb b/src/.crumb index da98408d2..506892a48 100644 --- a/src/.crumb +++ b/src/.crumb @@ -133,8 +133,8 @@ "purpose": "Directory src/polyglot. Purpose not yet described by a human." }, { - "digest": "232cde4802eb94e5eece9b2ca8f92636559958aa17ce8f24f0ae03bebaf4c176", - "last_commit": "62b6a28", + "digest": "f10ed6fdd6a931cddda0159cdef1c98ddb3526c58595b3ca60631cc380410799", + "last_commit": "e09adff", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, @@ -169,15 +169,15 @@ "purpose": "Directory src/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:f49f5aa012a5120f4c38a20c4f4db4555b292e7d7cc4f37bc2ff2b7494b550d1", - "compiled_at": "2026-10-06T18:55:17Z", + "children_root": "sha256:564cf410317a627d546c0c234bd632ba414ca943ecca4fd4c8eccc45d863bb48", + "compiled_at": "2026-10-07T02:42:06Z", "compiler": "crumb-compile/1", - "digest": "sha256:48c4ef0ed53e3daac0f20dab1d5534e8288398c9d89a6fe4cadb99325372efb3", + "digest": "sha256:b029d6586df469b9c198b733749582f7fe724c1a35b62af7583a08c1df67b392", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 411, - "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", - "source_tree": "sha256:d9b07fcbab1f66753a569b7671d8a8ab44154a0d8c847437a89d1c4aa25750d0" + "files": 412, + "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", + "source_tree": "sha256:3c0fefc1510f9a906df161fcd778a3464d053ba8a5c7b96814c1970f18de609c" }, "owner_lane": "", "provenance": { diff --git a/src/runtime/.crumb b/src/runtime/.crumb index 0975d8c96..b748f3c30 100644 --- a/src/runtime/.crumb +++ b/src/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-06T18:55:17Z", + "compiled_at": "2026-10-07T02:42:06Z", "compiler": "crumb-compile/1", - "digest": "sha256:232cde4802eb94e5eece9b2ca8f92636559958aa17ce8f24f0ae03bebaf4c176", + "digest": "sha256:f10ed6fdd6a931cddda0159cdef1c98ddb3526c58595b3ca60631cc380410799", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 63, - "generated_at_commit": "a76a010c6414378b1f6abc8020837ae094ebe7ed", - "source_tree": "sha256:c8978d2ea285802f890b60974c9f6d4da675bc9cb54edc24acf39038a34480e1" + "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", + "source_tree": "sha256:fb7a241c8637f3898f72efad8644828669e659710d6f41058b0314c1572d5287" }, "owner_lane": "", "provenance": { diff --git a/tests/.crumb b/tests/.crumb index 613c98dc0..94c254676 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -254,7 +254,7 @@ }, { "digest": "58546f913d961949734134a836d26504d48c66e6b07d6a774426bfa086f7d6b6", - "last_commit": "c44185c", + "last_commit": "c0369e6", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -284,14 +284,14 @@ } ], "children_root": "sha256:c630c07cfd744174cf35b42b04d96bbb15dfedb76557947943c412d3219586c5", - "compiled_at": "2026-10-06T19:13:39Z", + "compiled_at": "2026-10-07T02:42:06Z", "compiler": "crumb-compile/1", - "digest": "sha256:48a04fe5705d3aa90132af9e80604e233dcbb29adfa9ebeeb1c0ef960acb01d8", + "digest": "sha256:bcc2c5b959587ff0b115cd4664886cbca17cf7fc0f36a601f1b5c7edb9f05b7d", "evidence_files": 11, "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2", - "files": 817, - "generated_at_commit": "c44185c54ef6363f3ce3f61f547c8ce323b1cfae", - "source_tree": "sha256:62f0f6c749b0bcbe10827a0bebf3617c2d76c38a4d661e9eb6430bd9554fac1f" + "files": 818, + "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", + "source_tree": "sha256:8dac66cd864267c9213b963add2bd94859d0acef2d846982c54c77fc83b309d3" }, "owner_lane": "", "provenance": { From afa40707e02617d4055ecf50a7a81515270981fc Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 6 Oct 2026 21:55:36 -0500 Subject: [PATCH 3/4] evidence: omega#324 GB10 receipts (hd64 regression PASS on f1d57c5; hd128 red/green 1/1 fault vs 5/5 clean) Co-Authored-By: Claude Opus 5.5 --- evidence/CODEPAD-PREFETCH-f1d57c5/NOTES.md | 21 + .../hd64-regression/5-kernel-log.txt | 1 + .../hd64-regression/SHA256SUMS | 12 + .../hd64-regression/build.log | 2 + .../hd64-regression/device.txt | 5 + .../hd64-regression/gpu_attention_test.c | 849 +++++++++++++++++ .../hd64-regression/ground.txt | 12 + .../hd64-regression/hold-end.txt | 1 + .../hd64-regression/hold-start.txt | 1 + .../hd64-regression/omega_gpu_attention_api.c | 892 ++++++++++++++++++ .../hd64-regression/omega_gpu_attention_api.h | 205 ++++ .../hd64-regression/receipt.json | 1 + .../hd64-regression/run.log | 49 + .../hd64-regression/sim.log | 49 + .../hd64-regression/status.txt | 1 + .../hd64-regression/sweep.json | 1 + .../hd64-regression/sweep.log | 74 ++ .../hd64-regression/timing.json | 1 + .../hd64-regression/timing.log | 2 + .../red-green-probe/1-red-baseline.log | 69 ++ .../red-green-probe/2-green-padded-1.log | 69 ++ .../red-green-probe/2-green-padded-2.log | 69 ++ .../red-green-probe/2-green-padded-3.log | 69 ++ .../red-green-probe/2-green-padded-4.log | 69 ++ .../red-green-probe/2-green-padded-5.log | 69 ++ .../3-hd128-padded-receipt.json | 1 + .../red-green-probe/3-hd128-padded.log | 56 ++ .../red-green-probe/5-kernel-log.txt | 1 + .../red-green-probe/end.txt | 1 + .../red-green-probe/ground.txt | 12 + .../red-green-probe/start.txt | 1 + .../red-green-probe/status.txt | 7 + .../red-green-probe/va_camera.c | 81 ++ .../red-green-probe/window.sh | 28 + 34 files changed, 2781 insertions(+) create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/NOTES.md create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/5-kernel-log.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/SHA256SUMS create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/build.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/device.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/gpu_attention_test.c create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/ground.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-end.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-start.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.c create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.h create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/receipt.json create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/run.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sim.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/status.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.json create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.json create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/1-red-baseline.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-1.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-2.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-3.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-4.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-5.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded-receipt.json create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded.log create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/5-kernel-log.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/end.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/ground.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/start.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/status.txt create mode 100644 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/va_camera.c create mode 100755 evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/window.sh diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/NOTES.md b/evidence/CODEPAD-PREFETCH-f1d57c5/NOTES.md new file mode 100644 index 000000000..e9113746f --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/NOTES.md @@ -0,0 +1,21 @@ +# omega#324 GB10 evidence, 2026-10-07 (session d6d82f, windows approved by merge control 3649dd) + +Code under test: omega f1d57c5 (#324 head: c0369e6 + code commit e09adff + crumb recompile). Physics 6d7cf0d (physics.lock). Driver 580.173.02. +Nothing patched or rerun after the runs. Investigation record (sealed): ~/workspace/investigations/2026-10-07-hd128-ctx256-stall. + +## hd64 regression on the #324 head (hd64-regression/), hold b 02:54:45Z-02:54:55Z +- tools/run_gpu_attention_chip.sh rc 0: run.log PASS 122/0, sweep PASS 73/0, timing PASS 2/0, sim.log PASS 122/0. device.txt: omega f1d57c5, 0 uncommitted paths. Kernel log for the hold: no Xid. +- Disclosure: session 711736 ran a CPU-only cargo compile 02:54:32Z-02:54:56Z, overlapping the whole hold. Parity is unaffected; the timing gate result is possibly CPU-contended. + +## Red/green for the cause (red-green-probe/), hold a 02:44:25Z-02:54:27Z +Builds side by side, one variable: baseline = omega 9a20ca8 (omega#323 head, untouched); padded = probe commit c7663bb = 9a20ca8 + e09adff (this PR's code commit) only. Camera: va_camera.c (link-time wrap of nvrm_alloc / nvrm_alloc_gpu_uncached / nvrm_free; code buffer found by content; no change in the launch path). Sequence per process: hd128 gqa_f32 32q/8kv ctx 1, 17, 256. +- RED 1/1 (1-red-baseline.log): ctx1 rc 0, ctx17 rc 0, ctx256 rc -4 (CHIP_FAIL) after the 600 s host wait. Kernel log 02:44:26Z: Xid 31, name=va_camera_base, GPCCLIENT_GCC faulted @ 0x10_04134000, FAULT_PTE ACCESS_TYPE_VIRT_READ. Camera: code_va 0x1004133000, alloc 0x1000 (1408 B after the 2688 B of code); the page after it (0x1004134000 = the fault address) was mapped by another buffer after ctx1 and unmapped after the ctx17 scratch regrowth. +- GREEN 5/5 (2-green-padded-1..5.log): ctx 1, 17, 256 all rc 0, unwritten 0; ctx256 max_abs_err 2.25e-7 vs an f64 CPU reference; code alloc 0x2000, code_end+2047 mapped. +- hd128 full battery on the probe build (3-hd128-padded.log): PASS 126/0. This is the probe, not omega#323's final head. +- Kernel log for hold a (5-kernel-log.txt): exactly one Xid, the baseline's. + +## Claims +- OBSERVED: with the unpadded code buffer, the hd128 kernel faults reading the page after its code when that page is unmapped; with the 2 KB tail it does not (1/1 vs 5/5, same process sequence, one variable). +- DOCUMENTED (secondary): Mesa NVK src/nouveau/vulkan/nvk_device.c: "the I-cache pre-fetches and NVIDIA has informed us overallocating shaders BOs by 2K is sufficient". +- INFERRED: the reader is the instruction prefetcher (GCC client). DOCS SILENT on which unit GPCCLIENT_GCC is and on the QMD PROGRAM_PREFETCH_SIZE unit. +- LIMITS: one red trial is not a rate; 5/5 green is not a rate either; hd64 kernels were never observed to fault (same latent gap, fixed here too). diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/5-kernel-log.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/5-kernel-log.txt new file mode 100644 index 000000000..6ba17d74f --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/5-kernel-log.txt @@ -0,0 +1 @@ +-- No entries -- diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/SHA256SUMS b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/SHA256SUMS new file mode 100644 index 000000000..a0aa39ded --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/SHA256SUMS @@ -0,0 +1,12 @@ +0f9c7cccbfaab7f11a76c834f06a34156f949fb3cb932d9747196f085d68ab10 build.log +e980945c65d4d480a2f4c8d9e6e3f1086271d92b2269a4ac17a19da5c1d49413 device.txt +8d2c2416ed5afb7d373f50603e1a2f3cd6989083cc04b97439d4dfe648d2f3ce gpu_attention_test.c +aed0c9d0044091974996774e2ad405600e778d5cf59bbd31439065673f576404 omega_gpu_attention_api.c +c72f7082f59fd061c1a8287d8a18aac2d7ff612959539fe616d99416a3043246 omega_gpu_attention_api.h +56c3a4b57fa6df41c5e3aa89df7ec7547441bbd9891b7cb4a098f7ff6b5a3194 receipt.json +1fe0f3a65ae512e936c3f69b39ccb381b5fa34cd25c10a37aa268c796664d352 run.log +61092515baa226484b92b8f25ec237c1c866200368884203bf24d2fa894198a1 sim.log +dec4370fd3f094c389ae9acfe93375d7cabc7962cd42d74efdd9ec1134f1cd8b sweep.json +cda266d48158d2871afe13da37c0370a3941d0a6731fca64e632a8b172ad2553 sweep.log +5182efa6872e0faf8cb544ada5f7dd31f96cc56974fe4978c2f7564e3dee7d5e timing.json +62947c750b8b64a74f8960893ca7659dad93d435a9f5e9f85ecc33d767d68ba9 timing.log diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/build.log b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/build.log new file mode 100644 index 000000000..033297390 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/build.log @@ -0,0 +1,2 @@ +ar rcs build/libomega_gpu.a build/sha256.o build/omega_canonical.o build/omega_validate.o build/omega_core.o build/omega_codec.o build/aarch64_encoder.o build/aarch64_decoder.o build/omega_realize.o build/omega_exec.o build/omega_self_host.o build/omega_verify.o build/omega_program.o build/omega_synthesis.o build/omega_library.o build/omega_discovery.o build/omega_machine.o build/omega_realize_synth.o build/omega_matvec.o build/omega_accelerator.o build/omega_accelerator_world.o build/omega_vector.o build/omega_blackwell_encoder.o build/omega_blackwell_qmd.o build/omega_blackwell_realize.o build/omega_blackwell_submit.o build/omega_blackwell_engine.o build/omega_gpu_engine.o build/omega_blackwell_matmul.o build/omega_blackwell_codegen.o build/omega_gpu_session.o build/omega_gpu_matmul_api.o build/omega_gpu_elementwise_api.o build/omega_gpu_attention_api.o build/omega_gpu_wait.o build/omega_evidence.o build/m16_native.o build/nvrm.o build/omega_program_ir.o build/omega_vc_bridge.o build/omega_resolve.o build/omega_receipt.o build/omega_blake3.o build/omega_vcstore.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I../physics/m16 -I../physics/nvrm -I../physics/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I../physics/third_party/nvidia-open-580.173.02/kernel-open/common/inc -I../physics/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I../physics/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -ffp-contract=off -Itests -o build/gpu_attention_test tests/gpu_attention_test.c build/libomega_gpu.a -lpthread -lm diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/device.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/device.txt new file mode 100644 index 000000000..12dbe88a7 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/device.txt @@ -0,0 +1,5 @@ +Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux +NVIDIA GB10, 580.173.02 +omega f1d57c56c8ff277dfd1fc97b3d01c739e29f9900 (0 uncommitted paths) +physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +2026-10-07T02:54:46Z diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/gpu_attention_test.c b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/gpu_attention_test.c new file mode 100644 index 000000000..1f0019a50 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/gpu_attention_test.c @@ -0,0 +1,849 @@ +/* gpu_attention_test: FB-1 cut 5 gate for omega_gpu_attention_api. + * + * ./gpu_attention_test --host-only refusals, codegen (both kernel families and every + * mutant), register budget, nvdisasm listing check + * ./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 + * 1..64 x every kv-head divisor x ctx 256/2048, parity + timings + * (receipt OMEGA_GPU_ATTENTION_SWEEP_V1; --sim marks host timings) + * ./gpu_attention_test --out receipt.json chip gate: every shape against the host oracle, the + * mutants (deliberately wrong kernels, all of + * 1 .. OMEGA_GPU_ATTN_MUTANT_COUNT-1) which the same + * check must catch, a negative control, timings + * + * Oracles re-state aien-sovereign-core crates/aien-inference-abi/src/backend.rs (main 8b5caed) in C: + * ReferenceCpuBackend::gqa_attention (f64 scores, max, exp, sum, 1/max(sum,1e-12), f64 weighted sum), + * TensorBackend::paged_attention (f64 online softmax token by token over the paged bf16 pool, tokens + * past the block table dropped, zeros for empty context) and paged_attention_batch (ctx <= 0 -> 0, + * table rows past the array -> empty, negative entries removed). Compiled with -ffp-contract=off. + * + * Tolerance (why): the chip accumulates the 64-term dot products, the per-chunk sums and the + * rescaled running sums in f32 (worst case about n * 2^-24 relative over n = 2048 terms, 1.2e-4), + * uses MUFU.EX2 (PTX ex2.approx: 2^-22.5 relative) for every weight and for the 32 chunk rescale + * factors, and MUFU.RCP for the final normalisation. Every output is a convex combination of V + * values of unit scale, so |error| <= 2e-4 * |want| + 2e-5 covers these with margin; the mutants + * move results by 1e-2 or more (wrong head, wrong token) or produce NaN (overflow without the max). + * The large-score case (scores up to ~300) carries the f32 rounding of the score itself into the + * exponent (3e-5 absolute per score), so it uses 1e-3 relative + 1e-4 absolute. + */ +#include "omega_gpu_attention_api.h" +#include "omega_gpu_session.h" +#include "omega_blackwell_codegen.h" +#include "bw_warp_sim.h" /* omega #308: SIMT warp simulator for --divergent */ +#include +#include +#include +#include +#include +#include +#include + +static int g_checks, g_failed; +static int g_sim_mode; /* --sim: the host simulator never opens the device */ +static int g_divergent; /* --divergent (omega #308 R2): the j >= ctx branch inside a BSSY/BSYNC region */ +#define CHECK(cond, ...) do { g_checks++; if (!(cond)) { g_failed++; printf("FAIL: "); printf(__VA_ARGS__); printf("\n"); } } while (0) + +static uint32_t lcg(uint32_t *s) { *s = *s * 1664525u + 1013904223u; return *s; } +static float frand(uint32_t *s, float lo, float hi) { return lo + (hi - lo) * ((float)(lcg(s) >> 8) / 16777216.0f); } +static uint16_t f2bf(float f) { uint32_t u; memcpy(&u, &f, 4); uint32_t r = ((u >> 16) & 1u) + 0x7fffu; return (uint16_t)((u + r) >> 16); } +static float bf2f(uint16_t b) { uint32_t u = (uint32_t)b << 16; float f; memcpy(&f, &u, 4); return f; } + +/* ----------------------------------------------------------------- oracles */ +static void oracle_gqa(const float *q, const float *kc, const float *vc, size_t seq_len, size_t nqh, size_t nkv, size_t hd, float *out) { + if (seq_len == 0) { memset(out, 0, nqh * hd * 4); return; } + size_t ratio = nqh / nkv; double inv_sqrt_d = 1.0 / sqrt((double)hd); + double *scores = malloc(seq_len * sizeof *scores); + for (size_t h = 0; h < nqh; h++) { + size_t kvh = h / ratio; const float *qh = q + h * hd; + for (size_t t = 0; t < seq_len; t++) { + const float *kt = kc + (t * nkv + kvh) * hd; double dot = 0.0; + for (size_t d = 0; d < hd; d++) dot += (double)qh[d] * (double)kt[d]; + scores[t] = dot * inv_sqrt_d; + } + double mx = -INFINITY; for (size_t t = 0; t < seq_len; t++) if (scores[t] > mx) mx = scores[t]; + double sum = 0.0; for (size_t t = 0; t < seq_len; t++) { scores[t] = exp(scores[t] - mx); sum += scores[t]; } + double inv = 1.0 / (sum > 1e-12 ? sum : 1e-12); + for (size_t t = 0; t < seq_len; t++) scores[t] *= inv; + for (size_t d = 0; d < hd; d++) { + double s = 0.0; + for (size_t t = 0; t < seq_len; t++) s += scores[t] * (double)vc[(t * nkv + kvh) * hd + d]; + out[h * hd + d] = (float)s; + } + } + free(scores); +} +/* bf16 pool in the canonical layout; the oracle's read_kv_head: element_offset(block, layer, is_value, token) + kv_head*head_dim*2 */ +static const uint16_t *kv_head(const uint8_t *pool, const OmegaGpuKvLayout *ly, size_t blk, size_t layer, int is_v, size_t tok, size_t kvh, size_t hd) { + size_t off = blk * ly->block_stride_bytes + layer * ly->layer_stride_bytes + (is_v ? ly->kv_plane_stride_bytes : 0) + tok * ly->token_stride_bytes + kvh * hd * 2; + return (const uint16_t *)(pool + off); +} +static void oracle_paged(const float *q, const uint8_t *pool, const OmegaGpuKvLayout *ly, const uint32_t *ids, size_t nids, size_t ctx, size_t layer, + size_t nqh, size_t nkv, size_t hd, float *out) { + if (ctx == 0 || nids == 0) { memset(out, 0, nqh * hd * 4); return; } + size_t ratio = nqh / nkv; double inv_sqrt_d = 1.0 / sqrt((double)hd); size_t bs = ly->block_size; + double *acc = malloc(hd * sizeof *acc); + for (size_t h = 0; h < nqh; h++) { + size_t kvh = h / ratio; const float *qh = q + h * hd; + double m = -INFINITY, l = 0.0; for (size_t d = 0; d < hd; d++) acc[d] = 0.0; + for (size_t t = 0; t < ctx; t++) { + size_t bi = t / bs; if (bi >= nids) break; + const uint16_t *kh = kv_head(pool, ly, ids[bi], layer, 0, t % bs, kvh, hd); + const uint16_t *vh = kv_head(pool, ly, ids[bi], layer, 1, t % bs, kvh, hd); + double dot = 0.0; for (size_t d = 0; d < hd; d++) dot += (double)qh[d] * (double)bf2f(kh[d]); + double score = dot * inv_sqrt_d, mn = m > score ? m : score, alpha = exp(m - mn), beta = exp(score - mn); + l = l * alpha + beta; + for (size_t d = 0; d < hd; d++) acc[d] = acc[d] * alpha + beta * (double)bf2f(vh[d]); + m = mn; + } + double inv = l > 0.0 ? 1.0 / l : 0.0; + for (size_t d = 0; d < hd; d++) out[h * hd + d] = (float)(acc[d] * inv); + } + free(acc); +} +static void oracle_batch(const float *q, const uint8_t *pool, const OmegaGpuKvLayout *ly, const int32_t *tables, const int32_t *ctxs, size_t maxb, size_t nseq, + size_t layer, size_t nqh, size_t nkv, size_t hd, float *out) { + size_t stride = nqh * hd; + uint32_t *ids = malloc((maxb ? maxb : 1) * sizeof *ids); + for (size_t s = 0; s < nseq; s++) { + size_t ctx = ctxs[s] > 0 ? (size_t)ctxs[s] : 0, n = 0; + size_t total = nseq * maxb; /* the table array length as the trait sees it */ + if ((s + 1) * maxb <= total) for (size_t b = 0; b < maxb; b++) if (tables[s * maxb + b] >= 0) ids[n++] = (uint32_t)tables[s * maxb + b]; + oracle_paged(q + s * stride, pool, ly, ids, n, ctx, layer, nqh, nkv, hd, out + s * stride); + } + free(ids); +} + +static size_t compare(const float *got, const float *want, size_t n, double rel, double abs_tol, double *worst) { + size_t bad = 0; *worst = 0.0; + for (size_t i = 0; i < n; i++) { + double d = fabs((double)got[i] - (double)want[i]); + double lim = rel * fabs((double)want[i]) + abs_tol; + double scaled = lim > 0 ? d / lim : (d > 0 ? INFINITY : 0.0); + if (scaled > *worst) *worst = scaled; + if (!(d <= lim)) bad++; /* NaN counts as bad */ + } + return bad; +} + +/* ------------------------------------------------------------- host only */ +static int nvdisasm_check(bool f32, const char *name, const char *const *must, int n_must) { + const char *nv = "/usr/local/cuda/bin/nvdisasm"; + if (access(nv, X_OK) != 0) { printf("nvdisasm: not present, listing check skipped for %s\n", name); return 0; } + OmegaBlackwellKernel k; memset(&k, 0, sizeof k); + if (omega_gpu_attention_codegen(f32, f32 ? 12 : 4, 3, &k) != OMEGA_GPU_ATTN_OK) return -1; + char bin[64], lst[64], cmd[256]; + snprintf(bin, sizeof bin, "/tmp/omega_attn_%s_%d.bin", name, (int)getpid()); + snprintf(lst, sizeof lst, "/tmp/omega_attn_%s_%d.sass", name, (int)getpid()); + FILE *f = fopen(bin, "wb"); if (!f) { free(k.code); return -1; } + fwrite(k.code, 1, k.code_size, f); fclose(f); + snprintf(cmd, sizeof cmd, "%s -b SM121 %s > %s 2>&1", nv, bin, lst); + int rc = system(cmd); + free(k.code); + FILE *l = fopen(lst, "r"); if (!l) return -1; + char line[512]; int seen[16] = {0}; int bad = 0, insns = 0; + while (fgets(line, sizeof line, l)) { + if (!strstr(line, "/*0")) continue; + insns++; + if (strstr(line, "?") || strstr(line, "error")) bad++; + for (int i = 0; i < n_must; i++) if (strstr(line, must[i])) seen[i] = 1; + } + fclose(l); + int miss = 0; + for (int i = 0; i < n_must; i++) if (!seen[i]) { printf(" %s: nvdisasm listing lacks %s\n", name, must[i]); miss++; } + printf("nvdisasm %s: rc=%d insns=%d undecodable=%d missing=%d (%s)\n", name, rc, insns, bad, miss, lst); + unlink(bin); + return (rc == 0 && bad == 0 && miss == 0) ? 0 : -1; +} + +static OmegaGpuKvLayout layout_for(uint32_t num_blocks, uint32_t bs, uint32_t layers, uint32_t nkv, uint32_t hd) { + OmegaGpuKvLayout ly; + ly.head_stride_bytes = (uint64_t)hd * 2; ly.token_stride_bytes = ly.head_stride_bytes * nkv; + ly.kv_plane_stride_bytes = ly.token_stride_bytes * bs; ly.layer_stride_bytes = 2 * ly.kv_plane_stride_bytes; + ly.block_stride_bytes = ly.layer_stride_bytes * layers; ly.pool_bytes = ly.block_stride_bytes * num_blocks; + ly.num_blocks = num_blocks; ly.num_layers = layers; ly.block_size = bs; + return ly; +} + +static void host_only(void) { + float q[64 * 64], kv[64 * 64], out[64 * 64]; memset(q, 0, sizeof q); memset(kv, 0, sizeof kv); + CHECK(omega_gpu_gqa_attention_f32(NULL, kv, kv, 1, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "NULL q refused"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 4, 128, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "head_dim 128 refused (TOO_LARGE)"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 6, 2, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "gqa ratio 3 refused"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 1, 32, 5, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "32 q heads / 5 kv heads refused"); + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, OMEGA_GPU_ATTN_MAX_GQA_CTX + 1, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_TOO_LARGE, "context past the envelope refused"); + for (int i = 0; i < 64; i++) out[i] = 1.0f; + OmegaGpuAttnInfo info; + CHECK(omega_gpu_gqa_attention_f32(q, kv, kv, 0, 1, 1, 64, out, &info) == OMEGA_GPU_ATTN_OK && out[0] == 0.0f && out[63] == 0.0f && info.chip_calls == 0, "seq_len 0 writes zeros without a launch"); + OmegaGpuKvLayout ly = layout_for(8, 16, 2, 4, 64); + uint8_t *pool = calloc(ly.pool_bytes, 1); + uint32_t ids[2] = { 1, 9 }; + CHECK(omega_gpu_paged_attention_bf16(q, pool, &ly, ids, 2, 20, 0, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "block id past the pool refused"); + CHECK(omega_gpu_paged_attention_bf16(q, pool, &ly, ids, 1, 20, 2, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "layer past the pool refused"); + OmegaGpuKvLayout bad = ly; bad.block_size = 12; + CHECK(omega_gpu_paged_attention_bf16(q, pool, &bad, ids, 1, 10, 0, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "block size 12 (not a power of two) refused"); + bad = ly; bad.head_stride_bytes = 256; + CHECK(omega_gpu_paged_attention_bf16(q, pool, &bad, ids, 1, 10, 0, 32, 4, 64, out, NULL) == OMEGA_GPU_ATTN_BAD_ARGS, "layout whose head stride is not head_dim*2 refused"); + free(pool); + CHECK(strcmp(omega_gpu_attention_rc_name(OMEGA_GPU_ATTN_UNWRITTEN), "UNWRITTEN") == 0, "rc name"); + + /* with --divergent the listing must also show the region ops (last two entries) */ + static const char *const must_bf16[] = { "MUFU.EX2", "MUFU.RCP", "FMNMX", "BAR.SYNC", "SHFL.DOWN", "@P0 BRA", "@!P0 BRA", "LDG.E.U16", "LDG.E ", "LDS R", "STS [R", "STG.E", "LOP3.LUT", "SHF.R.U32.HI", "BSSY", "BSYNC" }; + static const char *const must_f32[] = { "MUFU.EX2", "MUFU.RCP", "FMNMX", "BAR.SYNC", "SHFL.DOWN", "@P0 BRA", "@!P0 BRA", "LDG.E ", "LDS R", "STS [R", "STG.E", "BSSY", "BSYNC" }; + for (int f32 = 0; f32 < 2; f32++) { + const char *name = f32 ? "gqa_f32" : "paged_bf16"; + OmegaBlackwellKernel k; memset(&k, 0, sizeof k); + int rc = omega_gpu_attention_codegen(f32 != 0, f32 ? 12 : 4, 3, &k); + CHECK(rc == OMEGA_GPU_ATTN_OK && k.code_size > 0 && k.gpr_count <= 64, "%s kernel generated (rc %s, %zu insns, %u gprs)", name, omega_gpu_attention_rc_name(rc), k.insn_count, k.gpr_count); + printf("codegen %s: %zu insns, %u gprs, %u ugprs\n", name, k.insn_count, k.gpr_count, k.uniform_gpr_count); + /* every mutant (1 .. COUNT-1) is a distinct kernel: different from the baseline and from + * every other mutant, named, and inside the register budget */ + uint8_t digests[OMEGA_GPU_ATTN_MUTANT_COUNT][32]; memcpy(digests[0], k.code_digest, 32); + free(k.code); + for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) { + omega_gpu_attention_test_set_mutant((OmegaGpuAttnMutant)m); + memset(&k, 0, sizeof k); + int mrc = omega_gpu_attention_codegen(f32 != 0, f32 ? 12 : 4, 3, &k); + CHECK(mrc == OMEGA_GPU_ATTN_OK && k.gpr_count <= 64, "%s mutant %s generated (rc %s, %u gprs)", name, omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), omega_gpu_attention_rc_name(mrc), k.gpr_count); + CHECK(strcmp(omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), "?") != 0, "mutant %d has a name", m); + memcpy(digests[m], k.code_digest, 32); + free(k.code); + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_NONE); + for (int o = 0; o < m; o++) + CHECK(memcmp(digests[o], digests[m], 32) != 0, "%s mutant %s kernel differs from %s", name, omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m), omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)o)); + } + CHECK(strcmp(omega_gpu_attention_mutant_name(OMEGA_GPU_ATTN_MUTANT_COUNT), "?") == 0, "COUNT has no name"); + /* a different shape key is a different kernel */ + memset(&k, 0, sizeof k); + CHECK(omega_gpu_attention_codegen(f32 != 0, f32 ? 12 : 4, 2, &k) == OMEGA_GPU_ATTN_OK && memcmp(digests[0], k.code_digest, 32) != 0, "%s log2gqa 2 kernel differs from log2gqa 3", name); + free(k.code); + CHECK(nvdisasm_check(f32 != 0, name, f32 ? must_f32 : must_bf16, (f32 ? 11 : 14) + (g_divergent ? 2 : 0)) == 0, "%s nvdisasm listing decodes and shows the expected instructions", name); + } +} + +/* ------------------------------------------------------------- chip gate */ +typedef struct { const char *name; size_t n; int rc; size_t bad; double worst; int pass; uint64_t chip_ns, call_ns; uint32_t calls, unwritten; + int mutants_run, mutants_caught; char mutant_note[400]; + uint64_t kv_staged, kv_naive; uint32_t blk_logical, blk_unique; } Case; +static void case_info(Case *c, const OmegaGpuAttnInfo *i) { + c->chip_ns = i->elapsed_ns; c->call_ns = i->call_ns; c->calls = i->chip_calls; c->unwritten = i->unwritten_words; + c->kv_staged = i->kv_bytes_staged; c->kv_naive = i->kv_bytes_naive; c->blk_logical = i->kv_blocks_logical; c->blk_unique = i->kv_blocks_unique; +} +static Case g_cases[32]; static int g_ncases; +static int g_mutant_caught[OMEGA_GPU_ATTN_MUTANT_COUNT], g_mutant_run[OMEGA_GPU_ATTN_MUTANT_COUNT]; + +static void record(Case c, FILE *out) { + g_cases[g_ncases++] = c; + CHECK(c.pass, "%s rc=%s violations=%zu worst=%g", c.name, omega_gpu_attention_rc_name(c.rc), c.bad, c.worst); + CHECK(c.mutants_caught == c.mutants_run, "%s mutants caught %d of %d (%s)", c.name, c.mutants_caught, c.mutants_run, c.mutant_note); + printf("%s %s n=%zu rc=%s violations=%zu worst_scaled_err=%g chip_ns=%" PRIu64 " call_ns=%" PRIu64 " calls=%u unwritten=%u kv_staged=%" PRIu64 "/%" PRIu64 " blocks=%u/%u | mutants %d/%d %s\n", + c.pass && c.mutants_caught == c.mutants_run ? "PASS" : "FAIL", c.name, c.n, omega_gpu_attention_rc_name(c.rc), c.bad, c.worst, c.chip_ns, c.call_ns, c.calls, c.unwritten, + c.kv_staged, c.kv_naive, c.blk_unique, c.blk_logical, c.mutants_caught, c.mutants_run, c.mutant_note); + if (out) fprintf(out, "%s{\"case\":\"%s\",\"n\":%zu,\"rc\":\"%s\",\"violations\":%zu,\"worst_scaled_err\":%g,\"pass\":%s,\"chip_elapsed_ns\":%" PRIu64 ",\"call_ns\":%" PRIu64 ",\"chip_calls\":%u,\"unwritten_words\":%u," + "\"kv_bytes_staged\":%" PRIu64 ",\"kv_bytes_naive\":%" PRIu64 ",\"kv_blocks_unique\":%u,\"kv_blocks_logical\":%u,\"mutants_run\":%d,\"mutants_caught\":%d,\"mutant_note\":\"%s\"}", + g_ncases > 1 ? "," : "", c.name, c.n, omega_gpu_attention_rc_name(c.rc), c.bad, c.worst, c.pass ? "true" : "false", c.chip_ns, c.call_ns, c.calls, c.unwritten, + c.kv_staged, c.kv_naive, c.blk_unique, c.blk_logical, c.mutants_run, c.mutants_caught, c.mutant_note); +} + +static const char *mutant_name(int m) { return omega_gpu_attention_mutant_name((OmegaGpuAttnMutant)m); } + +/* Runs the mutants listed in `ms` (terminated by 0) through `run` and counts the catches. */ +typedef int (*RunFn)(void *ctx, float *got, OmegaGpuAttnInfo *info); +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]); + int rc = run(ctx, got, &info); + 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); + c->mutants_run++; c->mutants_caught += caught; g_mutant_run[ms[i]]++; g_mutant_caught[ms[i]] += caught; + pos += (size_t)snprintf(c->mutant_note + pos, sizeof c->mutant_note - pos, "%s%s:%s(rc=%s,bad=%zu)", pos ? " " : "", mutant_name(ms[i]), caught ? "CAUGHT" : "MISSED", omega_gpu_attention_rc_name(rc), bad); + if (pos >= sizeof c->mutant_note) break; + } +} + +typedef struct { const float *q, *kc, *vc; uint32_t seq, nqh, nkv; } GqaCtx; +static int run_gqa(void *p, float *got, OmegaGpuAttnInfo *info) { GqaCtx *c = p; return omega_gpu_gqa_attention_f32(c->q, c->kc, c->vc, c->seq, c->nqh, c->nkv, 64, got, info); } +typedef struct { const float *q; const uint8_t *pool; const OmegaGpuKvLayout *ly; const uint32_t *ids; uint32_t nids, ctx, layer, nqh, nkv; } PagedCtx; +static int run_paged(void *p, float *got, OmegaGpuAttnInfo *info) { PagedCtx *c = p; return omega_gpu_paged_attention_bf16(c->q, c->pool, c->ly, c->ids, c->nids, c->ctx, c->layer, c->nqh, c->nkv, 64, got, info); } +typedef struct { const float *q; const uint8_t *pool; const OmegaGpuKvLayout *ly; const int32_t *tables, *ctxs; uint32_t maxb, nseq, layer, nqh, nkv; } BatchCtx; +static int run_batch(void *p, float *got, OmegaGpuAttnInfo *info) { BatchCtx *c = p; return omega_gpu_paged_attention_batch_bf16(c->q, c->pool, c->ly, c->tables, c->ctxs, c->maxb, c->nseq, c->layer, c->nqh, c->nkv, 64, got, info); } +/* single vs batched parity and repeat (L6-KV, CAND-0 coverage): each sequence of a batch, run + * alone through the single-sequence entry point with the batch's own rules applied by hand + * (negative table entries removed, ctx <= 0 -> 0), must equal its row of the batched output bit + * for bit (same kernel, same per-CTA inputs; the batch only shares staging). Then the batch is + * called again with the same inputs: kernel cache hit, bit-identical output, identical staging + * counters. `got` must hold the batched output of `bc`. */ +static void batch_single_repeat_checks(const char *name, const BatchCtx *bc, const float *got, const Case *c) { + size_t row = (size_t)bc->nqh * 64, n = (size_t)bc->nseq * row; + float *one = malloc(row * 4), *again = malloc(n * 4); + uint32_t *ids = malloc((bc->maxb ? bc->maxb : 1) * 4); + for (uint32_t s = 0; s < bc->nseq; s++) { + uint32_t nb = 0; + for (uint32_t b = 0; b < bc->maxb; b++) { int32_t v = bc->tables[(size_t)s * bc->maxb + b]; if (v >= 0) ids[nb++] = (uint32_t)v; } + uint32_t ctx = bc->ctxs[s] > 0 ? (uint32_t)bc->ctxs[s] : 0; + for (size_t i = 0; i < row; i++) one[i] = -7.0f; /* poison: an unwritten row cannot match */ + OmegaGpuAttnInfo si; + int src = omega_gpu_paged_attention_bf16(bc->q + (size_t)s * row, bc->pool, bc->ly, ids, nb, ctx, bc->layer, bc->nqh, bc->nkv, 64, one, &si); + CHECK(src == OMEGA_GPU_ATTN_OK && memcmp(one, got + (size_t)s * row, row * 4) == 0, + "%s: sequence %u alone (single entry point, %u blocks, ctx %u) is bit-identical to its batched row (rc=%s)", name, s, nb, ctx, omega_gpu_attention_rc_name(src)); + } + OmegaGpuAttnInfo ri; + int rrc = omega_gpu_paged_attention_batch_bf16(bc->q, bc->pool, bc->ly, bc->tables, bc->ctxs, bc->maxb, bc->nseq, bc->layer, bc->nqh, bc->nkv, 64, again, &ri); + CHECK(rrc == OMEGA_GPU_ATTN_OK && ri.kernel_cache_hit && memcmp(again, got, n * 4) == 0 && ri.kv_bytes_staged == c->kv_staged && ri.kv_bytes_naive == c->kv_naive + && ri.kv_blocks_unique == c->blk_unique && ri.kv_blocks_logical == c->blk_logical, + "%s: repeated batch call is a cache hit, bit-identical, same staging counters (rc=%s hit=%d staged %" PRIu64 "/%" PRIu64 ")", + name, omega_gpu_attention_rc_name(rrc), (int)ri.kernel_cache_hit, ri.kv_bytes_staged, c->kv_staged); + free(one); free(again); free(ids); +} + + +static int chip(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; } + if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_V1\",\"tolerances\":{\"rel\":2e-4,\"abs\":2e-5,\"large_scores_rel\":1e-3,\"large_scores_abs\":1e-4},\"cases\":["); + uint32_t seed = 0xfb1c0005u; + const uint32_t hd = 64; + const struct { uint32_t nqh, nkv; const char *model; } shapes[2] = { { 32, 4, "tinyllama" }, { 32, 8, "llama32_1b" } }; + /* 65, 129, 300 and 1000 end in a partial 64-token chunk after whole ones: the case that + * caught the diverged-warp shuffle on the chip (2026-10-04); 1, 17, 128, 256, 2048 did not. */ + const uint32_t ctxs[9] = { 1, 17, 256, 2048, 65, 128, 129, 300, 1000 }; + const int no_mutants[1] = { 0 }; + + /* 1. contiguous f32 KV (gqa_attention) */ + for (int sh = 0; sh < 2; sh++) for (int ci = 0; ci < 9; ci++) { + uint32_t nqh = shapes[sh].nqh, nkv = shapes[sh].nkv, seq = ctxs[ci]; + size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4), *again = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + char name[96]; snprintf(name, sizeof name, "gqa_f32_%s_%uq%ukv_ctx%u", shapes[sh].model, nqh, nkv, seq); + Case c = { .name = strdup(name), .n = n }; + OmegaGpuAttnInfo info; + GqaCtx gc = { q, kc, vc, seq, nqh, nkv }; + c.rc = run_gqa(&gc, got, &info); + 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, &info); + if (ci == 3) { + OmegaGpuAttnInfo i2; int rc2 = run_gqa(&gc, again, &i2); + CHECK(rc2 == OMEGA_GPU_ATTN_OK && i2.kernel_cache_hit && memcmp(got, again, n * 4) == 0, "%s repeat run (cache hit) is bit-identical", name); + /* negative control: the comparison must reject a wrong expectation (kv heads swapped) */ + float *wrong = malloc(n * 4); double w2; + for (uint32_t h = 0; h < nqh; h++) memcpy(wrong + (size_t)h * hd, want + (size_t)((h + nqh / nkv) % nqh) * hd, hd * 4); + size_t neg = compare(got, wrong, n, 2e-4, 2e-5, &w2); + CHECK(neg > n / 2, "%s negative control: wrong expectation flagged (%zu of %zu)", name, neg, n); + free(wrong); + static const int ms[5] = { OMEGA_GPU_ATTN_MUTANT_SLOT, OMEGA_GPU_ATTN_MUTANT_NO_RESCALE, OMEGA_GPU_ATTN_MUTANT_Q_ROW, OMEGA_GPU_ATTN_MUTANT_OUT_ROW, 0 }; + run_mutants(&c, ms, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + } else if (ci == 1 && sh == 1) { + static const int ms[2] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, 0 }; + run_mutants(&c, ms, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + } else run_mutants(&c, no_mutants, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + record(c, out); free(q); free(kc); free(vc); free(got); free(want); free(again); + } + /* 2. large scores (q scaled by 200): the softmax without the running max overflows */ + { + uint32_t nqh = 32, nkv = 4, seq = 256; size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -200.0f, 200.0f); /* scores ~ +-200 natural: EX2 without the max subtraction overflows f32 (2^128) */ + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + Case c = { .name = "gqa_f32_large_scores_32q4kv_ctx256", .n = n }; + OmegaGpuAttnInfo info; GqaCtx gc = { q, kc, vc, seq, nqh, nkv }; + c.rc = run_gqa(&gc, got, &info); + c.bad = compare(got, want, n, 1e-3, 1e-4, &c.worst); + c.pass = c.rc == OMEGA_GPU_ATTN_OK && c.bad == 0; case_info(&c, &info); + static const int ms[2] = { OMEGA_GPU_ATTN_MUTANT_NO_MAX, 0 }; + run_mutants(&c, ms, run_gqa, &gc, got, want, n, 1e-3, 1e-4); + record(c, out); free(q); free(kc); free(vc); free(got); free(want); + } + /* 2b. MHA (16q/16kv, ratio 1, ctx 300 = 4 full chunks + a partial one): the head-wiring + * mutants Q_ROW and OUT_ROW are observably different here (Q_ROW keeps kv head h, OUT_ROW + * lands on kv head h^1), unlike GQA where both swap the same pair of outputs. */ + { + uint32_t nqh = 16, nkv = 16, seq = 300; size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 4), *got = malloc(n * 4), *want = malloc(n * 4), *got_q = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + Case c = { .name = "gqa_f32_mha_16q16kv_ctx300", .n = n }; + OmegaGpuAttnInfo info; GqaCtx gc = { q, kc, vc, seq, nqh, nkv }; + c.rc = run_gqa(&gc, got, &info); + 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, &info); + static const int ms_q[2] = { OMEGA_GPU_ATTN_MUTANT_Q_ROW, 0 }; + static const int ms_o[3] = { OMEGA_GPU_ATTN_MUTANT_OUT_ROW, OMEGA_GPU_ATTN_MUTANT_KV_HEAD, 0 }; + run_mutants(&c, ms_q, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + memcpy(got_q, got, n * 4); /* Q_ROW output */ + run_mutants(&c, ms_o, run_gqa, &gc, got, want, n, 2e-4, 2e-5); + /* `got` now holds the KV_HEAD output; rerun OUT_ROW alone to compare it with Q_ROW */ + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_OUT_ROW); + OmegaGpuAttnInfo i3; int rc3 = run_gqa(&gc, got, &i3); + omega_gpu_attention_test_set_mutant(OMEGA_GPU_ATTN_MUTANT_NONE); + double wq; size_t differ = compare(got, got_q, n, 2e-4, 2e-5, &wq); + CHECK(rc3 == OMEGA_GPU_ATTN_OK && differ > n / 2, "mha: Q_ROW and OUT_ROW outputs are distinct wrong answers (%zu of %zu differ)", differ, n); + record(c, out); free(q); free(kc); free(vc); free(got); free(want); free(got_q); + } + /* 3. paged bf16 KV, block size 16, 2 layers (layer 1 under test), scattered block ids */ + for (int sh = 0; sh < 2; sh++) for (int ci = 0; ci < 9; ci++) { + uint32_t nqh = shapes[sh].nqh, nkv = shapes[sh].nkv, ctx = ctxs[ci], bs = 16, layers = 2, layer = 1; + uint32_t nblk = (ctx + bs - 1) / bs, pool_blocks = nblk + 7; + 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); /* a scattered permutation of the pool blocks */ + for (uint32_t b = 0; b < nblk; b++) ids[b] = (b * 7 + 3) % pool_blocks; + 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); + char name[96]; snprintf(name, sizeof name, "paged_bf16_%s_%uq%ukv_bs%u_ctx%u", shapes[sh].model, nqh, nkv, bs, ctx); + Case c = { .name = strdup(name), .n = n }; + OmegaGpuAttnInfo info; PagedCtx pc = { q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv }; + c.rc = run_paged(&pc, got, &info); + 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, &info); + if (ci == 3) { + /* NO_MAX cannot overflow on unit-scale scores (softmax is shift invariant); it is caught by the large-score gqa case */ + static const int ms3[6] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, OMEGA_GPU_ATTN_MUTANT_NO_RESCALE, OMEGA_GPU_ATTN_MUTANT_Q_ROW, OMEGA_GPU_ATTN_MUTANT_OUT_ROW, 0 }; + run_mutants(&c, ms3, run_paged, &pc, got, want, n, 2e-4, 2e-5); + } else if (ci == 1) { + static const int ms[3] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, 0 }; + run_mutants(&c, ms, run_paged, &pc, got, want, n, 2e-4, 2e-5); + } else if (ci == 0) { + /* one token: its softmax weight is 1 whatever K says, so a K-only slot shift is invisible; KV_HEAD still shows */ + static const int ms[2] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, 0 }; + run_mutants(&c, ms, run_paged, &pc, got, want, n, 2e-4, 2e-5); + } else run_mutants(&c, no_mutants, run_paged, &pc, got, want, n, 2e-4, 2e-5); + record(c, out); free(pool); free(ids); free(q); free(got); free(want); + } + /* 4. batch: three sequences (short, empty, truncated by its table), a negative table entry, table rows of 16 */ + { + uint32_t nqh = 32, nkv = 8, bs = 16, layers = 3, layer = 2, maxb = 16, nseq = 3, pool_blocks = 40; + 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)); + int32_t *tables = malloc((size_t)nseq * maxb * 4); + for (size_t i = 0; i < (size_t)nseq * maxb; i++) tables[i] = -1; + /* seq 0: ctx 40 over blocks 5, 17 (-1 in the middle closes up), 29 */ + tables[0] = 5; tables[1] = -1; tables[2] = 17; tables[3] = 29; + /* seq 1: ctx 0 with a table */ + tables[maxb + 0] = 1; + /* seq 2: ctx 100 but only 4 blocks (64 tokens used) */ + tables[2 * maxb + 0] = 30; tables[2 * maxb + 1] = 2; tables[2 * maxb + 2] = 33; tables[2 * maxb + 3] = 11; + int32_t ctxs2[3] = { 40, 0, 100 }; + size_t n = (size_t)nseq * 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_batch(q, pool, &ly, tables, ctxs2, maxb, nseq, layer, nqh, nkv, hd, want); + Case c = { .name = "paged_bf16_batch_3seq_32q8kv_ctx40_0_100", .n = n }; + OmegaGpuAttnInfo info; BatchCtx bc = { q, pool, &ly, tables, ctxs2, maxb, nseq, layer, nqh, nkv }; + c.rc = run_batch(&bc, got, &info); + 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, &info); + int zeros = 1; for (size_t i = 0; i < (size_t)nqh * hd; i++) if (got[(size_t)nqh * hd + i] != 0.0f) zeros = 0; + CHECK(zeros, "batch: the empty sequence is all zeros"); + batch_single_repeat_checks(c.name, &bc, got, &c); + static const int ms[5] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, OMEGA_GPU_ATTN_MUTANT_Q_ROW, OMEGA_GPU_ATTN_MUTANT_OUT_ROW, 0 }; + run_mutants(&c, ms, run_batch, &bc, got, want, n, 2e-4, 2e-5); + /* all 7 referenced blocks are distinct here, so dedupe stages exactly the naive figure */ + CHECK(c.blk_logical == 7 && c.blk_unique == 7 && c.kv_staged == c.kv_naive && c.kv_staged == 7ull * ly.layer_stride_bytes, "batch: 7 distinct blocks staged once each (%u/%u, %" PRIu64 " bytes)", c.blk_unique, c.blk_logical, c.kv_staged); + record(c, out); free(pool); free(tables); free(q); free(got); free(want); + } + /* 5. branch-heavy batch (attention hardening cut): four sequences share the same 10 physical + * prefix blocks (160 tokens, scattered ids) and own private tails of 1..3 blocks ending in a + * partial 64-token chunk. The shared prefix must be staged once per launch, keyed by the + * physical block id. Two head shapes: 8q/2kv puts all four sequences in one launch + * (unique = 10 + 9 tails), 32q/8kv splits them two per launch (unique = 2*10 + 9). + * Negative control: the legacy per-sequence staging (test hook) copies the prefix four + * times and the byte-reduction check must flag it. */ + for (int sh = 0; sh < 2; sh++) { + uint32_t nqh = sh ? 32 : 8, nkv = sh ? 8 : 2, bs = 16, layers = 2, layer = 1, nseq = 4, prefix_blocks = 10, pool_blocks = 64; + uint32_t expect_unique = sh ? 2 * prefix_blocks + 9 : prefix_blocks + 9; + uint32_t maxb = prefix_blocks + 3; + 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)); + int32_t *tables = malloc((size_t)nseq * maxb * 4); + for (size_t i = 0; i < (size_t)nseq * maxb; i++) tables[i] = -1; + const uint32_t tails[4] = { 1, 2, 3, 3 }; /* private blocks per sequence: 9 in all */ + const int32_t ctxs5[4] = { 165, 180, 193, 207 }; /* 160 + 5, 20, 33, 47: every last chunk partial */ + for (uint32_t s = 0; s < nseq; s++) { + for (uint32_t b = 0; b < prefix_blocks; b++) tables[s * maxb + b] = (int32_t)((b * 5 + 7) % pool_blocks); /* same scattered physical prefix */ + for (uint32_t b = 0; b < tails[s]; b++) tables[s * maxb + prefix_blocks + b] = (int32_t)(50 + s * 3 + b); /* private, distinct */ + } + size_t n = (size_t)nseq * nqh * hd; + float *q = malloc(n * 4), *got = malloc(n * 4), *want = malloc(n * 4), *legacy = malloc(n * 4); + for (size_t i = 0; i < n; i++) q[i] = frand(&seed, -1.0f, 1.0f); + oracle_batch(q, pool, &ly, tables, ctxs5, maxb, nseq, layer, nqh, nkv, hd, want); + char name[96]; snprintf(name, sizeof name, "paged_bf16_shared_prefix_4seq_%uq%ukv_10pre", nqh, nkv); + Case c = { .name = strdup(name), .n = n }; + OmegaGpuAttnInfo info; BatchCtx bc = { q, pool, &ly, tables, ctxs5, maxb, nseq, layer, nqh, nkv }; + c.rc = run_batch(&bc, got, &info); + 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, &info); + uint32_t logical = 4 * prefix_blocks + 9; + 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); + CHECK(info.kv_source == OMEGA_GPU_ATTN_KV_STAGED && info.q_bytes == n * 4 && info.out_bytes == n * 4 && 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 */ + omega_gpu_attention_test_set_dedupe(false); + OmegaGpuAttnInfo li; int lrc = run_batch(&bc, legacy, &li); + omega_gpu_attention_test_set_dedupe(true); + double lw; size_t lbad = compare(legacy, want, n, 2e-4, 2e-5, &lw); + CHECK(lrc == OMEGA_GPU_ATTN_OK && lbad == 0, "%s legacy staging: parity (rc=%s bad=%zu)", name, omega_gpu_attention_rc_name(lrc), lbad); + CHECK(li.kv_blocks_unique == logical && li.kv_bytes_staged == li.kv_bytes_naive && li.kv_bytes_staged > c.kv_staged, + "%s negative control: duplicated prefix staging is flagged (legacy staged %" PRIu64 " == naive %" PRIu64 ", dedupe %" PRIu64 ")", name, li.kv_bytes_staged, li.kv_bytes_naive, c.kv_staged); + CHECK(memcmp(got, legacy, n * 4) == 0, "%s: dedupe and legacy staging are bit-identical", name); + batch_single_repeat_checks(name, &bc, got, &c); + static const int ms5[3] = { OMEGA_GPU_ATTN_MUTANT_KV_HEAD, OMEGA_GPU_ATTN_MUTANT_SLOT, 0 }; + run_mutants(&c, ms5, run_batch, &bc, got, want, n, 2e-4, 2e-5); + record(c, out); free(pool); free(tables); free(q); free(got); free(want); free(legacy); + } + /* every mutant the API knows (1 .. COUNT-1) ran at least once and was caught every time; + * a mutant added to the enum without a battery entry fails here */ + for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) { + CHECK(g_mutant_run[m] > 0 && g_mutant_caught[m] == g_mutant_run[m], "mutant %s caught %d of %d runs", mutant_name(m), g_mutant_caught[m], g_mutant_run[m]); + printf("mutant %s: caught %d of %d\n", mutant_name(m), g_mutant_caught[m], g_mutant_run[m]); + } + CHECK(omega_gpu_session_open_count() == (g_sim_mode ? 0u : 1u), "device opened %s for the battery (opens=%u)", g_sim_mode ? "never (simulator)" : "once", omega_gpu_session_open_count()); + printf("device_opens=%u\n", omega_gpu_session_open_count()); + if (out) { + fprintf(out, "],\"mutant_count\":%d,\"mutants\":{", OMEGA_GPU_ATTN_MUTANT_COUNT - 1); + for (int m = 1; m < OMEGA_GPU_ATTN_MUTANT_COUNT; m++) fprintf(out, "%s\"%s\":{\"run\":%d,\"caught\":%d}", m > 1 ? "," : "", mutant_name(m), g_mutant_run[m], g_mutant_caught[m]); + fprintf(out, "},\"device_opens\":%u,\"checks\":%d,\"failed\":%d,\"verdict\":\"%s\"}\n", omega_gpu_session_open_count(), g_checks, g_failed, g_failed == 0 ? "OMEGA_GPU_ATTENTION_PASS" : "OMEGA_GPU_ATTENTION_FAIL"); + fclose(out); + } + return 0; +} + +/* ------------------------------------------------------------ host simulator + * Executes the allocated IR program (physical registers, so the register allocator's + * loop handling is under test too) for every CTA of a launch: 64 threads, 1 KB shared, + * host pointers as addresses, SHFL and BAR as lockstep points (all threads of the CTA + * must sit at the same instruction). EX2 and RCP are exact here; the chip's are approximate. */ +/* path: hash of every branch decision so far. The IR has no reconvergence instruction + * (no BSSY/BSYNC/WARPSYNC), so once a warp splits it may stay split on the chip, and a + * SHFL reading an inactive lane is undefined (CUDA guide, warp shuffle functions). Every + * 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[1024]; +#define SIM_T 64 +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]; } +static uint64_t rd64(const SimThr *t, int v, const BlackwellIRProgram *p) { if (v < 0) return 0; int ph = p->regalloc.vreg_to_phys[v] & 0xff; return (uint64_t)t->r[ph] | ((uint64_t)t->r[ph + 1] << 32); } +static void wr(SimThr *t, int v, uint32_t x, const BlackwellIRProgram *p) { if (v < 0) return; int ph = p->regalloc.vreg_to_phys[v]; if (ph >= 0) t->r[ph & 0xff] = x; } +static void wr64(SimThr *t, int v, uint64_t x, const BlackwellIRProgram *p) { if (v < 0) return; int ph = p->regalloc.vreg_to_phys[v] & 0xff; t->r[ph] = (uint32_t)x; t->r[ph + 1] = (uint32_t)(x >> 32); } +static float u2f(uint32_t u) { float f; memcpy(&f, &u, 4); return f; } +static uint32_t f2u_(float f) { uint32_t u; memcpy(&u, &f, 4); return u; } +/* run one thread until it reaches a SHFL or BAR (not executed) or EXIT; returns 1 if parked at a sync op */ +static int sim_step(SimThr *t, const BlackwellIRProgram *p, uint32_t tid, uint32_t cx, uint32_t cy) { + for (int guard = 0; guard < 50000000; guard++) { + if (t->done) return 0; + if (t->pc < 0 || (size_t)t->pc >= p->count) { g_sim_err = 1; t->done = 1; return 0; } + const BlackwellIRInsn *in = &p->insns[t->pc]; + uint32_t a = rd(t, in->src1_vreg, p), b = rd(t, in->src2_vreg, p), c = rd(t, in->src3_vreg, p); + switch (in->op) { + case BW_IR_SHFL_DOWN: case BW_IR_BAR_SYNC: return 1; + case BW_IR_EXIT: if (!in->predicate_p0 || t->p0) { t->done = 1; return 0; } break; + case BW_IR_BRA: { + int take = !in->predicate_p0 || (in->predicate_not ? !t->p0 : t->p0); + t->path = t->path * 1000003u + (((uint64_t)t->pc << 1) | (uint64_t)take); + if (take) { if ((int32_t)in->imm == 0) { g_sim_err = 2; t->done = 1; return 0; } t->pc += (int32_t)in->imm; continue; } + break; } + case BW_IR_MOV_IMM: wr(t, in->dst_vreg, in->imm, p); break; + case BW_IR_MOV_RZ: wr(t, in->dst_vreg, 0, p); break; + case BW_IR_S2R: wr(t, in->dst_vreg, in->imm == BW_SR_TID_X ? tid : in->imm == BW_SR_CTAID_X ? cx : in->imm == BW_SR_CTAID_Y ? cy : 0, p); break; + case BW_IR_LDC: wr(t, in->dst_vreg, sim_cbank[in->imm / 4], p); break; + case BW_IR_LDC64: wr64(t, in->dst_vreg, (uint64_t)sim_cbank[in->imm / 4] | ((uint64_t)sim_cbank[in->imm / 4 + 1] << 32), p); break; + case BW_IR_LDCU64: break; /* memory descriptor: not modelled */ + case BW_IR_IMAD: wr(t, in->dst_vreg, in->src2_vreg >= 0 ? a * b + c : a * in->imm + c, p); break; + case BW_IR_IMAD_WIDE: wr64(t, in->dst_vreg, (uint64_t)a * in->imm + rd64(t, in->src3_vreg, p), p); break; + case BW_IR_IADD3: wr(t, in->dst_vreg, a + b, p); break; + case BW_IR_SHF_R: wr(t, in->dst_vreg, a >> (in->imm & 31), p); break; + case BW_IR_LOP3_AND: wr(t, in->dst_vreg, a & in->imm, p); break; + case BW_IR_LOP3_XOR: wr(t, in->dst_vreg, a ^ b, p); break; + case BW_IR_ISETP_GE_U32: t->p0 = a >= b; break; + case BW_IR_LDG_E: { uint32_t x; memcpy(&x, (const void *)(uintptr_t)rd64(t, in->src1_vreg, p), 4); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_LDG_E_U16: { uint16_t x; memcpy(&x, (const void *)(uintptr_t)rd64(t, in->src1_vreg, p), 2); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_STG_E: memcpy((void *)(uintptr_t)rd64(t, in->src1_vreg, p), &b, 4); break; + case BW_IR_LDS32: { uint32_t x; if (a + 4 > sizeof sim_shared) { g_sim_err = 3; t->done = 1; return 0; } memcpy(&x, sim_shared + a, 4); wr(t, in->dst_vreg, x, p); break; } + case BW_IR_STS32: if (a + 4 > sizeof sim_shared) { g_sim_err = 3; t->done = 1; return 0; } memcpy(sim_shared + a, &b, 4); break; + case BW_IR_FADD: wr(t, in->dst_vreg, f2u_(u2f(a) + u2f(b)), p); break; + case BW_IR_FSUB: wr(t, in->dst_vreg, f2u_(u2f(a) - u2f(b)), p); break; + case BW_IR_FMUL: wr(t, in->dst_vreg, f2u_(u2f(a) * u2f(b)), p); break; + case BW_IR_FFMA: wr(t, in->dst_vreg, f2u_(fmaf(u2f(a), u2f(b), u2f(c))), p); break; + case BW_IR_FMNMX_MAX: wr(t, in->dst_vreg, f2u_(fmaxf(u2f(a), u2f(b))), p); break; + case BW_IR_MUFU_EX2: wr(t, in->dst_vreg, f2u_(exp2f(u2f(a))), p); break; + case BW_IR_MUFU_RCP: wr(t, in->dst_vreg, f2u_(1.0f / u2f(a)), p); break; + default: g_sim_err = 100 + (int)in->op; t->done = 1; return 0; + } + if (g_trace && tid == 0 && cx == g_trace_cx && cy == 0 && g_trace_launch == 1) { uint32_t dv = rd(t, in->dst_vreg, p); printf("T pc=%d op=%d dst=v%d(r%d)=%08x f=%g p0=%d a=%08x b=%08x c=%08x\n", t->pc, (int)in->op, in->dst_vreg, in->dst_vreg >= 0 ? p->regalloc.vreg_to_phys[in->dst_vreg] : -1, dv, u2f(dv), t->p0, a, b, c); } + t->pc++; + } + g_sim_err = 4; t->done = 1; return 0; +} +static int sim_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info) { + const BlackwellIRProgram *p = progv; + memset(sim_cbank, 0, sizeof sim_cbank); + uint64_t qa = (uintptr_t)L->q, pa = (uintptr_t)L->pool, oa = (uintptr_t)L->out, ta = (uintptr_t)L->tab; + sim_cbank[0x380 / 4] = (uint32_t)qa; sim_cbank[0x380 / 4 + 1] = (uint32_t)(qa >> 32); + sim_cbank[0x388 / 4] = (uint32_t)pa; sim_cbank[0x388 / 4 + 1] = (uint32_t)(pa >> 32); + sim_cbank[0x390 / 4] = (uint32_t)oa; sim_cbank[0x390 / 4 + 1] = (uint32_t)(oa >> 32); + sim_cbank[0x398 / 4] = (uint32_t)ta; sim_cbank[0x398 / 4 + 1] = (uint32_t)(ta >> 32); + memcpy(&sim_cbank[0x3a0 / 4], L->params, sizeof L->params); + uint32_t *outw = L->out; for (size_t i = 0; i < L->out_bytes / 4; i++) outw[i] = 0xffbadbadu; + g_sim_err = 0; + static SimThr th[SIM_T]; + g_trace_launch++; if (getenv("ATTN_SIM_TRACE")) { g_trace = 1; g_trace_cx = (uint32_t)atoi(getenv("ATTN_SIM_TRACE")); } + for (uint32_t cy = 0; cy < L->grid_y && !g_sim_err; cy++) for (uint32_t cx = 0; cx < L->grid_x && !g_sim_err; cx++) { + memset(th, 0, sizeof th); memset(sim_shared, 0, sizeof sim_shared); + for (;;) { + int parked = 0, alive = 0; + for (int i = 0; i < SIM_T; i++) { if (th[i].done) continue; alive++; parked += sim_step(&th[i], p, (uint32_t)i, cx, cy); } + if (g_sim_err) break; + if (alive == 0) break; + if (parked == 0) continue; /* every live thread exited this round */ + if (parked != alive) { g_sim_err = 5; break; } /* a thread exited while others wait at a barrier */ + int pc = -1; + for (int i = 0; i < SIM_T; i++) if (!th[i].done) { if (pc < 0) pc = th[i].pc; else if (th[i].pc != pc) g_sim_err = 6; } + if (g_sim_err) break; + const BlackwellIRInsn *in = &p->insns[pc]; + if (in->op == BW_IR_SHFL_DOWN) { + for (int i = 0; i < SIM_T; i++) if (!th[i].done && !th[i & ~31].done && th[i].path != th[i & ~31].path) g_sim_err = 7; + if (g_sim_err) break; + uint32_t src[SIM_T]; + for (int i = 0; i < SIM_T; i++) src[i] = rd(&th[i], in->src1_vreg, p); + for (int i = 0; i < SIM_T; i++) { int lane = i & 31, from = lane + (int)(in->imm & 31); wr(&th[i], in->dst_vreg, from < 32 ? src[(i & ~31) + from] : src[i], p); } + } + for (int i = 0; i < SIM_T; i++) th[i].pc++; + } + } + uint32_t unwritten = 0; for (size_t i = 0; i < L->out_bytes / 4; i++) if (outw[i] == 0xffbadbadu) unwritten++; + if (info) { info->chip_calls++; info->unwritten_words += unwritten; info->ctas_last_launch = L->grid_x * L->grid_y; info->threads_per_cta = SIM_T; } + if (g_sim_err) { printf("simulator error %d\n", g_sim_err); return OMEGA_GPU_ATTN_CHIP_FAIL; } + return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; +} + + +/* ---------------------------------------------------- timing (cut 4b) */ +/* One query step of TinyLlama attention at context 2048 (32 q heads, 4 kv heads, + * f32 KV) 100 times through the persistent session, every call checked against the + * 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; } +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; } + enum { N = 100 }; + const uint32_t hd = 64, nqh = 32, nkv = 4, seq = 2048; + const char *name = "gqa_f32_tinyllama_32q4kv_ctx2048"; + if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_TIMING_V1\",\"gate_median_ms\":3.0,\"calls\":%d,\"cases\":[", N); + uint32_t seed = 0xfb1c004bu; + size_t n = (size_t)nqh * hd, nkvs = (size_t)seq * nkv * hd; + float *q = malloc(n * 4), *kc = malloc(nkvs * 4), *vc = malloc(nkvs * 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); + for (size_t i = 0; i < nkvs; i++) { kc[i] = frand(&seed, -1.0f, 1.0f); vc[i] = frand(&seed, -1.0f, 1.0f); } + oracle_gqa(q, kc, vc, seq, nqh, nkv, hd, want); + double samples[N]; int ok_calls = 0; size_t bad_total = 0; double worst = 0; uint64_t chip_sum = 0; int rc_last = 0; + OmegaGpuAttnInfo info; + /* warm-up: the first call opens the device and generates the kernel (not timed) */ + int rc0 = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, got, &info); + double first_ms = info.call_ns / 1e6; + CHECK(rc0 == OMEGA_GPU_ATTN_OK, "%s first call rc=%s err=\"%s\"", name, omega_gpu_attention_rc_name(rc0), omega_gpu_attention_last_error()); + for (int i = 0; i < N; i++) { + double t0 = now_ms(); + int rc = omega_gpu_gqa_attention_f32(q, kc, vc, seq, nqh, nkv, hd, 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; rc_last = rc; + if (rc == OMEGA_GPU_ATTN_OK && bad == 0) ok_calls++; + } + qsort(samples, N, sizeof samples[0], cmp_d); + double median = samples[N / 2], p90 = samples[N * 9 / 10], mn = samples[0], mx = samples[N - 1]; + uint32_t opens = omega_gpu_session_open_count(); + int pass = ok_calls == N && bad_total == 0 && median < 3.0 && opens == 1; + CHECK(pass, "timing %s ok_calls=%d/%d violations=%zu median_ms=%.3f opens=%u last_rc=%s err=\"%s\"", name, ok_calls, N, bad_total, median, opens, omega_gpu_attention_rc_name(rc_last), omega_gpu_attention_last_error()); + printf("%s timing %s first_call_ms=%.3f ok_calls=%d/%d violations=%zu worst_scaled_err=%g median_ms=%.3f p90_ms=%.3f min_ms=%.3f max_ms=%.3f chip_us_mean=%.1f device_opens=%u\n", + pass ? "PASS" : "FAIL", name, first_ms, ok_calls, N, bad_total, worst, median, p90, mn, mx, chip_sum / 1e3 / N, opens); + if (out) fprintf(out, "{\"case\":\"%s\",\"first_call_ms\":%.3f,\"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,\"device_opens\":%u,\"pass\":%s}", + name, first_ms, ok_calls, bad_total, worst, median, p90, mn, mx, chip_sum / 1e3 / N, opens, pass ? "true" : "false"); + free(q); free(kc); free(vc); 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_TIMING_PASS" : "OMEGA_GPU_ATTENTION_TIMING_FAIL"); fclose(out); } + return 0; +} + +/* ------------------------------------------------ head-scaling sweep (attention hardening cut) + * `--sweep [--out sweep.json]`: the production paged bf16 path at head_dim 64 over query-head + * counts 1, 2, 4, 8, 16, 24, 32, 64 and every divisor as the kv-head count, at context 256 + * (latency) and 2048 (bandwidth), block size 16, scattered block ids. Points whose GQA ratio + * is not a power of two are mathematically legal (the generic contract allows them) but + * outside the current kernel envelope (codegen selects the kv head with a shift): they are + * called anyway, must be refused with BAD_ARGS, and are recorded as + * "unsupported_by_kernel_envelope" (no chip time). Every supported point is checked against + * the host oracle on its first call, then warmed and timed over N calls (median / p90 of the + * whole call and of the chip kernel time). Gates: parity, no unwritten word, one device open, + * every call OK; the timings are evidence, not a threshold. Only quantities the stack measures + * are recorded; SM occupancy, bandwidth utilisation and cache hit rates are not observable + * through this path and are reported as unavailable. Under --sim the timings are host-simulator + * timings and the receipt says so. */ +static int sweep(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; } + const int N = g_sim_mode ? 1 : 20; + const uint32_t hd = 64, bs = 16, layers = 1, layer = 0; + static const uint32_t qheads[8] = { 1, 2, 4, 8, 16, 24, 32, 64 }; + static const uint32_t ctxs[2] = { 256, 2048 }; + uint32_t seed = 0xfb1c05eeu; + if (out) fprintf(out, "{\"schema\":\"OMEGA_GPU_ATTENTION_SWEEP_V1\",\"path\":\"paged_bf16\",\"head_dim\":%u,\"block_size\":%u,\"timed_calls\":%d,\"host_simulator\":%s," + "\"tolerances\":{\"rel\":2e-4,\"abs\":2e-5},\"hardware_counters\":\"unavailable (SM occupancy, bandwidth utilisation, cache hit rates are not observable through this path)\",\"points\":[", + hd, bs, N, g_sim_mode ? "true" : "false"); + int npoints = 0, supported = 0, unsupported = 0; + double *samples = malloc((size_t)N * sizeof *samples), *ksamples = malloc((size_t)N * sizeof *ksamples); + for (int qi = 0; qi < 8; qi++) for (uint32_t nkv = 1; nkv <= qheads[qi]; nkv++) { + uint32_t nqh = qheads[qi]; + if (nqh % nkv) continue; + uint32_t ratio = nqh / nkv; int pow2 = (ratio & (ratio - 1)) == 0; + for (int ci = 0; ci < 2; ci++) { + uint32_t ctx = ctxs[ci], nblk = (ctx + bs - 1) / bs, pool_blocks = nblk + 5; + 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 * 7 + 3) % pool_blocks; + 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); + OmegaGpuAttnInfo info; memset(&info, 0, sizeof info); + int rc = omega_gpu_paged_attention_bf16(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, got, &info); + const char *klass; int pass; size_t bad = 0; double worst = 0; int ok_calls = 0; uint32_t unwritten = 0, cache_hits = 0; double med = 0, p90 = 0, kmed = 0, kp90 = 0; + if (!pow2) { + klass = "unsupported_by_kernel_envelope"; + pass = rc == OMEGA_GPU_ATTN_BAD_ARGS; unsupported++; + CHECK(pass, "sweep %uq/%ukv ctx %u: ratio %u (not a power of two) refused with BAD_ARGS (got %s)", nqh, nkv, ctx, ratio, omega_gpu_attention_rc_name(rc)); + } else { + klass = "supported"; supported++; + oracle_paged(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, want); + bad = compare(got, want, n, 2e-4, 2e-5, &worst); + unwritten = info.unwritten_words; + uint64_t kv_staged = info.kv_bytes_staged, kv_naive = info.kv_bytes_naive, qb = info.q_bytes, tb = info.tab_bytes, ob = info.out_bytes; + uint32_t launches = info.chip_calls, ctas = info.ctas_last_launch, blk_l = info.kv_blocks_logical, blk_u = info.kv_blocks_unique, kv_src = info.kv_source; + for (int i = 0; i < N; i++) { + OmegaGpuAttnInfo ti; + int trc = omega_gpu_paged_attention_bf16(q, pool, &ly, ids, nblk, ctx, layer, nqh, nkv, hd, got, &ti); + samples[i] = ti.call_ns / 1e6; ksamples[i] = ti.elapsed_ns / 1e6; + double w; size_t b2 = compare(got, want, n, 2e-4, 2e-5, &w); + if (w > worst) worst = w; + bad += b2; unwritten += ti.unwritten_words; cache_hits += ti.kernel_cache_hit; + if (trc == OMEGA_GPU_ATTN_OK && b2 == 0) ok_calls++; + } + qsort(samples, (size_t)N, sizeof samples[0], cmp_d); qsort(ksamples, (size_t)N, sizeof ksamples[0], cmp_d); + med = samples[N / 2]; p90 = samples[N * 9 / 10]; kmed = ksamples[N / 2]; kp90 = ksamples[N * 9 / 10]; + pass = rc == OMEGA_GPU_ATTN_OK && bad == 0 && ok_calls == N && unwritten == 0 && cache_hits == (uint32_t)N; + CHECK(pass, "sweep %uq/%ukv ctx %u: rc=%s violations=%zu ok_calls=%d/%d unwritten=%u cache_hits=%u", nqh, nkv, ctx, omega_gpu_attention_rc_name(rc), bad, ok_calls, N, unwritten, cache_hits); + printf("%s sweep %2uq/%2ukv ratio %2u ctx %4u: launches=%u ctas=%u call_ms med=%.3f p90=%.3f kernel_ms med=%.3f p90=%.3f kv_staged=%" PRIu64 " (naive %" PRIu64 ") blocks=%u/%u q=%" PRIu64 " tab=%" PRIu64 " out=%" PRIu64 " worst=%g\n", + pass ? "PASS" : "FAIL", nqh, nkv, ratio, ctx, launches, ctas, med, p90, kmed, kp90, kv_staged, kv_naive, blk_u, blk_l, qb, tb, ob, worst); + if (out) fprintf(out, "%s{\"q_heads\":%u,\"kv_heads\":%u,\"gqa_ratio\":%u,\"head_dim\":%u,\"context\":%u,\"q_width\":%zu,\"out_width\":%zu,\"class\":\"%s\",\"rc\":\"%s\",\"pass\":%s," + "\"violations\":%zu,\"worst_scaled_err\":%g,\"unwritten_words\":%u,\"launches_per_call\":%u,\"ctas_last_launch\":%u,\"threads_per_cta\":%u," + "\"call_ms_median\":%.4f,\"call_ms_p90\":%.4f,\"kernel_ms_median\":%.4f,\"kernel_ms_p90\":%.4f,\"kernel_cache_hits\":%u,\"first_call_cache_hit\":%s," + "\"kv_bytes_staged\":%" PRIu64 ",\"kv_bytes_naive\":%" PRIu64 ",\"kv_blocks_logical\":%u,\"kv_blocks_unique\":%u,\"q_bytes\":%" PRIu64 ",\"tab_bytes\":%" PRIu64 ",\"out_bytes\":%" PRIu64 ",\"kv_source\":\"%s\"}", + npoints ? "," : "", nqh, nkv, ratio, hd, ctx, n, n, klass, omega_gpu_attention_rc_name(rc), pass ? "true" : "false", bad, worst, unwritten, launches, ctas, info.threads_per_cta, + med, p90, kmed, kp90, cache_hits, info.kernel_cache_hit ? "true" : "false", kv_staged, kv_naive, blk_l, blk_u, qb, tb, ob, kv_src == OMEGA_GPU_ATTN_KV_STAGED ? "staged" : "resident"); + npoints++; + } + if (!pow2) { + printf("%s sweep %2uq/%2ukv ratio %2u ctx %4u: %s (rc=%s)\n", pass ? "PASS" : "FAIL", nqh, nkv, ratio, ctx, klass, omega_gpu_attention_rc_name(rc)); + if (out) fprintf(out, "%s{\"q_heads\":%u,\"kv_heads\":%u,\"gqa_ratio\":%u,\"head_dim\":%u,\"context\":%u,\"q_width\":%zu,\"out_width\":%zu,\"class\":\"%s\",\"rc\":\"%s\",\"pass\":%s}", + npoints ? "," : "", nqh, nkv, ratio, hd, ctx, n, n, klass, omega_gpu_attention_rc_name(rc), pass ? "true" : "false"); + npoints++; + } + free(pool); free(ids); free(q); free(got); free(want); + } + } + free(samples); free(ksamples); + uint32_t opens = omega_gpu_session_open_count(); + CHECK(opens == (g_sim_mode ? 0u : 1u), "sweep: device opened %s (opens=%u)", g_sim_mode ? "never (simulator)" : "once", opens); + printf("sweep: %d points (%d supported, %d unsupported by the kernel envelope), device_opens=%u\n", npoints, supported, unsupported, opens); + if (out) { fprintf(out, "],\"points_total\":%d,\"points_supported\":%d,\"points_unsupported\":%d,\"device_opens\":%u,\"checks\":%d,\"failed\":%d,\"verdict\":\"%s\"}\n", npoints, supported, unsupported, opens, g_checks, g_failed, g_failed == 0 ? "OMEGA_GPU_ATTENTION_SWEEP_PASS" : "OMEGA_GPU_ATTENTION_SWEEP_FAIL"); fclose(out); } + return 0; +} + +/* ------------------------------------------------------------ warp simulator (omega #308) + * The per-thread simulator above has no model of a warp (its SHFL rule is "one path across the + * warp or error 7"). With --divergent the kernel carries a real lane-dependent branch inside a + * BSSY/BSYNC region, and every launch runs through tests/bw_warp_sim.h instead: 32-lane + * fragments, barrier registers, SHFL/BAR participation. Each launch runs in both fragment + * orders and the two outputs must be bit-identical. */ +static uint64_t g_ws_issues, g_ws_launches; +static int ws_attn_launch(const void *progv, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info) { + const BlackwellIRProgram *p = progv; + uint32_t *outw = L->out; size_t nw = L->out_bytes / 4; + uint32_t *copy = malloc(L->out_bytes); + int err = 0; char msg[240] = ""; + for (int order = 0; order < 2 && !err && copy; order++) { + WsSim s; memset(&s, 0, sizeof s); + s.p = p; s.threads = SIM_T; s.smem = sim_shared; s.smem_bytes = sizeof sim_shared; s.order = order; + uint64_t qa = (uintptr_t)L->q, pa = (uintptr_t)L->pool, oa = (uintptr_t)L->out, ta = (uintptr_t)L->tab; + s.cbank[0x380 / 4] = (uint32_t)qa; s.cbank[0x380 / 4 + 1] = (uint32_t)(qa >> 32); + s.cbank[0x388 / 4] = (uint32_t)pa; s.cbank[0x388 / 4 + 1] = (uint32_t)(pa >> 32); + s.cbank[0x390 / 4] = (uint32_t)oa; s.cbank[0x390 / 4 + 1] = (uint32_t)(oa >> 32); + s.cbank[0x398 / 4] = (uint32_t)ta; s.cbank[0x398 / 4 + 1] = (uint32_t)(ta >> 32); + memcpy(&s.cbank[0x3a0 / 4], L->params, sizeof L->params); + for (size_t i = 0; i < nw; i++) outw[i] = 0xffbadbadu; + err = ws_run(&s, L->grid_x, L->grid_y); + if (err) { snprintf(msg, sizeof msg, "order %d: %s", order, s.msg); break; } + g_ws_issues += s.warp_issues; + if (order == 0) memcpy(copy, outw, L->out_bytes); + else if (memcmp(copy, outw, L->out_bytes) != 0) { err = -1; snprintf(msg, sizeof msg, "the fragment order changed the result"); } + } + free(copy); + g_ws_launches++; + uint32_t unwritten = 0; for (size_t i = 0; i < nw; i++) if (outw[i] == 0xffbadbadu) unwritten++; + if (info) { info->chip_calls++; info->unwritten_words += unwritten; info->ctas_last_launch = L->grid_x * L->grid_y; info->threads_per_cta = SIM_T; } + if (err) { printf("warp simulator error: %s\n", msg); return OMEGA_GPU_ATTN_CHIP_FAIL; } + return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; +} +/* Negative control for --divergent --sim: mode 2 builds the same kernel with the BSYNC dropped; + * the warp simulator must reject it (the whole point of the simulator: the old one could not). */ +static void divergent_negative_control(void) { + enum { SEQ = 65, NQH = 8, NKV = 2, HD = 64 }; + float *q = malloc(NQH * HD * 4), *kv = malloc((size_t)SEQ * NKV * HD * 4), *out = malloc(NQH * HD * 4); + uint32_t seed = 0x308u; + for (int i = 0; i < NQH * HD; i++) q[i] = frand(&seed, -1.0f, 1.0f); + for (size_t i = 0; i < (size_t)SEQ * NKV * HD; i++) kv[i] = frand(&seed, -1.0f, 1.0f); + omega_gpu_attention_test_set_divergent(2); + int rc = omega_gpu_gqa_attention_f32(q, kv, kv, SEQ, NQH, NKV, HD, out, NULL); + omega_gpu_attention_test_set_divergent(1); + CHECK(rc == OMEGA_GPU_ATTN_CHIP_FAIL, "divergent mode 2 (BSYNC dropped) rejected by the warp simulator (rc %s)", omega_gpu_attention_rc_name(rc)); + int rc1 = omega_gpu_gqa_attention_f32(q, kv, kv, SEQ, NQH, NKV, HD, out, NULL); + CHECK(rc1 == OMEGA_GPU_ATTN_OK, "divergent mode 1 (regioned branch) runs clean on the same input (rc %s)", omega_gpu_attention_rc_name(rc1)); + free(q); free(kv); free(out); +} + +int main(int argc, char **argv) { + const char *out_path = NULL; int host = 0, sim = 0, timing_mode = 0, sweep_mode = 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], "--sweep") == 0) sweep_mode = 1; + else if (strcmp(argv[i], "--out") == 0 && i + 1 < argc) out_path = argv[++i]; + } + 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(); + 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; + printf("%s: %d checks, %d failed\n", g_failed ? "FAIL" : "PASS", g_checks, g_failed); + return g_failed ? 1 : 0; +} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/ground.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/ground.txt new file mode 100644 index 000000000..a06be76a9 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/ground.txt @@ -0,0 +1,12 @@ +wt-base 9a20ca8fe6bc85967181afaa8c0a2d81c0ae0027 dirty=0 +wt-pad c7663bbfb9ecc01f03d407d981db5f48b987ed57 dirty=0 +omega f1d57c56c8ff277dfd1fc97b3d01c739e29f9900 dirty=0 +physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +NVIDIA GB10, 580.173.02, 0 % +7.0.0-1019-nvidia +7413297c2366b54aca668020eadb2368df52004c5250f65300229b4c0e50b0a4 /home/drakestapleton/workspace/investigations/2026-10-07-hd128-ctx256-stall/src/va_camera_base +f2d35f7da7b4b3d9c6be1a38266e98f1eacc639192437758681e06e7c11d1c39 /home/drakestapleton/workspace/investigations/2026-10-07-hd128-ctx256-stall/src/va_camera_pad +b15a3623ca9966713d543cb40d7df288f49243fed0e1f02daa7e99a7a87bbc77 /home/drakestapleton/workspace/hive/CODEPAD/wt-base/build/libomega_gpu.a +8248f0dbc1122ca4c1ea0cd5aea70527adc21feb3530347a064aa9c02ab4bf0f /home/drakestapleton/workspace/hive/CODEPAD/wt-pad/build/libomega_gpu.a +f60b100cb39fbd68ba06a3d14aeee8c282670ae42e1055919be0378da9af6d8f /home/drakestapleton/workspace/hive/CODEPAD/wt-pad/build/gpu_attention_test +xid_lines_before=2 diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-end.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-end.txt new file mode 100644 index 000000000..349656ffd --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-end.txt @@ -0,0 +1 @@ +2026-10-07T02:54:55Z diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-start.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-start.txt new file mode 100644 index 000000000..8c7be7c89 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/hold-start.txt @@ -0,0 +1 @@ +2026-10-07T02:54:45Z diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.c b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.c new file mode 100644 index 000000000..96fae92af --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.c @@ -0,0 +1,892 @@ +/* omega_gpu_attention_api.c: FB-1 cut 5 (2026-10-04). See the header. + * + * Layout: (1) kernel codegen on the BlackwellIR with the serialising scheduler + * of cut 4 (every instruction waits on everything still pending; slow and safe), + * extended with forward branches and more loops; (2) the launcher, cloned from + * cut 4's run_abc with a fourth buffer (block tables and context lengths), 16 + * argument words, and cut 1b's shader-cache invalidate; (3) the public entry + * points, which stage the referenced KV blocks per launch and apply the oracle's + * argument rules (dropped tokens past the table, negative table entries, zero + * context) on the host. + * + * One CTA per (query head, sequence), 64 threads (= head_dim). The context is + * walked in chunks of 64 tokens: + * phase A thread t owns token base+t: block lookup, K dot q (f32 FFMA), s = dot * scale + * (scale folds 1/sqrt(d) and log2 e), s and the token's byte offset go to shared; + * reduce chunk max (SHFL.DOWN tree per warp, lane partials to shared, BAR.SYNC, 2 LDS), + * m_new = max(m, chunk max), alpha = EX2(m - m_new), p = EX2(s - m_new) to shared, + * chunk sum the same way, l = l * alpha + chunk sum; + * phase B thread d owns dimension d: acc = acc * alpha + sum over the chunk of p_t * V[t][d]. + * Then out[d] = acc * RCP(l). The first chunk sees m = -inf, so alpha = EX2(-inf) = 0 and + * the initial l and acc drop out (PTX ISA ex2.approx: ex2(-Inf) = +0). + * + * Shared memory (1024 bytes, the QMD's declared size): [0,256) q, [256,512) s then p, + * [512,768) token byte offsets, [768,1024) warp partials for the reductions. + */ +#include "omega_gpu_attention_api.h" +#include "omega_blackwell_codegen.h" +#include "omega_bw_reconv.h" +#include "omega_blackwell_qmd.h" +#include "omega_blackwell_submit.h" +#include "omega_gpu_session.h" +#include "sha256.h" +#include +#include +#include +#include +#include + +/* ------------------------------------------------------------------ codegen */ + +#define CW(stall, wbar, rbar, wait) \ + (((uint32_t)(stall) << 9) | ((uint32_t)(wbar) << 14) | ((uint32_t)(rbar) << 17) | ((uint32_t)(wait) << 20)) +#define CW_YIELD 0x2000u +#define SB_NONE 7u +#define SB_GPR 0u +#define SB_RD 1u +#define SB_UGPR 2u + +enum { K_FIXED, K_PRED, K_VAR, K_UVAR, K_STORE, K_SYNC, K_EXIT, K_BRA, K_BSSY, K_BSYNC }; + +#define AT_MAX_LOOPS 8 +typedef struct { + BlackwellIRProgram *p; + uint32_t pending; + int err; + int loop_start[AT_MAX_LOOPS], loop_end[AT_MAX_LOOPS]; + int n_loops, depth, stack[AT_MAX_LOOPS]; + BwRegions rg; /* structured reconvergence regions (omega #308) */ + int rg_mutant; /* test only: 1 = drop the BSYNC at join (the 2026-10-04 bug shape; host sim must catch it) */ +} Em; + +static void emit(Em *e, BlackwellIRInsn in, int kind) { + uint32_t wait = e->pending; + switch (kind) { + case K_FIXED: in.control = CW(6, SB_NONE, SB_NONE, wait); e->pending = 0; break; + case K_PRED: in.control = CW(13, SB_NONE, SB_NONE, wait); e->pending = 0; break; + case K_VAR: in.control = CW(4, SB_GPR, SB_NONE, wait) | CW_YIELD; e->pending = 1u << SB_GPR; break; + case K_UVAR: in.control = CW(4, SB_UGPR, SB_NONE, wait) | CW_YIELD; e->pending = 1u << SB_UGPR; break; + case K_STORE: in.control = CW(4, SB_NONE, SB_RD, wait) | CW_YIELD; e->pending = 1u << SB_RD; break; + case K_SYNC: in.control = CW(6, SB_NONE, SB_NONE, wait); e->pending = 0; break; + case K_EXIT: in.control = CW(5, SB_NONE, SB_NONE, wait); e->pending = in.predicate_p0 ? wait : 0; break; + case K_BRA: in.control = CW(5, SB_NONE, SB_NONE, wait); e->pending = in.predicate_p0 ? wait : 0; break; + /* stall counts as nvcc 13.0.88 writes them for sm_121 (see src/omega_gpu_elementwise_api.c) */ + case K_BSSY: in.control = CW(1, SB_NONE, SB_NONE, wait) | CW_YIELD; e->pending = 0; break; + case K_BSYNC: in.control = CW(5, SB_NONE, SB_NONE, wait) | CW_YIELD; e->pending = 0; break; + default: e->err = -1; return; + } + if (omega_bw_ir_append(e->p, &in) < 0) e->err = -1; +} + +static int V(Em *e) { int v = omega_bw_ir_alloc_vreg(e->p); if (v < 0) e->err = -1; return v; } +static int V64(Em *e) { int v = omega_bw_ir_alloc_vreg64(e->p); if (v < 0) e->err = -1; return v; } +static int UV64(Em *e) { int v = omega_bw_ir_alloc_uvreg64(e->p); if (v < 0) e->err = -1; return v; } +static int here(const Em *e) { return (int)e->p->count; } + +#define NOREG -1 +static BlackwellIRInsn I0(BlackwellIROpcode op) { + BlackwellIRInsn in; memset(&in, 0, sizeof in); + in.op = op; in.dst_vreg = NOREG; in.src1_vreg = NOREG; in.src2_vreg = NOREG; in.src3_vreg = NOREG; in.ureg = NOREG; + return in; +} +static void ldcu64(Em *e, int udst, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDCU64); i.dst_vreg = udst; i.imm = off; i.is_uniform = true; emit(e, i, K_UVAR); } +static void ldc64(Em *e, int dst64, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDC64); i.dst_vreg = dst64; i.imm = off; emit(e, i, K_VAR); } +static void ldc32(Em *e, int dst, uint32_t off) { BlackwellIRInsn i = I0(BW_IR_LDC); i.dst_vreg = dst; i.imm = off; emit(e, i, K_VAR); } +static void s2r(Em *e, int dst, uint32_t sr) { BlackwellIRInsn i = I0(BW_IR_S2R); i.dst_vreg = dst; i.imm = sr; emit(e, i, K_VAR); } +static void movi(Em *e, int dst, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_MOV_IMM); i.dst_vreg = dst; i.imm = imm; emit(e, i, K_FIXED); } +static void movf(Em *e, int dst, float f) { uint32_t u; memcpy(&u, &f, 4); movi(e, dst, u); } +static void movrz(Em *e, int dst) { BlackwellIRInsn i = I0(BW_IR_MOV_RZ); i.dst_vreg = dst; emit(e, i, K_FIXED); } +/* dst = a * imm + c (c may be NOREG for RZ) */ +static void imadi(Em *e, int dst, int a, uint32_t imm, int c) { BlackwellIRInsn i = I0(BW_IR_IMAD); i.dst_vreg = dst; i.src1_vreg = a; i.imm = imm; i.src3_vreg = c; emit(e, i, K_FIXED); } +/* dst = a * b + c (registers; c may be NOREG) */ +static void imadr(Em *e, int dst, int a, int b, int c) { BlackwellIRInsn i = I0(BW_IR_IMAD); i.dst_vreg = dst; i.src1_vreg = a; i.src2_vreg = b; i.src3_vreg = c; emit(e, i, K_FIXED); } +static void iadd3(Em *e, int dst, int a, int b) { BlackwellIRInsn i = I0(BW_IR_IADD3); i.dst_vreg = dst; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void lop3xor(Em *e, int dst, int a, int b) { BlackwellIRInsn i = I0(BW_IR_LOP3_XOR); i.dst_vreg = dst; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void lop3andi(Em *e, int dst, int a, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_LOP3_AND); i.dst_vreg = dst; i.src1_vreg = a; i.imm = imm; emit(e, i, K_FIXED); } +static void shri(Em *e, int dst, int a, uint32_t imm) { BlackwellIRInsn i = I0(BW_IR_SHF_R); i.dst_vreg = dst; i.src1_vreg = a; i.imm = imm; emit(e, i, K_FIXED); } +/* dst64 = idx * imm + base64 (byte address) */ +static void wide(Em *e, int dst64, int idx, uint32_t imm, int base64) { BlackwellIRInsn i = I0(BW_IR_IMAD_WIDE); i.dst_vreg = dst64; i.src1_vreg = idx; i.imm = imm; i.src3_vreg = base64; emit(e, i, K_FIXED); } +static void ldg(Em *e, int dst, int addr64, int udesc) { BlackwellIRInsn i = I0(BW_IR_LDG_E); i.dst_vreg = dst; i.src1_vreg = addr64; i.ureg = udesc; emit(e, i, K_VAR); } +static void ldg16(Em *e, int dst, int addr64, int udesc) { BlackwellIRInsn i = I0(BW_IR_LDG_E_U16); i.dst_vreg = dst; i.src1_vreg = addr64; i.ureg = udesc; emit(e, i, K_VAR); } +static void stg(Em *e, int addr64, int val, int udesc) { BlackwellIRInsn i = I0(BW_IR_STG_E); i.src1_vreg = addr64; i.src2_vreg = val; i.ureg = udesc; emit(e, i, K_STORE); } +static void e_fadd(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FADD); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void e_fsub(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FSUB); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void e_fmul(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FMUL); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void e_ffma(Em *e, int d, int a, int b, int c) { BlackwellIRInsn i = I0(BW_IR_FFMA); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; i.src3_vreg = c; emit(e, i, K_FIXED); } +static void e_fmax(Em *e, int d, int a, int b) { BlackwellIRInsn i = I0(BW_IR_FMNMX_MAX); i.dst_vreg = d; i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_FIXED); } +static void mufu(Em *e, BlackwellIROpcode op, int d, int a) { BlackwellIRInsn i = I0(op); i.dst_vreg = d; i.src1_vreg = a; emit(e, i, K_VAR); } +/* SHFL and BAR.SYNC are refused inside an open reconvergence region (omega #308): on a split + * warp they read inactive lanes / count a partial warp, which is what produced wrong dims on + * the chip on 2026-10-04. The build fails closed instead. */ +static int in_region(Em *e) { if (e->rg.depth > 0) { e->err = -1; return 1; } return 0; } +static void shfl_down(Em *e, int d, int a, uint32_t off) { if (in_region(e)) return; BlackwellIRInsn i = I0(BW_IR_SHFL_DOWN); i.dst_vreg = d; i.src1_vreg = a; i.imm = off; emit(e, i, K_VAR); } +static void sts32(Em *e, int addr, int val) { BlackwellIRInsn i = I0(BW_IR_STS32); i.src1_vreg = addr; i.src2_vreg = val; emit(e, i, K_STORE); } +static void lds32(Em *e, int d, int addr) { BlackwellIRInsn i = I0(BW_IR_LDS32); i.dst_vreg = d; i.src1_vreg = addr; emit(e, i, K_VAR); } +static void bar_sync(Em *e) { if (in_region(e)) return; emit(e, I0(BW_IR_BAR_SYNC), K_SYNC); } +static void isetp_ge_u32(Em *e, int a, int b) { BlackwellIRInsn i = I0(BW_IR_ISETP_GE_U32); i.src1_vreg = a; i.src2_vreg = b; emit(e, i, K_PRED); } +static void bra_back_if_not_p0(Em *e, int target) { BlackwellIRInsn i = I0(BW_IR_BRA); i.predicate_p0 = true; i.predicate_not = true; i.imm = (uint32_t)(target - here(e)); emit(e, i, K_BRA); } +/* @P0 BRA forward; the target is patched in when known */ +static int bra_fwd_if_p0(Em *e) { int at = here(e); BlackwellIRInsn i = I0(BW_IR_BRA); i.predicate_p0 = true; i.imm = 0; emit(e, i, K_BRA); return at; } +static void patch_fwd(Em *e, int at) { if (at >= 0 && (size_t)at < e->p->count) e->p->insns[at].imm = (uint32_t)(here(e) - at); else e->err = -1; } + +/* ---- structured reconvergence regions (omega #308); same API as the elementwise emitter ---- */ +enum { RX_ALWAYS, RX_IF_P0, RX_IF_NOT_P0 }; +static int region_begin(Em *e) { + int bar = bw_regions_next_bar(&e->rg); + if (bar < 0) { e->err = -1; return -1; } + int at = here(e); + BlackwellIRInsn i = I0(BW_IR_BSSY); i.bar_reg = (uint8_t)bar; i.imm = 2; emit(e, i, K_BSSY); + if (bw_regions_begin(&e->rg, at) < 0) e->err = -1; + return bar; +} +static void region_exit(Em *e, int cond) { + int at = here(e); + BlackwellIRInsn i = I0(BW_IR_BRA); i.imm = 1; + if (cond != RX_ALWAYS) { i.predicate_p0 = true; i.predicate_not = (cond == RX_IF_NOT_P0); } + emit(e, i, K_BRA); + if (bw_regions_exit(&e->rg, at) < 0) e->err = -1; +} +static void region_join(Em *e) { + if (e->rg.depth <= 0) { e->err = -1; return; } + int d = e->rg.depth - 1, bsync = here(e); + BlackwellIRInsn i = I0(e->rg_mutant == 1 ? BW_IR_NOP : BW_IR_BSYNC); i.bar_reg = (uint8_t)d; emit(e, i, K_BSYNC); + if (e->rg_mutant == 1) { + BwRegions *r = &e->rg; r->depth--; + e->p->insns[r->bssy_at[d]].imm = (uint32_t)(bsync + 1 - r->bssy_at[d]); + for (int k = 0; k < r->n_exits[d]; k++) e->p->insns[r->exits[d][k]].imm = (uint32_t)(bsync - r->exits[d][k]); + return; + } + if (bw_regions_join(&e->rg, e->p, bsync) != d) e->err = -1; +} +static void tail(Em *e) { + emit(e, I0(BW_IR_EXIT), K_EXIT); + BlackwellIRInsn self = I0(BW_IR_BRA); + self.control = 0x000fc000u; + if (omega_bw_ir_append(e->p, &self) < 0) e->err = -1; +} +/* Loops nest; loop_end() extends every value defined before the loop and read inside + * it to the back-branch (the linear-scan allocator knows nothing about back-edges). */ +static void loop_begin(Em *e) { + if (e->depth >= AT_MAX_LOOPS || e->n_loops >= AT_MAX_LOOPS) { e->err = -1; return; } + e->stack[e->depth++] = here(e); +} +static void loop_end(Em *e) { + if (e->depth == 0 || e->n_loops >= AT_MAX_LOOPS) { e->err = -1; return; } + int start = e->stack[--e->depth], end = here(e) - 1; + e->loop_start[e->n_loops] = start; e->loop_end[e->n_loops] = end; e->n_loops++; + OmegaRegAlloc *ra = &e->p->regalloc; + for (int v = 0; v < ra->num_vregs; v++) { + OmegaLiveInterval *iv = &ra->intervals[v]; + if (iv->first_def >= 0 && iv->first_def < start && iv->last_use >= start && iv->last_use < end) iv->last_use = end; + } +} +/* A value first defined inside a loop may not be read after it before being redefined. */ +static int check_loop_invariant(const Em *e) { + const OmegaRegAlloc *ra = &e->p->regalloc; + for (int L = 0; L < e->n_loops; L++) + for (int v = 0; v < ra->num_vregs; v++) { + int fd = ra->intervals[v].first_def; + if (fd < e->loop_start[L] || fd > e->loop_end[L]) continue; + for (size_t i = (size_t)e->loop_end[L] + 1; i < e->p->count; i++) { + const BlackwellIRInsn *in = &e->p->insns[i]; + if (in->src1_vreg == v || in->src2_vreg == v || in->src3_vreg == v) return -1; + if (in->dst_vreg == v && !in->is_uniform) break; + } + } + return 0; +} + +/* Kernel argument words (constant bank 0 at 0x380; the bank is 1024 bytes, so 32 words fit). */ +#define ARG_Q 0x380u +#define ARG_POOL 0x388u +#define ARG_OUT 0x390u +#define ARG_TAB 0x398u +#define ARG_MAXB 0x3a0u /* words per block-table row */ +#define ARG_SCALE 0x3a4u /* bits of log2(e) / sqrt(head_dim) */ +#define ARG_BSTRIDE 0x3a8u /* bytes between staged blocks */ +#define ARG_TSTRIDE 0x3acu /* bytes between tokens */ +#define ARG_KVP 0x3b0u /* bytes from the K plane to the V plane */ +#define ARG_HSTRIDE 0x3b4u /* bytes between kv heads */ +#define ARG_NQH 0x3b8u /* query heads (q and out row count per sequence) */ +#define ARG_CTXOFF 0x3bcu /* byte offset of the context-length array inside the table buffer */ +#define ARG_WORDS 16u +#define DESC_OFF 0x358u + +#define HD OMEGA_GPU_ATTN_HEAD_DIM +#define SH_Q 0u +#define SH_S 256u +#define SH_O 512u +#define SH_R 768u +#define F32_NEG_INF 0xff800000u + +/* divergent (omega #308 regression R2): 0 = production branch-free chunk loop; 1 = the + * lane-dependent "j >= ctx" branch restored inside a reconvergence region (BSSY/BSYNC) so + * the SHFL reductions run on a joined warp; 2 = the same with the BSYNC dropped (the + * 2026-10-04 bug shape, a negative control the host simulator must catch). */ +typedef struct { bool f32; uint32_t log2bs, log2gqa; int mutant; int divergent; } KSpec; + +static void gen_attention(Em *e, const KSpec *k) { + const uint32_t elem = k->f32 ? 4u : 2u; + const uint32_t kstep = k->f32 ? 8u : 4u; /* bytes per inner iteration: two dims */ + 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); + ldcu64(e, udesc, DESC_OFF); + ldc64(e, A, ARG_Q); ldc64(e, B, ARG_POOL); ldc64(e, C, ARG_OUT); ldc64(e, D, ARG_TAB); + ldc32(e, p_maxb, ARG_MAXB); ldc32(e, scale, ARG_SCALE); ldc32(e, p_bstride, ARG_BSTRIDE); ldc32(e, p_tstride, ARG_TSTRIDE); + ldc32(e, p_kvp, ARG_KVP); ldc32(e, p_hstride, ARG_HSTRIDE); ldc32(e, p_nqh, ARG_NQH); ldc32(e, p_ctxoff, ARG_CTXOFF); + s2r(e, tid, BW_SR_TID_X); s2r(e, h, BW_SR_CTAID_X); s2r(e, seq, BW_SR_CTAID_Y); + + int c1 = V(e), c4 = V(e), c32 = V(e), c64 = V(e), c256 = V(e), c512 = V(e), c768 = V(e), c896 = V(e), zero = V(e); + movi(e, c1, 1); movi(e, c4, 4); movi(e, c32, 32); movi(e, c64, 64); + movi(e, c256, SH_S); movi(e, c512, SH_O); movi(e, c768, SH_R); movi(e, c896, SH_R + 128); movrz(e, zero); + + /* 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); + 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); } + 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 (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); + } + + /* 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); + 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); + imadi(e, t1, t1, 4, NOREG); + wide(e, tab, t1, 1, D); + imadi(e, t1, seq, 4, p_ctxoff); + wide(e, ca, t1, 1, D); + ldg(e, ctx, ca, udesc); + /* V column base for dimension tid: pool + kv plane + tid * elem. The kv head offset is + * already inside the per-token offset phase A leaves in shared memory (found by the host + * simulator: adding it here too read V from the wrong head for every kv head but 0). */ + 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); 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 */ + isetp_ge_u32(e, zero, ctx); /* ctx == 0: out = 0 */ + 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 x = V(e), lo = V(e), hi = V(e), qa = V(e), qb = V(e), q0 = V(e), q1 = V(e), ka2 = V64(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); + movi(e, cm1, 0xFFFFFFFFu); iadd3(e, ctxm1, ctx, cm1); movi(e, cninf, F32_NEG_INF); + loop_begin(e); + int Lout = here(e); + /* No branch here: a warp split by "j >= ctx" stays split (the IR has no reconvergence + * instruction) and the SHFL reductions below then read inactive lanes, which is undefined + * (wrong dims tid >= tail on the chip, 2026-10-04). 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); + movrz(e, koff); + if (k->divergent) { + /* omega #308 R2: the lane-dependent branch, inside a reconvergence region. Lanes with + * j >= ctx skip phase A (s stays -inf, koff 0); the BSYNC at region_join rejoins them + * before the SHFL reductions below. divergent == 2 drops that BSYNC (negative control). */ + region_begin(e); + isetp_ge_u32(e, j, ctx); + region_exit(e, RX_IF_P0); + } else { + imadi(e, dneg, j, 0xFFFFFFFFu, ctxm1); /* ctx - 1 - j */ + shri(e, over, dneg, 31); + imadr(e, ot, over, tid, NOREG); + imadi(e, j, ot, 0xFFFFFFFFu, j); /* j - over*tid */ + } + /* phase A: token j */ + shri(e, bi, j, k->log2bs); + lop3andi(e, sl, j, (1u << k->log2bs) - 1u); + wide(e, ta, bi, 4, tab); + ldg(e, blk, ta, udesc); + imadr(e, koff, blk, p_bstride, NOREG); + if (k->mutant == OMEGA_GPU_ATTN_MUTANT_SLOT) { + /* K read from slot (t + 1) % block_size, V from the right slot: a K/V mismatch. + * (Shifting both only permutes matched pairs inside a full block, which softmax cannot see.) */ + int sl1 = V(e); + iadd3(e, j1, j, c1); lop3andi(e, sl1, j1, (1u << k->log2bs) - 1u); + imadr(e, sl1, sl1, p_tstride, koff); + iadd3(e, sl1, sl1, kvoff); + wide(e, ka, sl1, 1, B); + imadr(e, koff, sl, p_tstride, koff); + iadd3(e, koff, koff, kvoff); + } else { + imadr(e, koff, sl, p_tstride, koff); + iadd3(e, koff, koff, kvoff); + wide(e, ka, koff, 1, B); + } + movrz(e, dot); movrz(e, d); + loop_begin(e); + int Lin = here(e); + if (k->f32) { + ldg(e, lo, ka, udesc); + wide(e, ka2, c1, 4, ka); + ldg(e, hi, ka2, udesc); + } else { + ldg(e, x, ka, udesc); + imadi(e, lo, x, 0x10000u, NOREG); /* low bf16 -> f32: bits << 16 */ + lop3andi(e, hi, x, 0xffff0000u); /* high bf16 -> f32: keep the top half */ + } + imadi(e, qa, d, 8, NOREG); + lds32(e, q0, qa); + iadd3(e, qb, qa, c4); + lds32(e, q1, qb); + e_ffma(e, dot, q0, lo, dot); + e_ffma(e, dot, q1, hi, dot); + wide(e, ka, c1, kstep, ka); + iadd3(e, d, d, c1); + isetp_ge_u32(e, d, c32); + bra_back_if_not_p0(e, Lin); + loop_end(e); + e_fmul(e, s, dot, 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); + } + 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); + 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); + bar_sync(e); + lds32(e, ra, c768); lds32(e, rb, c896); + e_fmax(e, mc, ra, rb); + 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); + } + 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); + bar_sync(e); + lds32(e, ra, c768); lds32(e, rb, c896); + e_fadd(e, lc, ra, rb); + e_ffma(e, L, L, alpha, lc); + if (k->mutant != OMEGA_GPU_ATTN_MUTANT_NO_RESCALE) e_fmul(e, acc, acc, alpha); + + /* phase B: dimension tid over the chunk's tokens */ + int kk = V(e), tt = V(e), oa = V(e), ko = V(e), pa = V(e), pv = V(e), va = V64(e), v = V(e); + movrz(e, kk); + loop_begin(e); + int LB = here(e); + iadd3(e, tt, base, kk); + isetp_ge_u32(e, tt, ctx); + int bB = bra_fwd_if_p0(e); + imadi(e, oa, kk, 4, c512); + lds32(e, ko, oa); + imadi(e, pa, kk, 4, c256); + lds32(e, pv, pa); + wide(e, va, ko, 1, vb); + if (k->f32) ldg(e, v, va, udesc); + else { ldg16(e, v, va, udesc); imadi(e, v, v, 0x10000u, NOREG); } + e_ffma(e, acc, pv, v, acc); + iadd3(e, kk, kk, c1); + isetp_ge_u32(e, kk, c64); + bra_back_if_not_p0(e, LB); + loop_end(e); + patch_fwd(e, bB); + bar_sync(e); /* phase B reads of s/p and offsets finish before the next chunk writes them */ + iadd3(e, base, base, c64); + isetp_ge_u32(e, base, ctx); + bra_back_if_not_p0(e, Lout); + loop_end(e); + + patch_fwd(e, bZ); + int inv = V(e), o = V(e); + mufu(e, BW_IR_MUFU_RCP, inv, L); + e_fmul(e, o, acc, inv); + stg(e, oaddr, o, udesc); + tail(e); +} + +#define AT_GPR_BUDGET 64u + +static int build_kernel(const KSpec *k, OmegaBlackwellKernel *kernel, BlackwellIRProgram **keep) { + BlackwellIRProgram *prog = calloc(1, sizeof *prog); + if (!prog) return OMEGA_GPU_ATTN_CODEGEN_FAIL; + omega_bw_ir_init(prog); + Em e; memset(&e, 0, sizeof e); e.p = prog; + e.rg_mutant = (k->divergent == 2) ? 1 : 0; + gen_attention(&e, k); + if (e.depth != 0) e.err = -1; + if (e.rg.depth != 0) e.err = -1; /* a region left open has no join: refuse the build */ + int rc = OMEGA_GPU_ATTN_CODEGEN_FAIL; + int ra_rc = (e.err == 0) ? omega_bw_regalloc_solve(prog) : -1; + int loop_rc = (ra_rc == 0) ? check_loop_invariant(&e) : -1; +#ifdef OMEGA_ATTN_DEBUG + fprintf(stderr, "attn codegen f32=%d log2bs=%u log2gqa=%u mutant=%d emit_err=%d insns=%zu vregs=%d regalloc=%d loops=%d peak_gpr=%u\n", + (int)k->f32, k->log2bs, k->log2gqa, k->mutant, e.err, prog->count, prog->regalloc.num_vregs, ra_rc, loop_rc, prog->regalloc.peak_gpr_usage); +#endif + if (e.err == 0 && ra_rc == 0 && loop_rc == 0 && prog->regalloc.peak_gpr_usage <= AT_GPR_BUDGET) { + size_t max_bytes = (size_t)BW_MAX_IR_INSNS * 16; + memset(kernel, 0, sizeof *kernel); + kernel->code = malloc(max_bytes); + size_t emitted = 0; + if (kernel->code && omega_bw_encode_program(prog, kernel->code, max_bytes, &emitted) == 0) { + kernel->code_size = emitted; + kernel->insn_count = emitted / 16; + kernel->gpr_count = prog->regalloc.peak_gpr_usage; + kernel->uniform_gpr_count = prog->regalloc.peak_ugpr_usage; + sha256_hash(kernel->code, kernel->code_size, kernel->code_digest); + rc = OMEGA_GPU_ATTN_OK; + } else { + free(kernel->code); kernel->code = NULL; + } + } + if (keep && rc == OMEGA_GPU_ATTN_OK) *keep = prog; else free(prog); + return rc; +} + +/* --------------------------------------------------------- kernel cache */ + +/* One kernel per KSpec; the device copy is uploaded once and stays resident for + * the process (cut 4b). The IR program is kept for the host simulator. */ +static int g_mutant; +static int g_divergent; /* omega #308 R2 test hook: see KSpec.divergent */ +static bool g_dedupe = true; /* shared-prefix staging dedupe; false = legacy per-sequence staging (test hook) */ +typedef struct { int used; KSpec k; OmegaBlackwellKernel kernel; BlackwellIRProgram *prog; NvrmMem code; } Slot; +static OmegaGpuAttnSim g_sim; +static Slot g_cache[8]; +static OmegaGpuScratch g_q, g_pool, g_tab, g_out; /* staging, grown to the high-water mark, reused per call */ +static bool g_hooked; +#define LOCK() omega_gpu_session_lock() +#define UNLOCK() omega_gpu_session_unlock() + +void omega_gpu_attention_test_set_simulator(OmegaGpuAttnSim sim) { LOCK(); g_sim = sim; UNLOCK(); } +void omega_gpu_attention_test_set_dedupe(bool on) { LOCK(); g_dedupe = on; UNLOCK(); } + +static void cache_clear_locked(void) { + for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) + if (g_cache[i].used) { free(g_cache[i].kernel.code); free(g_cache[i].prog); omega_gpu_session_free(&g_cache[i].code); memset(&g_cache[i], 0, sizeof g_cache[i]); } +} + +void omega_gpu_attention_cache_clear(void) { + LOCK(); + cache_clear_locked(); + UNLOCK(); +} + +/* Called by the session (lock held, device still open) right before it closes. */ +static void on_session_close(void) { + cache_clear_locked(); + omega_gpu_session_scratch_free(&g_q); omega_gpu_session_scratch_free(&g_pool); + omega_gpu_session_scratch_free(&g_tab); omega_gpu_session_scratch_free(&g_out); +} + +void omega_gpu_attention_test_set_mutant(OmegaGpuAttnMutant m) { + LOCK(); + g_mutant = (int)m; + cache_clear_locked(); + UNLOCK(); +} + +/* Caller holds the lock. Builds the kernel if needed; uploads the device copy when + * `upload` (the chip path; the simulator never needs one). */ +static int kernel_for(bool f32, uint32_t log2bs, uint32_t log2gqa, bool upload, Slot **out, bool *hit) { + KSpec k = { .f32 = f32, .log2bs = log2bs, .log2gqa = log2gqa, .mutant = g_mutant, .divergent = g_divergent }; + Slot *s = NULL; + for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) + if (g_cache[i].used && g_cache[i].k.f32 == k.f32 && g_cache[i].k.log2bs == k.log2bs && g_cache[i].k.log2gqa == k.log2gqa && g_cache[i].k.mutant == k.mutant && g_cache[i].k.divergent == k.divergent) { /* field compare: memcmp would read struct padding */ + s = &g_cache[i]; *hit = true; break; + } + if (!s) { + OmegaBlackwellKernel kern; BlackwellIRProgram *kp = NULL; + int rc = build_kernel(&k, &kern, &kp); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + size_t slot = 0; + for (size_t i = 0; i < sizeof g_cache / sizeof g_cache[0]; i++) if (!g_cache[i].used) { slot = i; break; } + s = &g_cache[slot]; + if (s->used) { free(s->kernel.code); free(s->prog); omega_gpu_session_free(&s->code); } /* full: evict slot 0 */ + memset(s, 0, sizeof *s); + s->used = 1; s->k = k; s->kernel = kern; s->prog = kp; + *hit = false; + } + if (upload && !s->code.cpu) { + if (omega_gpu_session_alloc_code(s->kernel.code_size, &s->code) != 0) return OMEGA_GPU_ATTN_CHIP_FAIL; + memcpy(s->code.cpu, s->kernel.code, s->kernel.code_size); + __asm__ volatile("dsb sy" ::: "memory"); + } + *out = s; + return OMEGA_GPU_ATTN_OK; +} + +int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, OmegaBlackwellKernel *kernel) { + if (!kernel || log2_block_size > 16 || log2_gqa > 6) return OMEGA_GPU_ATTN_BAD_ARGS; + LOCK(); + KSpec k = { .f32 = kv_f32, .log2bs = log2_block_size, .log2gqa = log2_gqa, .mutant = g_mutant, .divergent = g_divergent }; + UNLOCK(); + return build_kernel(&k, kernel, NULL); +} + +const char *omega_gpu_attention_last_error(void) { return omega_gpu_session_last_error(); } + +/* ------------------------------------------------------------ launcher */ + +#define AT_POISON 0xffbadbadu +#define AT_WAIT_MS 600000ull + +static uint64_t now_ns(void) { + struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); + return (uint64_t)t.tv_sec * 1000000000ULL + (uint64_t)t.tv_nsec; +} + +typedef OmegaGpuAttnLaunch Launch; + +/* Caller holds the lock. Chip path: open the shared device on first use. */ +static int dev_open_locked(void) { + if (!g_hooked) { (void)omega_gpu_session_on_close(on_session_close); g_hooked = true; } + return omega_gpu_session_open() ? OMEGA_GPU_ATTN_OK : OMEGA_GPU_ATTN_CHIP_FAIL; +} + +/* Where a call stages the KV slice it is about to hand the kernel: straight into the + * device staging buffer on the chip path (one copy), a host buffer under the simulator. + * Caller holds the lock; the result is valid until the next staging call. */ +static void *stage_target(size_t bytes, void **host_tmp) { + *host_tmp = NULL; + if (g_sim) { *host_tmp = malloc(bytes ? bytes : 1); return *host_tmp; } + if (omega_gpu_session_scratch(&g_pool, bytes) != 0) return NULL; + return g_pool.mem.cpu; +} + +/* One launch through the shared session (omega_gpu_session_launch: shader-cache + * invalidate, constant bank, QMD0/QMD1, first marker, L2_FLUSH_DIRTY, second marker), + * then readback and the poison scan. L->pool may already be the pool staging buffer. */ +static int run_launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) { + if (omega_gpu_session_scratch(&g_q, L->q_bytes) || omega_gpu_session_scratch(&g_tab, L->tab_bytes) || + omega_gpu_session_scratch(&g_out, L->out_bytes) || (L->pool != g_pool.mem.cpu && omega_gpu_session_scratch(&g_pool, L->pool_bytes))) + return OMEGA_GPU_ATTN_CHIP_FAIL; + memcpy(g_q.mem.cpu, L->q, L->q_bytes); + if (L->pool != g_pool.mem.cpu) memcpy(g_pool.mem.cpu, L->pool, L->pool_bytes); + memcpy(g_tab.mem.cpu, L->tab, L->tab_bytes); + size_t out_words = L->out_bytes / 4; + uint32_t *out_dev = (uint32_t *)g_out.mem.cpu; + for (size_t i = 0; i < out_words; i++) out_dev[i] = AT_POISON; + __asm__ volatile("dsb sy" ::: "memory"); + + uint32_t args[ARG_WORDS]; + args[0] = (uint32_t)g_q.mem.va; args[1] = (uint32_t)(g_q.mem.va >> 32); + args[2] = (uint32_t)g_pool.mem.va; args[3] = (uint32_t)(g_pool.mem.va >> 32); + args[4] = (uint32_t)g_out.mem.va; args[5] = (uint32_t)(g_out.mem.va >> 32); + 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 = HD, .threads_y = 1, + .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, + }; + uint64_t elapsed = 0; uint32_t marker = 0; + if (omega_gpu_session_launch(&GL, &elapsed, &marker) != 0) return OMEGA_GPU_ATTN_CHIP_FAIL; + + memcpy(L->out, g_out.mem.cpu, L->out_bytes); + uint32_t unwritten = 0; + for (size_t i = 0; i < out_words; i++) if (((uint32_t *)L->out)[i] == AT_POISON) unwritten++; + if (info) { + info->chip_calls++; + info->elapsed_ns += elapsed; + info->completion_marker = marker; + info->unwritten_words += unwritten; + info->threads_per_cta = HD; + info->ctas_last_launch = L->grid_x * L->grid_y; + } + return unwritten ? OMEGA_GPU_ATTN_UNWRITTEN : OMEGA_GPU_ATTN_OK; +} + +/* Caller holds the lock. Accounts the launch's q / table / output traffic (the KV + * staging bytes are accounted where the slices are copied). */ +static int launch(const Slot *ks, const Launch *L, OmegaGpuAttnInfo *info) { + if (info) { info->q_bytes += L->q_bytes; info->tab_bytes += L->tab_bytes; info->out_bytes += L->out_bytes; info->kv_source = OMEGA_GPU_ATTN_KV_STAGED; } + if (g_sim) return g_sim(ks->prog, L, info); + return run_launch(ks, L, info); +} + +/* ------------------------------------------------------- public entries */ + +static void info_begin(OmegaGpuAttnInfo *info, const OmegaBlackwellKernel *k, bool hit) { + if (!info) return; + memset(info, 0, sizeof *info); + info->kernel_cache_hit = hit; + info->gpr_count = k->gpr_count; + info->insn_count = (uint32_t)k->insn_count; + snprintf(info->target_chip, sizeof info->target_chip, "NVIDIA DGX Spark (Grace Blackwell GB10)"); + info->sm_architecture = 121; +} +static uint32_t f2u(float f) { uint32_t u; memcpy(&u, &f, 4); return u; } +static int log2_exact(uint32_t v, uint32_t *out) { + if (v == 0 || (v & (v - 1))) return -1; + uint32_t l = 0; while ((1u << l) != v) l++; + *out = l; return 0; +} +static float score_scale(void) { return (float)(1.4426950408889634 / sqrt((double)HD)); } + +/* Common head-shape checks; returns log2 of the gqa ratio. */ +static int check_heads(uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, uint32_t *log2gqa) { + if (num_q_heads == 0 || num_kv_heads == 0 || head_dim == 0) return OMEGA_GPU_ATTN_BAD_ARGS; + if (head_dim != HD || num_q_heads > OMEGA_GPU_ATTN_MAX_Q_HEADS) return OMEGA_GPU_ATTN_TOO_LARGE; + if (num_q_heads % num_kv_heads != 0 || log2_exact(num_q_heads / num_kv_heads, log2gqa) != 0) return OMEGA_GPU_ATTN_BAD_ARGS; + return OMEGA_GPU_ATTN_OK; +} + +/* Common prologue of every chip entry (lock held on success): device, kernel, info. */ +static int begin(bool f32, uint32_t log2bs, uint32_t log2gqa, Slot **ks, OmegaGpuAttnInfo *info) { + LOCK(); + int rc = g_sim ? OMEGA_GPU_ATTN_OK : dev_open_locked(); + bool hit = false; + if (rc == OMEGA_GPU_ATTN_OK) rc = kernel_for(f32, log2bs, log2gqa, !g_sim, ks, &hit); + if (rc != OMEGA_GPU_ATTN_OK) { UNLOCK(); return rc; } + info_begin(info, &(*ks)->kernel, hit); + return OMEGA_GPU_ATTN_OK; +} + +int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const float *v_cache, + uint32_t seq_len, uint32_t num_q_heads, uint32_t num_kv_heads, + uint32_t head_dim, float *out, OmegaGpuAttnInfo *info) { + uint64_t t0 = now_ns(); + if (!q || !k_cache || !v_cache || !out) return OMEGA_GPU_ATTN_BAD_ARGS; + uint32_t log2gqa; + int rc = check_heads(num_q_heads, num_kv_heads, head_dim, &log2gqa); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + if (seq_len > OMEGA_GPU_ATTN_MAX_GQA_CTX) return OMEGA_GPU_ATTN_TOO_LARGE; + size_t n_out = (size_t)num_q_heads * HD; + if (seq_len == 0) { memset(out, 0, n_out * 4); if (info) { memset(info, 0, sizeof *info); info->call_ns = now_ns() - t0; } return OMEGA_GPU_ATTN_OK; } + Slot *ks = NULL; + const uint32_t log2bs = 12; /* one block of 4096 slots */ + rc = begin(true, log2bs, log2gqa, &ks, info); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + size_t plane = (size_t)seq_len * num_kv_heads * HD * 4; + void *host_tmp = NULL; + uint8_t *pool = stage_target(2 * plane, &host_tmp); + if (!pool) { UNLOCK(); return OMEGA_GPU_ATTN_CHIP_FAIL; } + memcpy(pool, k_cache, plane); + memcpy(pool + plane, v_cache, plane); + if (info) { info->kv_bytes_staged += 2 * plane; info->kv_bytes_naive += 2 * plane; info->kv_blocks_logical += 1; info->kv_blocks_unique += 1; } /* one contiguous pseudo-block */ + 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, + .params = { 1, f2u(score_scale()), (uint32_t)(2 * plane), num_kv_heads * HD * 4, (uint32_t)plane, HD * 4, num_q_heads, 4 } + }; + rc = launch(ks, &L, info); + free(host_tmp); + UNLOCK(); + if (info) info->call_ns = now_ns() - t0; + return rc; +} + +/* 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. */ +static int paged_core(const float *q, const uint8_t *pool, const OmegaGpuKvLayout *ly, + const uint32_t *const *tables, const uint32_t *n_blocks, const uint32_t *ctx, + uint32_t num_seqs, uint32_t layer_idx, uint32_t num_q_heads, uint32_t num_kv_heads, + uint32_t head_dim, float *out, OmegaGpuAttnInfo *info) { + uint64_t t0 = now_ns(); + uint32_t log2gqa, log2bs; + int rc = check_heads(num_q_heads, num_kv_heads, head_dim, &log2gqa); + if (rc != OMEGA_GPU_ATTN_OK) return rc; + if (!ly || layer_idx >= ly->num_layers || log2_exact(ly->block_size, &log2bs) != 0) return OMEGA_GPU_ATTN_BAD_ARGS; + /* the oracle addresses heads as kv_head * head_dim * 2 inside a token: the layout must agree */ + if (ly->head_stride_bytes != HD * 2 || ly->token_stride_bytes != (uint64_t)num_kv_heads * HD * 2 || + ly->kv_plane_stride_bytes != (uint64_t)ly->block_size * ly->token_stride_bytes || + ly->layer_stride_bytes != 2 * ly->kv_plane_stride_bytes || ly->block_stride_bytes < (uint64_t)ly->num_layers * ly->layer_stride_bytes) + return OMEGA_GPU_ATTN_BAD_ARGS; + size_t row = (size_t)num_q_heads * HD; + /* effective context per sequence and block id range check */ + uint32_t *eff = calloc(num_seqs ? num_seqs : 1, sizeof *eff); + if (!eff) return OMEGA_GPU_ATTN_CHIP_FAIL; + for (uint32_t s = 0; s < num_seqs; s++) { + uint64_t cap = (uint64_t)n_blocks[s] * ly->block_size; + eff[s] = (uint32_t)(ctx[s] < cap ? ctx[s] : cap); + for (uint32_t b = 0; b < n_blocks[s]; b++) { + uint64_t id = tables[s][b]; + if (id >= ly->num_blocks || id * ly->block_stride_bytes + (uint64_t)(layer_idx + 1) * ly->layer_stride_bytes > ly->pool_bytes) { free(eff); return OMEGA_GPU_ATTN_BAD_ARGS; } + } + } + Slot *ks = NULL; + rc = begin(false, log2bs, log2gqa, &ks, info); + if (rc != OMEGA_GPU_ATTN_OK) { free(eff); return rc; } + uint32_t seqs_per_launch = OMEGA_GPU_ATTN_MAX_CTAS / num_q_heads; + if (seqs_per_launch == 0) seqs_per_launch = 1; + uint32_t maxb = 1; + for (uint32_t s = 0; s < num_seqs; s++) if (n_blocks[s] > maxb) maxb = n_blocks[s]; + /* Dedupe map: physical block id -> staged slot of the current launch (-1 = not staged yet), + * plus the list of ids touched by the launch (in slot order) so the reset is O(unique). */ + int32_t *slot_of = NULL; uint32_t *touched = NULL; + if (g_dedupe) { + size_t nb = ly->num_blocks ? ly->num_blocks : 1; + slot_of = malloc(nb * sizeof *slot_of); + touched = malloc(nb * sizeof *touched); + if (!slot_of || !touched) { free(slot_of); free(touched); free(eff); UNLOCK(); return OMEGA_GPU_ATTN_CHIP_FAIL; } + memset(slot_of, 0xff, nb * sizeof *slot_of); /* every entry -1 */ + } + for (uint32_t s0 = 0; s0 < num_seqs && rc == OMEGA_GPU_ATTN_OK; s0 += seqs_per_launch) { + uint32_t ns = num_seqs - s0 < seqs_per_launch ? num_seqs - s0 : seqs_per_launch; + /* logical references: every sequence's blocks up to its (truncated) context */ + uint32_t total = 0; + for (uint32_t s = 0; s < ns; s++) total += eff[s0 + s] ? (eff[s0 + s] + ly->block_size - 1) / ly->block_size : 0; + uint32_t *tab = calloc((size_t)ns * maxb + ns, sizeof *tab); + if (!tab) { rc = OMEGA_GPU_ATTN_CHIP_FAIL; break; } + /* pass 1: assign staged slots. Dedupe keys on the PHYSICAL block id (not the table + * position): a CoW prefix block shared by several branches gets one slot. Each + * sequence's compact table keeps its own block order and truncated context. */ + uint32_t g = 0; + for (uint32_t s = 0; s < ns; s++) { + uint32_t need = eff[s0 + s] ? (eff[s0 + s] + ly->block_size - 1) / ly->block_size : 0; + for (uint32_t b = 0; b < need; b++) { + uint32_t id = tables[s0 + s][b]; + if (g_dedupe) { + if (slot_of[id] < 0) { slot_of[id] = (int32_t)g; touched[g] = id; g++; } + tab[(size_t)s * maxb + b] = (uint32_t)slot_of[id]; + } else { + tab[(size_t)s * maxb + b] = g++; /* legacy: one slot per reference */ + } + } + tab[(size_t)ns * maxb + s] = eff[s0 + s]; + } + uint64_t staged_bytes = (uint64_t)(g ? g : 1) * ly->layer_stride_bytes; + if (staged_bytes > 0xffffffffull) { free(tab); rc = OMEGA_GPU_ATTN_TOO_LARGE; break; } + void *host_tmp = NULL; + uint8_t *staged = stage_target((size_t)staged_bytes, &host_tmp); + if (!staged) { free(tab); rc = OMEGA_GPU_ATTN_CHIP_FAIL; break; } + /* pass 2: copy each staged slot's (physical block, layer) slice exactly once */ + if (g_dedupe) { + for (uint32_t u = 0; u < g; u++) { + const uint8_t *src = pool + (size_t)touched[u] * ly->block_stride_bytes + (size_t)layer_idx * ly->layer_stride_bytes; + memcpy(staged + (size_t)u * ly->layer_stride_bytes, src, (size_t)ly->layer_stride_bytes); + slot_of[touched[u]] = -1; /* reset for the next launch */ + } + } else { + uint32_t w = 0; + for (uint32_t s = 0; s < ns; s++) { + uint32_t need = eff[s0 + s] ? (eff[s0 + s] + ly->block_size - 1) / ly->block_size : 0; + for (uint32_t b = 0; b < need; b++, w++) { + const uint8_t *src = pool + (size_t)tables[s0 + s][b] * ly->block_stride_bytes + (size_t)layer_idx * ly->layer_stride_bytes; + memcpy(staged + (size_t)w * ly->layer_stride_bytes, src, (size_t)ly->layer_stride_bytes); + } + } + } + if (info) { + info->kv_blocks_logical += total; info->kv_blocks_unique += g; + info->kv_bytes_staged += (uint64_t)g * ly->layer_stride_bytes; + info->kv_bytes_naive += (uint64_t)total * ly->layer_stride_bytes; + } + Launch L = { + .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 = out + (size_t)s0 * row, .out_bytes = (size_t)ns * row * 4, + .grid_x = num_q_heads, .grid_y = ns, + .params = { maxb, f2u(score_scale()), (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 } + }; + rc = launch(ks, &L, info); + free(host_tmp); free(tab); + } + UNLOCK(); + free(eff); free(slot_of); free(touched); + if (info) info->call_ns = now_ns() - t0; + return rc; +} + +int omega_gpu_paged_attention_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const uint32_t *block_ids, uint32_t num_block_ids, + uint32_t context_len, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info) { + if (!q || !pool || !layout || !out || (num_block_ids && !block_ids)) return OMEGA_GPU_ATTN_BAD_ARGS; + const uint32_t *tables[1] = { block_ids }; + uint32_t nb[1] = { num_block_ids }, cx[1] = { context_len }; + return paged_core(q, pool, layout, tables, nb, cx, 1, layer_idx, num_q_heads, num_kv_heads, head_dim, out, info); +} + +int omega_gpu_paged_attention_batch_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const int32_t *block_tables, const int32_t *context_lens, + uint32_t max_blocks_per_seq, uint32_t num_seqs, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info) { + if (!q || !pool || !layout || !out || !block_tables || !context_lens || num_seqs == 0) return OMEGA_GPU_ATTN_BAD_ARGS; + /* the oracle's rules: ctx <= 0 -> 0; a table row past the array -> empty; negatives removed */ + uint32_t **tables = calloc(num_seqs, sizeof *tables); + uint32_t *nb = calloc(num_seqs, sizeof *nb), *cx = calloc(num_seqs, sizeof *cx); + if (!tables || !nb || !cx) { free(tables); free(nb); free(cx); return OMEGA_GPU_ATTN_CHIP_FAIL; } + int rc = OMEGA_GPU_ATTN_OK; + for (uint32_t s = 0; s < num_seqs; s++) { + cx[s] = context_lens[s] > 0 ? (uint32_t)context_lens[s] : 0; + tables[s] = calloc(max_blocks_per_seq ? max_blocks_per_seq : 1, sizeof **tables); + if (!tables[s]) { rc = OMEGA_GPU_ATTN_CHIP_FAIL; break; } + for (uint32_t b = 0; b < max_blocks_per_seq; b++) { + int32_t v = block_tables[(size_t)s * max_blocks_per_seq + b]; + if (v >= 0) tables[s][nb[s]++] = (uint32_t)v; + } + } + if (rc == OMEGA_GPU_ATTN_OK) + rc = paged_core(q, pool, layout, (const uint32_t *const *)tables, nb, cx, num_seqs, layer_idx, num_q_heads, num_kv_heads, head_dim, out, info); + for (uint32_t s = 0; s < num_seqs; s++) free(tables[s]); + free(tables); free(nb); free(cx); + return rc; +} + +static const char *const k_mutant_names[OMEGA_GPU_ATTN_MUTANT_COUNT] = { + "none", "NO_MAX", "KV_HEAD", "SLOT", "NO_RESCALE", "Q_ROW", "OUT_ROW" +}; +_Static_assert(sizeof k_mutant_names / sizeof k_mutant_names[0] == OMEGA_GPU_ATTN_MUTANT_COUNT, "mutant name table"); + +const char *omega_gpu_attention_mutant_name(OmegaGpuAttnMutant m) { + return (m >= 0 && m < OMEGA_GPU_ATTN_MUTANT_COUNT && k_mutant_names[m]) ? k_mutant_names[m] : "?"; +} + +const char *omega_gpu_attention_rc_name(int rc) { + switch (rc) { + case OMEGA_GPU_ATTN_OK: return "OK"; + case OMEGA_GPU_ATTN_BAD_ARGS: return "BAD_ARGS"; + case OMEGA_GPU_ATTN_TOO_LARGE: return "TOO_LARGE"; + case OMEGA_GPU_ATTN_CODEGEN_FAIL: return "CODEGEN_FAIL"; + case OMEGA_GPU_ATTN_CHIP_FAIL: return "CHIP_FAIL"; + case OMEGA_GPU_ATTN_UNWRITTEN: return "UNWRITTEN"; + default: return "UNKNOWN"; + } +} + +/* omega #308 R2 test hook: 0 production, 1 lane-dependent branch inside a reconvergence + * region, 2 the same with the BSYNC dropped (negative control). Clears the kernel cache. */ +void omega_gpu_attention_test_set_divergent(int mode) { + LOCK(); + g_divergent = (mode < 0 || mode > 2) ? 0 : mode; + cache_clear_locked(); + UNLOCK(); +} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.h b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.h new file mode 100644 index 000000000..f4931c2a6 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/omega_gpu_attention_api.h @@ -0,0 +1,205 @@ +#ifndef OMEGA_GPU_ATTENTION_API_H +#define OMEGA_GPU_ATTENTION_API_H +/* + * omega_gpu_attention_api: native (no CUDA) decode attention for the AIEN + * inference stack (FB-1 cut 5, 2026-10-04). + * + * Two kernel families, one query per (sequence, query head), generated by our + * own codegen (src/omega_blackwell_codegen.c IR) and launched through the same + * chip-proven sequence as cuts 1b and 4: every buffer GPU-uncached (nvos.h + * NVOS32_ATTR2_GPU_CACHEABLE: system memory cached by the GPU is not coherent + * with CPU mappings), shader caches invalidated before the launch (clcec0.h + * NVCEC0_INVALIDATE_SHADER_CACHES, cut 1b finding), first marker, + * L2_FLUSH_DIRTY, second marker (C3 tail), poison-filled output scanned for + * unwritten words after readback. + * + * The math follows aien-sovereign-core crates/aien-inference-abi/src/backend.rs + * (ReferenceCpuBackend / TensorBackend defaults), read 2026-10-04 at main 8b5caed: + * gqa_attention(out, q, k_cache, v_cache, seq_len, num_q_heads, num_kv_heads, head_dim) + * k_cache / v_cache are f32 [seq_len][num_kv_heads][head_dim]; query head h reads + * kv head h / (num_q_heads / num_kv_heads); score = (q . k) / sqrt(head_dim); + * softmax over all seq_len tokens (no mask: one query attends to the whole history); + * out[h] = sum_t softmax_t v_t. seq_len == 0 writes zeros. + * paged_attention(out, q, pool, block_ids, context_len, layer_idx, ...) + * the KV pool is bf16 in aien-kv-cache's canonical layout (KvLayout strides in + * bytes: block, layer, kv plane (0 = K, 1 = V), token, head); token t lives in + * block_ids[t / block_size] at slot t % block_size; tokens whose block index is + * past the end of block_ids are dropped; context_len == 0 or no blocks writes zeros. + * paged_attention_batch: per sequence s, context_lens[s] <= 0 means 0, the block + * table row is block_tables[s*max_blocks .. (s+1)*max_blocks] (empty if that row + * runs past the array), negative entries are removed (the rest close up). + * + * Chip math: scores in f32 (FFMA over the head), online softmax per chunk of + * head_dim tokens: running max (FMNMX), p = EX2((s - m) * log2 e) folded into the + * score scale, rescale factor alpha = EX2(m_old - m_new), f32 sums, final MUFU.RCP. + * bf16 K is read as 32-bit pairs (LDG.E) and widened by a 16-bit shift (bf16 is + * the top half of an f32); bf16 V by LDG.E.U16 and the same shift. f32 K/V are + * read directly. Tolerances are stated and justified in tests/gpu_attention_test.c. + * + * Launch envelope: at most OMEGA_GPU_ATTN_MAX_CTAS CTAs per launch (investigation + * I42, same as cuts 1b and 4): grid = (num_q_heads, sequences per launch). + * Shared memory: the QMD declares 1024 bytes (clcec0qmd.h SHARED_MEMORY_SIZE_SHIFTED7, + * src/omega_blackwell_qmd.c word 36); the kernel uses exactly 4 x 256 bytes for + * head_dim 64, so head_dim is fixed at 64 in this cut (TinyLlama and Llama-3.2-1B). + * + * Staging: the host copies q, the referenced KV blocks' layer slice, the (compacted, + * renumbered) block tables and the context lengths into GPU-uncached staging buffers + * for each launch and copies the result back. The kernel itself walks the block + * table; a resident pool handle is a later cut. Since the attention hardening cut + * (2026-10-04) a launch stages each physical block's layer slice once however many + * sequences of the batch reference it (shared CoW prefixes), and OmegaGpuAttnInfo + * reports the bytes staged against the per-sequence (naive) figure. + * + * Cut 4b (2026-10-04): the device, channel and launch scratch are the process-wide + * session shared with the matmul and elementwise APIs (omega_gpu_session.h): one + * open per process instead of one per call (~40 ms), kernels resident after first + * use, staging buffers reused at their high-water mark (the KV slice is written + * straight into the device staging buffer). Calls serialise on one lock. + */ +#include +#include +#include +#include "omega_blackwell_matmul.h" /* OmegaBlackwellKernel */ +#ifdef __cplusplus +extern "C" { +#endif + +enum { + OMEGA_GPU_ATTN_OK = 0, + OMEGA_GPU_ATTN_BAD_ARGS = -1, /* NULL pointer, zero dimension, head mapping or block id out of range */ + OMEGA_GPU_ATTN_TOO_LARGE = -2, /* head_dim != 64, num_q_heads > 64, context past the envelope */ + OMEGA_GPU_ATTN_CODEGEN_FAIL = -3, /* our codegen refused or exceeded the register budget */ + OMEGA_GPU_ATTN_CHIP_FAIL = -4, /* device open, alloc, submit, marker or release failed */ + OMEGA_GPU_ATTN_UNWRITTEN = -5 /* output words still equal to their poison after the run */ +}; + +#define OMEGA_GPU_ATTN_HEAD_DIM 64u /* threads per CTA = head_dim (one thread per dimension / per token of a chunk) */ +#define OMEGA_GPU_ATTN_MAX_CTAS 64u +#define OMEGA_GPU_ATTN_MAX_Q_HEADS 64u +#define OMEGA_GPU_ATTN_MAX_GQA_CTX 4096u /* contiguous path: one block of 2^12 slots */ + +/* Mirror of aien-kv-cache KvLayoutDesc (crates/aien-kv-cache/src/lib.rs, main 8b5caed), + * field for field, strides in bytes. */ +typedef struct { + uint64_t block_stride_bytes; + uint64_t layer_stride_bytes; + uint64_t kv_plane_stride_bytes; + uint64_t token_stride_bytes; + uint64_t head_stride_bytes; + uint64_t pool_bytes; + uint32_t num_blocks; + uint32_t num_layers; + uint32_t block_size; /* must be a power of two (the kernel shifts and masks) */ +} OmegaGpuKvLayout; + +typedef struct { + uint32_t chip_calls; /* launches made */ + uint64_t elapsed_ns; /* sum of submit-to-second-marker over the launches */ + uint64_t call_ns; /* wall time of the whole API call (staging, launches, copy-out) */ + uint32_t completion_marker; /* first marker word of the last launch */ + uint32_t unwritten_words; /* poison words left in the outputs (0 on OK) */ + uint32_t gpr_count, insn_count; + bool kernel_cache_hit; /* the kernel was already generated */ + uint32_t ctas_last_launch, threads_per_cta; + char target_chip[64]; + uint32_t sm_architecture; + /* Appended (attention hardening cut, 2026-10-04): transfer accounting for the call. + * Existing field order above is ABI; sovereign-core mirrors this struct field for field. */ + uint64_t kv_bytes_staged; /* KV layer-slice bytes actually copied into staging (sum over launches) */ + uint64_t kv_bytes_naive; /* what per-sequence staging would have copied (every sequence its own blocks) */ + uint32_t kv_blocks_logical; /* block references summed over sequences, truncated to each context */ + uint32_t kv_blocks_unique; /* distinct (physical block, layer) slices staged, summed over launches */ + uint64_t q_bytes, tab_bytes, out_bytes; /* q, block-table/context and result traffic (sum over launches) */ + uint32_t kv_source; /* OMEGA_GPU_ATTN_KV_STAGED; a resident pool is a later cut */ +} OmegaGpuAttnInfo; +#define OMEGA_GPU_ATTN_KV_STAGED 0u + +/* Contiguous f32 KV (TensorBackend::gqa_attention). q and out: [num_q_heads][head_dim]. */ +int omega_gpu_gqa_attention_f32(const float *q, const float *k_cache, const float *v_cache, + uint32_t seq_len, uint32_t num_q_heads, uint32_t num_kv_heads, + uint32_t head_dim, float *out, OmegaGpuAttnInfo *info); + +/* Paged bf16 KV (TensorBackend::paged_attention). pool points at the pool base. */ +int omega_gpu_paged_attention_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const uint32_t *block_ids, uint32_t num_block_ids, + uint32_t context_len, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info); + +/* Batched (TensorBackend::paged_attention_batch). block_tables: [num_seqs][max_blocks_per_seq] i32 + * (negative = none), context_lens: [num_seqs] i32. q and out: [num_seqs][num_q_heads][head_dim]. */ +int omega_gpu_paged_attention_batch_bf16(const float *q, const void *pool, const OmegaGpuKvLayout *layout, + const int32_t *block_tables, const int32_t *context_lens, + uint32_t max_blocks_per_seq, uint32_t num_seqs, uint32_t layer_idx, + uint32_t num_q_heads, uint32_t num_kv_heads, uint32_t head_dim, + float *out, OmegaGpuAttnInfo *info); + +const char *omega_gpu_attention_rc_name(int rc); +void omega_gpu_attention_cache_clear(void); + +/* Stage name of the most recent CHIP_FAIL ("" if none), shared with the other GPU APIs + * (omega_gpu_session_last_error); an open failure carries the driver text. */ +const char *omega_gpu_attention_last_error(void); + +/* Test hooks. Mutants are deliberately wrong kernels the parity test must catch; + * never set in production. */ +typedef enum { + OMEGA_GPU_ATTN_MUTANT_NONE = 0, + OMEGA_GPU_ATTN_MUTANT_NO_MAX, /* softmax without the running-max subtraction (overflows for large scores) */ + OMEGA_GPU_ATTN_MUTANT_KV_HEAD, /* reads kv head (h / ratio) ^ 1 */ + OMEGA_GPU_ATTN_MUTANT_SLOT, /* K read from slot (t + 1) % block_size while V keeps slot t (K/V mismatch) */ + OMEGA_GPU_ATTN_MUTANT_NO_RESCALE, /* the accumulator is not rescaled when the max moves between chunks */ + /* Head-wiring mutants (attention hardening cut, 2026-10-04). Both swap the rows of + * query heads h and h ^ 1, so they need num_q_heads even (>= 2); never run them on a + * one-head shape (row h ^ 1 of the last sequence would be past the buffer). */ + OMEGA_GPU_ATTN_MUTANT_Q_ROW, /* q loaded from query-head row h ^ 1 (kv head and output row stay h) */ + OMEGA_GPU_ATTN_MUTANT_OUT_ROW, /* the correct result for head h stored in flattened output row h ^ 1 */ + OMEGA_GPU_ATTN_MUTANT_COUNT /* one past the last mutant: every battery enumerates 1 .. COUNT-1 */ +} OmegaGpuAttnMutant; +void omega_gpu_attention_test_set_mutant(OmegaGpuAttnMutant m); + +/* TEST ONLY (omega #308 regression R2). 0 = production branch-free chunk loop; 1 = the + * lane-dependent j >= ctx branch restored inside a BSSY/BSYNC reconvergence region; + * 2 = that kernel with the BSYNC dropped (negative control: the host simulator must refuse + * it). Clears the kernel cache. */ +void omega_gpu_attention_test_set_divergent(int mode); +/* "none", "NO_MAX", ... ; "?" past COUNT. The table is checked against COUNT at compile time. */ +const char *omega_gpu_attention_mutant_name(OmegaGpuAttnMutant m); + +/* Generate a kernel without launching (host tests, nvdisasm listings). + * log2_block_size: shift for token -> block; log2_gqa: shift for query head -> kv head. */ +int omega_gpu_attention_codegen(bool kv_f32, uint32_t log2_block_size, uint32_t log2_gqa, + OmegaBlackwellKernel *kernel); + +/* One launch as the launcher sees it (test hook below). Pointers are host buffers; + * params are the eight argument words after the four buffer addresses: + * max_blocks, scale bits, block stride, token stride, kv plane stride, head stride, + * num_q_heads, context-array byte offset. */ +typedef struct { + const void *q; size_t q_bytes; + const void *pool; size_t pool_bytes; + const void *tab; size_t tab_bytes; + void *out; size_t out_bytes; + uint32_t grid_x, grid_y; + uint32_t params[8]; +} OmegaGpuAttnLaunch; + +/* Host simulator hook (tests): when set, every launch runs the allocated IR program + * through `sim` instead of the chip. Lets the whole battery run on the host first + * (review before chip time). The program is post register allocation. */ +struct BlackwellIRProgramTag; +typedef int (*OmegaGpuAttnSim)(const void *prog /* const BlackwellIRProgram * */, const OmegaGpuAttnLaunch *L, OmegaGpuAttnInfo *info); +void omega_gpu_attention_test_set_simulator(OmegaGpuAttnSim sim); + +/* 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 + * physical block id, and every sequence's compact table points at that one staged slot. + * On by default. `false` selects the legacy per-sequence staging (every sequence copies + * its own blocks), kept as the reference fallback and as the negative control of the + * staging-byte tests. Test hook; never cleared in production. */ +void omega_gpu_attention_test_set_dedupe(bool on); + +#ifdef __cplusplus +} +#endif +#endif /* OMEGA_GPU_ATTENTION_API_H */ diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/receipt.json b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/receipt.json new file mode 100644 index 000000000..d6d6a16a6 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/receipt.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_V1","tolerances":{"rel":2e-4,"abs":2e-5,"large_scores_rel":1e-3,"large_scores_abs":1e-4},"cases":[{"case":"gqa_f32_tinyllama_32q4kv_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":215825,"call_ns":134596651,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2048,"kv_bytes_naive":2048,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00189431,"pass":true,"chip_elapsed_ns":103424,"call_ns":221664,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":34816,"kv_bytes_naive":34816,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00189409,"pass":true,"chip_elapsed_ns":206192,"call_ns":357696,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0028582,"pass":true,"chip_elapsed_ns":1129857,"call_ns":1672210,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=OK,bad=2041) NO_RESCALE:CAUGHT(rc=OK,bad=1959) Q_ROW:CAUGHT(rc=OK,bad=2048) OUT_ROW:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_tinyllama_32q4kv_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00174821,"pass":true,"chip_elapsed_ns":103888,"call_ns":206944,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":133120,"kv_bytes_naive":133120,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00197914,"pass":true,"chip_elapsed_ns":103185,"call_ns":107697,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00177573,"pass":true,"chip_elapsed_ns":102688,"call_ns":106912,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":264192,"kv_bytes_naive":264192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00259576,"pass":true,"chip_elapsed_ns":306256,"call_ns":314512,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":614400,"kv_bytes_naive":614400,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_tinyllama_32q4kv_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00247545,"pass":true,"chip_elapsed_ns":611521,"call_ns":643921,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2048000,"kv_bytes_naive":2048000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":102961,"call_ns":193585,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096,"kv_bytes_naive":4096,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00174276,"pass":true,"chip_elapsed_ns":103040,"call_ns":105760,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":69632,"kv_bytes_naive":69632,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_llama32_1b_32q8kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00161378,"pass":true,"chip_elapsed_ns":205424,"call_ns":327344,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0029454,"pass":true,"chip_elapsed_ns":1105953,"call_ns":2214995,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1904) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042)"},{"case":"gqa_f32_llama32_1b_32q8kv_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.0014332,"pass":true,"chip_elapsed_ns":105088,"call_ns":237488,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":266240,"kv_bytes_naive":266240,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00186415,"pass":true,"chip_elapsed_ns":103857,"call_ns":111137,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00185519,"pass":true,"chip_elapsed_ns":103248,"call_ns":110576,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":528384,"kv_bytes_naive":528384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00162705,"pass":true,"chip_elapsed_ns":264897,"call_ns":283377,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1228800,"kv_bytes_naive":1228800,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_llama32_1b_32q8kv_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00330327,"pass":true,"chip_elapsed_ns":692416,"call_ns":781584,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096000,"kv_bytes_naive":4096000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_large_scores_32q4kv_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.105395,"pass":true,"chip_elapsed_ns":220192,"call_ns":428753,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"NO_MAX:CAUGHT(rc=OK,bad=2048)"},{"case":"gqa_f32_mha_16q16kv_ctx300","n":1024,"rc":"OK","violations":0,"worst_scaled_err":0.00197746,"pass":true,"chip_elapsed_ns":209296,"call_ns":368672,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2457600,"kv_bytes_naive":2457600,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":3,"mutants_caught":3,"mutant_note":"Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":112448,"call_ns":211456,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":16384,"kv_bytes_naive":16384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.002096,"pass":true,"chip_elapsed_ns":103680,"call_ns":195009,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00199949,"pass":true,"chip_elapsed_ns":205393,"call_ns":355905,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00336531,"pass":true,"chip_elapsed_ns":1089106,"call_ns":1137186,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042)"},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00182741,"pass":true,"chip_elapsed_ns":104865,"call_ns":225169,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":81920,"kv_bytes_naive":81920,"kv_blocks_unique":5,"kv_blocks_logical":5,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00191997,"pass":true,"chip_elapsed_ns":103216,"call_ns":106832,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":131072,"kv_bytes_naive":131072,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00192425,"pass":true,"chip_elapsed_ns":103072,"call_ns":106560,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":147456,"kv_bytes_naive":147456,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00243899,"pass":true,"chip_elapsed_ns":306592,"call_ns":312272,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":311296,"kv_bytes_naive":311296,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_tinyllama_32q4kv_bs16_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00547531,"pass":true,"chip_elapsed_ns":306448,"call_ns":310496,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":163840,"kv_bytes_naive":1032192,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx1","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":76352,"call_ns":188305,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx17","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00223287,"pass":true,"chip_elapsed_ns":104752,"call_ns":212768,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx256","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00167964,"pass":true,"chip_elapsed_ns":207344,"call_ns":329136,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx2048","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00358689,"pass":true,"chip_elapsed_ns":1123938,"call_ns":1217266,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044)"},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx65","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00228809,"pass":true,"chip_elapsed_ns":105008,"call_ns":227360,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":163840,"kv_bytes_naive":163840,"kv_blocks_unique":5,"kv_blocks_logical":5,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx128","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00160376,"pass":true,"chip_elapsed_ns":205249,"call_ns":210337,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx129","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00173996,"pass":true,"chip_elapsed_ns":206753,"call_ns":211953,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":294912,"kv_bytes_naive":294912,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00303696,"pass":true,"chip_elapsed_ns":307281,"call_ns":316113,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":622592,"kv_bytes_naive":622592,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_llama32_1b_32q8kv_bs16_ctx1000","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00420311,"pass":true,"chip_elapsed_ns":308241,"call_ns":314401,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":327680,"kv_bytes_naive":2064384,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_batch_3seq_32q8kv_ctx40_0_100","n":6144,"rc":"OK","violations":0,"worst_scaled_err":0.00181424,"pass":true,"chip_elapsed_ns":209680,"call_ns":484801,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":229376,"kv_bytes_naive":229376,"kv_blocks_unique":7,"kv_blocks_logical":7,"mutants_run":4,"mutants_caught":4,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_shared_prefix_4seq_8q2kv_10pre","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00188498,"pass":true,"chip_elapsed_ns":259921,"call_ns":349105,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":155648,"kv_bytes_naive":401408,"kv_blocks_unique":19,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2046)"},{"case":"paged_bf16_shared_prefix_4seq_32q8kv_10pre","n":8192,"rc":"OK","violations":0,"worst_scaled_err":0.0024233,"pass":true,"chip_elapsed_ns":411009,"call_ns":522897,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":950272,"kv_bytes_naive":1605632,"kv_blocks_unique":29,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181)"}],"mutant_count":6,"mutants":{"NO_MAX":{"run":1,"caught":1},"KV_HEAD":{"run":11,"caught":11},"SLOT":{"run":9,"caught":9},"NO_RESCALE":{"run":4,"caught":4},"Q_ROW":{"run":6,"caught":6},"OUT_ROW":{"run":6,"caught":6}},"device_opens":1,"checks":122,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_PASS"} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/run.log b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/run.log new file mode 100644 index 000000000..7c8bee9dd --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/run.log @@ -0,0 +1,49 @@ +PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=215825 call_ns=134596651 calls=1 unwritten=0 kv_staged=2048/2048 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00189431 chip_ns=103424 call_ns=221664 calls=1 unwritten=0 kv_staged=34816/34816 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00189409 chip_ns=206192 call_ns=357696 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.0028582 chip_ns=1129857 call_ns=1672210 calls=1 unwritten=0 kv_staged=4194304/4194304 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=2041) NO_RESCALE:CAUGHT(rc=OK,bad=1959) Q_ROW:CAUGHT(rc=OK,bad=2048) OUT_ROW:CAUGHT(rc=OK,bad=2048) +PASS gqa_f32_tinyllama_32q4kv_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00174821 chip_ns=103888 call_ns=206944 calls=1 unwritten=0 kv_staged=133120/133120 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00197914 chip_ns=103185 call_ns=107697 calls=1 unwritten=0 kv_staged=262144/262144 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00177573 chip_ns=102688 call_ns=106912 calls=1 unwritten=0 kv_staged=264192/264192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00259576 chip_ns=306256 call_ns=314512 calls=1 unwritten=0 kv_staged=614400/614400 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00247545 chip_ns=611521 call_ns=643921 calls=1 unwritten=0 kv_staged=2048000/2048000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=102961 call_ns=193585 calls=1 unwritten=0 kv_staged=4096/4096 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00174276 chip_ns=103040 call_ns=105760 calls=1 unwritten=0 kv_staged=69632/69632 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS gqa_f32_llama32_1b_32q8kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00161378 chip_ns=205424 call_ns=327344 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.0029454 chip_ns=1105953 call_ns=2214995 calls=1 unwritten=0 kv_staged=8388608/8388608 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1904) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS gqa_f32_llama32_1b_32q8kv_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.0014332 chip_ns=105088 call_ns=237488 calls=1 unwritten=0 kv_staged=266240/266240 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00186415 chip_ns=103857 call_ns=111137 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00185519 chip_ns=103248 call_ns=110576 calls=1 unwritten=0 kv_staged=528384/528384 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00162705 chip_ns=264897 call_ns=283377 calls=1 unwritten=0 kv_staged=1228800/1228800 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00330327 chip_ns=692416 call_ns=781584 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.105395 chip_ns=220192 call_ns=428753 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 1/1 NO_MAX:CAUGHT(rc=OK,bad=2048) +PASS gqa_f32_mha_16q16kv_ctx300 n=1024 rc=OK violations=0 worst_scaled_err=0.00197746 chip_ns=209296 call_ns=368672 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=112448 call_ns=211456 calls=1 unwritten=0 kv_staged=16384/16384 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.002096 chip_ns=103680 call_ns=195009 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00199949 chip_ns=205393 call_ns=355905 calls=1 unwritten=0 kv_staged=262144/262144 blocks=16/16 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.00336531 chip_ns=1089106 call_ns=1137186 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00182741 chip_ns=104865 call_ns=225169 calls=1 unwritten=0 kv_staged=81920/81920 blocks=5/5 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00191997 chip_ns=103216 call_ns=106832 calls=1 unwritten=0 kv_staged=131072/131072 blocks=8/8 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00192425 chip_ns=103072 call_ns=106560 calls=1 unwritten=0 kv_staged=147456/147456 blocks=9/9 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00243899 chip_ns=306592 call_ns=312272 calls=1 unwritten=0 kv_staged=311296/311296 blocks=19/19 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00547531 chip_ns=306448 call_ns=310496 calls=1 unwritten=0 kv_staged=163840/1032192 blocks=10/63 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=76352 call_ns=188305 calls=1 unwritten=0 kv_staged=32768/32768 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00223287 chip_ns=104752 call_ns=212768 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00167964 chip_ns=207344 call_ns=329136 calls=1 unwritten=0 kv_staged=524288/524288 blocks=16/16 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.00358689 chip_ns=1123938 call_ns=1217266 calls=1 unwritten=0 kv_staged=4194304/4194304 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00228809 chip_ns=105008 call_ns=227360 calls=1 unwritten=0 kv_staged=163840/163840 blocks=5/5 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00160376 chip_ns=205249 call_ns=210337 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00173996 chip_ns=206753 call_ns=211953 calls=1 unwritten=0 kv_staged=294912/294912 blocks=9/9 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00303696 chip_ns=307281 call_ns=316113 calls=1 unwritten=0 kv_staged=622592/622592 blocks=19/19 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00420311 chip_ns=308241 call_ns=314401 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00181424 chip_ns=209680 call_ns=484801 calls=2 unwritten=0 kv_staged=229376/229376 blocks=7/7 | mutants 4/4 KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00188498 chip_ns=259921 call_ns=349105 calls=1 unwritten=0 kv_staged=155648/401408 blocks=19/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2046) +PASS paged_bf16_shared_prefix_4seq_32q8kv_10pre n=8192 rc=OK violations=0 worst_scaled_err=0.0024233 chip_ns=411009 call_ns=522897 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=1 +PASS: 122 checks, 0 failed diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sim.log b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sim.log new file mode 100644 index 000000000..eeed25992 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sim.log @@ -0,0 +1,49 @@ +PASS gqa_f32_tinyllama_32q4kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=3346116 calls=1 unwritten=0 kv_staged=2048/2048 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00189313 chip_ns=0 call_ns=4484597 calls=1 unwritten=0 kv_staged=34816/34816 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00183169 chip_ns=0 call_ns=31014454 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.00274869 chip_ns=0 call_ns=243359030 calls=1 unwritten=0 kv_staged=4194304/4194304 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=2041) NO_RESCALE:CAUGHT(rc=OK,bad=1959) Q_ROW:CAUGHT(rc=OK,bad=2048) OUT_ROW:CAUGHT(rc=OK,bad=2048) +PASS gqa_f32_tinyllama_32q4kv_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00145684 chip_ns=0 call_ns=10850509 calls=1 unwritten=0 kv_staged=133120/133120 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00206007 chip_ns=0 call_ns=15397827 calls=1 unwritten=0 kv_staged=262144/262144 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00165735 chip_ns=0 call_ns=18355334 calls=1 unwritten=0 kv_staged=264192/264192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00201893 chip_ns=0 call_ns=36615629 calls=1 unwritten=0 kv_staged=614400/614400 blocks=1/1 | mutants 0/0 +PASS gqa_f32_tinyllama_32q4kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00297055 chip_ns=0 call_ns=119441362 calls=1 unwritten=0 kv_staged=2048000/2048000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=3312948 calls=1 unwritten=0 kv_staged=4096/4096 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00187227 chip_ns=0 call_ns=4446565 calls=1 unwritten=0 kv_staged=69632/69632 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS gqa_f32_llama32_1b_32q8kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00201723 chip_ns=0 call_ns=30540070 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.0029454 chip_ns=0 call_ns=244296617 calls=1 unwritten=0 kv_staged=8388608/8388608 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1904) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS gqa_f32_llama32_1b_32q8kv_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00195964 chip_ns=0 call_ns=10893309 calls=1 unwritten=0 kv_staged=266240/266240 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00170583 chip_ns=0 call_ns=15497635 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.0017034 chip_ns=0 call_ns=18396855 calls=1 unwritten=0 kv_staged=528384/528384 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00187268 chip_ns=0 call_ns=36828237 calls=1 unwritten=0 kv_staged=1228800/1228800 blocks=1/1 | mutants 0/0 +PASS gqa_f32_llama32_1b_32q8kv_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00303901 chip_ns=0 call_ns=120209380 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.105626 chip_ns=0 call_ns=30555398 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 1/1 NO_MAX:CAUGHT(rc=OK,bad=2048) +PASS gqa_f32_mha_16q16kv_ctx300 n=1024 rc=OK violations=0 worst_scaled_err=0.00197746 chip_ns=0 call_ns=18386103 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=1022) OUT_ROW:CAUGHT(rc=OK,bad=1024) KV_HEAD:CAUGHT(rc=OK,bad=1024) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=3199172 calls=1 unwritten=0 kv_staged=16384/16384 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.0020981 chip_ns=0 call_ns=4440421 calls=1 unwritten=0 kv_staged=32768/32768 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2046) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.00182155 chip_ns=0 call_ns=31324263 calls=1 unwritten=0 kv_staged=262144/262144 blocks=16/16 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.00365795 chip_ns=0 call_ns=248096834 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2045) SLOT:CAUGHT(rc=OK,bad=2042) NO_RESCALE:CAUGHT(rc=OK,bad=2023) Q_ROW:CAUGHT(rc=OK,bad=2042) OUT_ROW:CAUGHT(rc=OK,bad=2042) +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00173051 chip_ns=0 call_ns=10955806 calls=1 unwritten=0 kv_staged=81920/81920 blocks=5/5 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00189837 chip_ns=0 call_ns=15802228 calls=1 unwritten=0 kv_staged=131072/131072 blocks=8/8 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00172729 chip_ns=0 call_ns=18650040 calls=1 unwritten=0 kv_staged=147456/147456 blocks=9/9 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00210268 chip_ns=0 call_ns=37454079 calls=1 unwritten=0 kv_staged=311296/311296 blocks=19/19 | mutants 0/0 +PASS paged_bf16_tinyllama_32q4kv_bs16_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00547531 chip_ns=0 call_ns=123086665 calls=1 unwritten=0 kv_staged=163840/1032192 blocks=10/63 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx1 n=2048 rc=OK violations=0 worst_scaled_err=0 chip_ns=0 call_ns=3184852 calls=1 unwritten=0 kv_staged=32768/32768 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx17 n=2048 rc=OK violations=0 worst_scaled_err=0.00215313 chip_ns=0 call_ns=4448118 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx256 n=2048 rc=OK violations=0 worst_scaled_err=0.0021938 chip_ns=0 call_ns=31315751 calls=1 unwritten=0 kv_staged=524288/524288 blocks=16/16 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx2048 n=2048 rc=OK violations=0 worst_scaled_err=0.00358689 chip_ns=0 call_ns=248534711 calls=1 unwritten=0 kv_staged=4194304/4194304 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2045) NO_RESCALE:CAUGHT(rc=OK,bad=1999) Q_ROW:CAUGHT(rc=OK,bad=2044) OUT_ROW:CAUGHT(rc=OK,bad=2044) +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx65 n=2048 rc=OK violations=0 worst_scaled_err=0.00163443 chip_ns=0 call_ns=10955421 calls=1 unwritten=0 kv_staged=163840/163840 blocks=5/5 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx128 n=2048 rc=OK violations=0 worst_scaled_err=0.00186221 chip_ns=0 call_ns=15807732 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx129 n=2048 rc=OK violations=0 worst_scaled_err=0.00163299 chip_ns=0 call_ns=18647111 calls=1 unwritten=0 kv_staged=294912/294912 blocks=9/9 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00264235 chip_ns=0 call_ns=37520063 calls=1 unwritten=0 kv_staged=622592/622592 blocks=19/19 | mutants 0/0 +PASS paged_bf16_llama32_1b_32q8kv_bs16_ctx1000 n=2048 rc=OK violations=0 worst_scaled_err=0.00399855 chip_ns=0 call_ns=122271610 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=6144 rc=OK violations=0 worst_scaled_err=0.00179162 chip_ns=0 call_ns=14546931 calls=2 unwritten=0 kv_staged=229376/229376 blocks=7/7 | mutants 4/4 KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4090) Q_ROW:CAUGHT(rc=OK,bad=4096) OUT_ROW:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=2048 rc=OK violations=0 worst_scaled_err=0.00208743 chip_ns=0 call_ns=24435326 calls=1 unwritten=0 kv_staged=155648/401408 blocks=19/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=2048) SLOT:CAUGHT(rc=OK,bad=2046) +PASS paged_bf16_shared_prefix_4seq_32q8kv_10pre n=8192 rc=OK violations=0 worst_scaled_err=0.0024233 chip_ns=0 call_ns=97864316 calls=2 unwritten=0 kv_staged=950272/1605632 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=8192) SLOT:CAUGHT(rc=OK,bad=8181) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=0 +PASS: 122 checks, 0 failed diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/status.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/status.txt new file mode 100644 index 000000000..0296b5f9c --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/status.txt @@ -0,0 +1 @@ +hd64 regression rc=0 diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.json b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.json new file mode 100644 index 000000000..34c57d1aa --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_SWEEP_V1","path":"paged_bf16","head_dim":64,"block_size":16,"timed_calls":20,"host_simulator":false,"tolerances":{"rel":2e-4,"abs":2e-5},"hardware_counters":"unavailable (SM occupancy, bandwidth utilisation, cache hit rates are not observable through this path)","points":[{"q_heads":1,"kv_heads":1,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":64,"out_width":64,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00162825,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":1,"threads_per_cta":64,"call_ms_median":0.1038,"call_ms_p90":0.1047,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":256,"tab_bytes":68,"out_bytes":256,"kv_source":"staged"},{"q_heads":1,"kv_heads":1,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":64,"out_width":64,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00286577,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":1,"threads_per_cta":64,"call_ms_median":0.4098,"call_ms_p90":0.4104,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4089,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":256,"tab_bytes":516,"out_bytes":256,"kv_source":"staged"},{"q_heads":2,"kv_heads":1,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00274735,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.1037,"call_ms_p90":0.1041,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1035,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":512,"tab_bytes":68,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":1,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00293219,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.4096,"call_ms_p90":0.4109,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4092,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":512,"tab_bytes":516,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":2,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00285429,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.1039,"call_ms_p90":0.1047,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1039,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":512,"tab_bytes":68,"out_bytes":512,"kv_source":"staged"},{"q_heads":2,"kv_heads":2,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":128,"out_width":128,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00344759,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":2,"threads_per_cta":64,"call_ms_median":0.4106,"call_ms_p90":0.4124,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4100,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":512,"tab_bytes":516,"out_bytes":512,"kv_source":"staged"},{"q_heads":4,"kv_heads":1,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00195521,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1038,"call_ms_p90":0.1040,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":1,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00455218,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4099,"call_ms_p90":0.4109,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":2,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00195668,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1040,"call_ms_p90":0.1040,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":2,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00429287,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4103,"call_ms_p90":0.5117,"kernel_ms_median":0.4080,"kernel_ms_p90":0.5093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":4,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00208557,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.1041,"call_ms_p90":0.1046,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1037,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":1024,"tab_bytes":68,"out_bytes":1024,"kv_source":"staged"},{"q_heads":4,"kv_heads":4,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":256,"out_width":256,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00447204,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":4,"threads_per_cta":64,"call_ms_median":0.4120,"call_ms_p90":0.4128,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4087,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":1024,"tab_bytes":516,"out_bytes":1024,"kv_source":"staged"},{"q_heads":8,"kv_heads":1,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00244755,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1037,"call_ms_p90":0.1038,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1028,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":1,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00561397,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4100,"call_ms_p90":0.5105,"kernel_ms_median":0.4081,"kernel_ms_p90":0.5088,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":2,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00277137,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1042,"call_ms_p90":0.1044,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":2,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00478059,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4108,"call_ms_p90":0.4124,"kernel_ms_median":0.4083,"kernel_ms_p90":0.4096,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":4,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00220051,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1043,"call_ms_p90":0.1045,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":4,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0051977,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4122,"call_ms_p90":0.4136,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4095,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":8,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00240979,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.1048,"call_ms_p90":0.1051,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":2048,"tab_bytes":68,"out_bytes":2048,"kv_source":"staged"},{"q_heads":8,"kv_heads":8,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":512,"out_width":512,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00466806,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":8,"threads_per_cta":64,"call_ms_median":0.4152,"call_ms_p90":0.4161,"kernel_ms_median":0.4080,"kernel_ms_p90":0.4084,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":2048,"tab_bytes":516,"out_bytes":2048,"kv_source":"staged"},{"q_heads":16,"kv_heads":1,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00249826,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1042,"call_ms_p90":0.1045,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1030,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":1,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00536905,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4105,"call_ms_p90":0.4116,"kernel_ms_median":0.4084,"kernel_ms_p90":0.4093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":2,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00239844,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1046,"call_ms_p90":0.1051,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":2,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00570392,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4113,"call_ms_p90":0.4123,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4093,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":4,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00278498,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1048,"call_ms_p90":0.1057,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1040,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":4,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00518169,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4128,"call_ms_p90":0.4133,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4090,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":8,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00262688,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1054,"call_ms_p90":0.1058,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1035,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":8,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0059316,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4171,"call_ms_p90":0.4190,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4102,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":16,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00239914,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.1061,"call_ms_p90":0.1063,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":4096,"tab_bytes":68,"out_bytes":4096,"kv_source":"staged"},{"q_heads":16,"kv_heads":16,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":1024,"out_width":1024,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00553838,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":16,"threads_per_cta":64,"call_ms_median":0.4256,"call_ms_p90":0.4288,"kernel_ms_median":0.4078,"kernel_ms_p90":0.4099,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":4096,"tab_bytes":516,"out_bytes":4096,"kv_source":"staged"},{"q_heads":24,"kv_heads":1,"gqa_ratio":24,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":1,"gqa_ratio":24,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":2,"gqa_ratio":12,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":2,"gqa_ratio":12,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":3,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00306755,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1048,"call_ms_p90":0.1051,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1029,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":36864,"kv_bytes_naive":196608,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":3,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00539717,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6161,"call_ms_p90":0.6174,"kernel_ms_median":0.6119,"kernel_ms_p90":0.6134,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":233472,"kv_bytes_naive":1572864,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":4,"gqa_ratio":6,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":4,"gqa_ratio":6,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":6,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00326846,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1055,"call_ms_p90":0.1059,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1036,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":73728,"kv_bytes_naive":393216,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":6,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00527248,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6182,"call_ms_p90":0.7202,"kernel_ms_median":0.6112,"kernel_ms_p90":0.7130,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":466944,"kv_bytes_naive":3145728,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":8,"gqa_ratio":3,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":8,"gqa_ratio":3,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"unsupported_by_kernel_envelope","rc":"BAD_ARGS","pass":true},{"q_heads":24,"kv_heads":12,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00338069,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1062,"call_ms_p90":0.1064,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":147456,"kv_bytes_naive":786432,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":12,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00538782,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.6255,"call_ms_p90":0.6279,"kernel_ms_median":0.6118,"kernel_ms_p90":0.6136,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":933888,"kv_bytes_naive":6291456,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":24,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00259323,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.1077,"call_ms_p90":0.1079,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":294912,"kv_bytes_naive":1572864,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":6144,"tab_bytes":68,"out_bytes":6144,"kv_source":"staged"},{"q_heads":24,"kv_heads":24,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":1536,"out_width":1536,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00737519,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":24,"threads_per_cta":64,"call_ms_median":0.5400,"call_ms_p90":0.5483,"kernel_ms_median":0.5107,"kernel_ms_p90":0.5150,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1867776,"kv_bytes_naive":12582912,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":6144,"tab_bytes":516,"out_bytes":6144,"kv_source":"staged"},{"q_heads":32,"kv_heads":1,"gqa_ratio":32,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00241453,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1050,"call_ms_p90":0.1052,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1030,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":1,"gqa_ratio":32,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00525453,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4109,"call_ms_p90":0.4120,"kernel_ms_median":0.4079,"kernel_ms_p90":0.4090,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":2,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0031327,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1054,"call_ms_p90":0.1056,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":2,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00648224,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4118,"call_ms_p90":0.4127,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4089,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":4,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00316999,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1055,"call_ms_p90":0.1058,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":4,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00599161,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4134,"call_ms_p90":0.4148,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4095,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":8,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00278167,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1060,"call_ms_p90":0.1063,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":8,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.005897,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4177,"call_ms_p90":0.4186,"kernel_ms_median":0.4082,"kernel_ms_p90":0.4091,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":16,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00268895,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1069,"call_ms_p90":0.1076,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1038,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":16,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00571167,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4288,"call_ms_p90":0.4312,"kernel_ms_median":0.4086,"kernel_ms_p90":0.4104,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":32,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00256581,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.1092,"call_ms_p90":0.1098,"kernel_ms_median":0.1031,"kernel_ms_p90":0.1033,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":393216,"kv_bytes_naive":2097152,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":8192,"tab_bytes":68,"out_bytes":8192,"kv_source":"staged"},{"q_heads":32,"kv_heads":32,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":2048,"out_width":2048,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00647965,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":32,"threads_per_cta":64,"call_ms_median":0.4526,"call_ms_p90":0.4559,"kernel_ms_median":0.4109,"kernel_ms_p90":0.4121,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":2490368,"kv_bytes_naive":16777216,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":8192,"tab_bytes":516,"out_bytes":8192,"kv_source":"staged"},{"q_heads":64,"kv_heads":1,"gqa_ratio":64,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00332208,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1064,"call_ms_p90":0.1072,"kernel_ms_median":0.1028,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":false,"kv_bytes_staged":12288,"kv_bytes_naive":65536,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":1,"gqa_ratio":64,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00559141,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.4128,"call_ms_p90":0.4139,"kernel_ms_median":0.4081,"kernel_ms_p90":0.4087,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":77824,"kv_bytes_naive":524288,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":2,"gqa_ratio":32,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00286709,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1071,"call_ms_p90":0.1074,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1034,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":24576,"kv_bytes_naive":131072,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":2,"gqa_ratio":32,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00639622,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.1240,"call_ms_p90":1.1260,"kernel_ms_median":1.1187,"kernel_ms_p90":1.1206,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":155648,"kv_bytes_naive":1048576,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":4,"gqa_ratio":16,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00399345,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1075,"call_ms_p90":0.1206,"kernel_ms_median":0.1033,"kernel_ms_p90":0.1157,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":49152,"kv_bytes_naive":262144,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":4,"gqa_ratio":16,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00618912,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.1252,"call_ms_p90":1.1262,"kernel_ms_median":1.1182,"kernel_ms_p90":1.1192,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":311296,"kv_bytes_naive":2097152,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":8,"gqa_ratio":8,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.0028507,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1074,"call_ms_p90":0.1078,"kernel_ms_median":0.1030,"kernel_ms_p90":0.1032,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":98304,"kv_bytes_naive":524288,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":8,"gqa_ratio":8,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00529008,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.1312,"call_ms_p90":1.1336,"kernel_ms_median":1.1207,"kernel_ms_p90":1.1231,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":622592,"kv_bytes_naive":4194304,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":16,"gqa_ratio":4,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00272721,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1087,"call_ms_p90":0.1092,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1035,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":196608,"kv_bytes_naive":1048576,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":16,"gqa_ratio":4,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00565958,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0406,"call_ms_p90":1.0429,"kernel_ms_median":1.0189,"kernel_ms_p90":1.0205,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":1245184,"kv_bytes_naive":8388608,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":32,"gqa_ratio":2,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00282842,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1108,"call_ms_p90":0.1117,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1043,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":393216,"kv_bytes_naive":2097152,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":32,"gqa_ratio":2,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00670759,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.0668,"call_ms_p90":1.0742,"kernel_ms_median":1.0193,"kernel_ms_p90":1.0219,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":2490368,"kv_bytes_naive":16777216,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":64,"gqa_ratio":1,"head_dim":64,"context":256,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00284045,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":0.1165,"call_ms_p90":0.1174,"kernel_ms_median":0.1032,"kernel_ms_p90":0.1039,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":786432,"kv_bytes_naive":4194304,"kv_blocks_logical":16,"kv_blocks_unique":3,"q_bytes":16384,"tab_bytes":68,"out_bytes":16384,"kv_source":"staged"},{"q_heads":64,"kv_heads":64,"gqa_ratio":1,"head_dim":64,"context":2048,"q_width":4096,"out_width":4096,"class":"supported","rc":"OK","pass":true,"violations":0,"worst_scaled_err":0.00870193,"unwritten_words":0,"launches_per_call":1,"ctas_last_launch":64,"threads_per_cta":64,"call_ms_median":1.1197,"call_ms_p90":1.1290,"kernel_ms_median":1.0191,"kernel_ms_p90":1.0223,"kernel_cache_hits":20,"first_call_cache_hit":true,"kv_bytes_staged":4980736,"kv_bytes_naive":33554432,"kv_blocks_logical":128,"kv_blocks_unique":19,"q_bytes":16384,"tab_bytes":516,"out_bytes":16384,"kv_source":"staged"}],"points_total":72,"points_supported":64,"points_unsupported":8,"device_opens":1,"checks":73,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_SWEEP_PASS"} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.log b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.log new file mode 100644 index 000000000..d4f9c88a1 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/sweep.log @@ -0,0 +1,74 @@ +PASS sweep 1q/ 1kv ratio 1 ctx 256: launches=1 ctas=1 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=256 tab=68 out=256 worst=0.00162825 +PASS sweep 1q/ 1kv ratio 1 ctx 2048: launches=1 ctas=1 call_ms med=0.410 p90=0.410 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=256 tab=516 out=256 worst=0.00286577 +PASS sweep 2q/ 1kv ratio 2 ctx 256: launches=1 ctas=2 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.104 kv_staged=12288 (naive 65536) blocks=3/16 q=512 tab=68 out=512 worst=0.00274735 +PASS sweep 2q/ 1kv ratio 2 ctx 2048: launches=1 ctas=2 call_ms med=0.410 p90=0.411 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=512 tab=516 out=512 worst=0.00293219 +PASS sweep 2q/ 2kv ratio 1 ctx 256: launches=1 ctas=2 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.104 kv_staged=24576 (naive 131072) blocks=3/16 q=512 tab=68 out=512 worst=0.00285429 +PASS sweep 2q/ 2kv ratio 1 ctx 2048: launches=1 ctas=2 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.410 kv_staged=155648 (naive 1048576) blocks=19/128 q=512 tab=516 out=512 worst=0.00344759 +PASS sweep 4q/ 1kv ratio 4 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00195521 +PASS sweep 4q/ 1kv ratio 4 ctx 2048: launches=1 ctas=4 call_ms med=0.410 p90=0.411 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00455218 +PASS sweep 4q/ 2kv ratio 2 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00195668 +PASS sweep 4q/ 2kv ratio 2 ctx 2048: launches=1 ctas=4 call_ms med=0.410 p90=0.512 kernel_ms med=0.408 p90=0.509 kv_staged=155648 (naive 1048576) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00429287 +PASS sweep 4q/ 4kv ratio 1 ctx 256: launches=1 ctas=4 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.104 kv_staged=49152 (naive 262144) blocks=3/16 q=1024 tab=68 out=1024 worst=0.00208557 +PASS sweep 4q/ 4kv ratio 1 ctx 2048: launches=1 ctas=4 call_ms med=0.412 p90=0.413 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=1024 tab=516 out=1024 worst=0.00447204 +PASS sweep 8q/ 1kv ratio 8 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00244755 +PASS sweep 8q/ 1kv ratio 8 ctx 2048: launches=1 ctas=8 call_ms med=0.410 p90=0.511 kernel_ms med=0.408 p90=0.509 kv_staged=77824 (naive 524288) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00561397 +PASS sweep 8q/ 2kv ratio 4 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00277137 +PASS sweep 8q/ 2kv ratio 4 ctx 2048: launches=1 ctas=8 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.410 kv_staged=155648 (naive 1048576) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00478059 +PASS sweep 8q/ 4kv ratio 2 ctx 256: launches=1 ctas=8 call_ms med=0.104 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00220051 +PASS sweep 8q/ 4kv ratio 2 ctx 2048: launches=1 ctas=8 call_ms med=0.412 p90=0.414 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=2048 tab=516 out=2048 worst=0.0051977 +PASS sweep 8q/ 8kv ratio 1 ctx 256: launches=1 ctas=8 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=2048 tab=68 out=2048 worst=0.00240979 +PASS sweep 8q/ 8kv ratio 1 ctx 2048: launches=1 ctas=8 call_ms med=0.415 p90=0.416 kernel_ms med=0.408 p90=0.408 kv_staged=622592 (naive 4194304) blocks=19/128 q=2048 tab=516 out=2048 worst=0.00466806 +PASS sweep 16q/ 1kv ratio 16 ctx 256: launches=1 ctas=16 call_ms med=0.104 p90=0.104 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00249826 +PASS sweep 16q/ 1kv ratio 16 ctx 2048: launches=1 ctas=16 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00536905 +PASS sweep 16q/ 2kv ratio 8 ctx 256: launches=1 ctas=16 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00239844 +PASS sweep 16q/ 2kv ratio 8 ctx 2048: launches=1 ctas=16 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00570392 +PASS sweep 16q/ 4kv ratio 4 ctx 256: launches=1 ctas=16 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.104 kv_staged=49152 (naive 262144) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00278498 +PASS sweep 16q/ 4kv ratio 4 ctx 2048: launches=1 ctas=16 call_ms med=0.413 p90=0.413 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00518169 +PASS sweep 16q/ 8kv ratio 2 ctx 256: launches=1 ctas=16 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00262688 +PASS sweep 16q/ 8kv ratio 2 ctx 2048: launches=1 ctas=16 call_ms med=0.417 p90=0.419 kernel_ms med=0.408 p90=0.410 kv_staged=622592 (naive 4194304) blocks=19/128 q=4096 tab=516 out=4096 worst=0.0059316 +PASS sweep 16q/16kv ratio 1 ctx 256: launches=1 ctas=16 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=196608 (naive 1048576) blocks=3/16 q=4096 tab=68 out=4096 worst=0.00239914 +PASS sweep 16q/16kv ratio 1 ctx 2048: launches=1 ctas=16 call_ms med=0.426 p90=0.429 kernel_ms med=0.408 p90=0.410 kv_staged=1245184 (naive 8388608) blocks=19/128 q=4096 tab=516 out=4096 worst=0.00553838 +PASS sweep 24q/ 1kv ratio 24 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 1kv ratio 24 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 2kv ratio 12 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 2kv ratio 12 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 3kv ratio 8 ctx 256: launches=1 ctas=24 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=36864 (naive 196608) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00306755 +PASS sweep 24q/ 3kv ratio 8 ctx 2048: launches=1 ctas=24 call_ms med=0.616 p90=0.617 kernel_ms med=0.612 p90=0.613 kv_staged=233472 (naive 1572864) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00539717 +PASS sweep 24q/ 4kv ratio 6 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 4kv ratio 6 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 6kv ratio 4 ctx 256: launches=1 ctas=24 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.104 kv_staged=73728 (naive 393216) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00326846 +PASS sweep 24q/ 6kv ratio 4 ctx 2048: launches=1 ctas=24 call_ms med=0.618 p90=0.720 kernel_ms med=0.611 p90=0.713 kv_staged=466944 (naive 3145728) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00527248 +PASS sweep 24q/ 8kv ratio 3 ctx 256: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/ 8kv ratio 3 ctx 2048: unsupported_by_kernel_envelope (rc=BAD_ARGS) +PASS sweep 24q/12kv ratio 2 ctx 256: launches=1 ctas=24 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=147456 (naive 786432) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00338069 +PASS sweep 24q/12kv ratio 2 ctx 2048: launches=1 ctas=24 call_ms med=0.626 p90=0.628 kernel_ms med=0.612 p90=0.614 kv_staged=933888 (naive 6291456) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00538782 +PASS sweep 24q/24kv ratio 1 ctx 256: launches=1 ctas=24 call_ms med=0.108 p90=0.108 kernel_ms med=0.103 p90=0.103 kv_staged=294912 (naive 1572864) blocks=3/16 q=6144 tab=68 out=6144 worst=0.00259323 +PASS sweep 24q/24kv ratio 1 ctx 2048: launches=1 ctas=24 call_ms med=0.540 p90=0.548 kernel_ms med=0.511 p90=0.515 kv_staged=1867776 (naive 12582912) blocks=19/128 q=6144 tab=516 out=6144 worst=0.00737519 +PASS sweep 32q/ 1kv ratio 32 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.105 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00241453 +PASS sweep 32q/ 1kv ratio 32 ctx 2048: launches=1 ctas=32 call_ms med=0.411 p90=0.412 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00525453 +PASS sweep 32q/ 2kv ratio 16 ctx 256: launches=1 ctas=32 call_ms med=0.105 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=8192 tab=68 out=8192 worst=0.0031327 +PASS sweep 32q/ 2kv ratio 16 ctx 2048: launches=1 ctas=32 call_ms med=0.412 p90=0.413 kernel_ms med=0.408 p90=0.409 kv_staged=155648 (naive 1048576) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00648224 +PASS sweep 32q/ 4kv ratio 8 ctx 256: launches=1 ctas=32 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=49152 (naive 262144) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00316999 +PASS sweep 32q/ 4kv ratio 8 ctx 2048: launches=1 ctas=32 call_ms med=0.413 p90=0.415 kernel_ms med=0.408 p90=0.409 kv_staged=311296 (naive 2097152) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00599161 +PASS sweep 32q/ 8kv ratio 4 ctx 256: launches=1 ctas=32 call_ms med=0.106 p90=0.106 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00278167 +PASS sweep 32q/ 8kv ratio 4 ctx 2048: launches=1 ctas=32 call_ms med=0.418 p90=0.419 kernel_ms med=0.408 p90=0.409 kv_staged=622592 (naive 4194304) blocks=19/128 q=8192 tab=516 out=8192 worst=0.005897 +PASS sweep 32q/16kv ratio 2 ctx 256: launches=1 ctas=32 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.104 kv_staged=196608 (naive 1048576) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00268895 +PASS sweep 32q/16kv ratio 2 ctx 2048: launches=1 ctas=32 call_ms med=0.429 p90=0.431 kernel_ms med=0.409 p90=0.410 kv_staged=1245184 (naive 8388608) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00571167 +PASS sweep 32q/32kv ratio 1 ctx 256: launches=1 ctas=32 call_ms med=0.109 p90=0.110 kernel_ms med=0.103 p90=0.103 kv_staged=393216 (naive 2097152) blocks=3/16 q=8192 tab=68 out=8192 worst=0.00256581 +PASS sweep 32q/32kv ratio 1 ctx 2048: launches=1 ctas=32 call_ms med=0.453 p90=0.456 kernel_ms med=0.411 p90=0.412 kv_staged=2490368 (naive 16777216) blocks=19/128 q=8192 tab=516 out=8192 worst=0.00647965 +PASS sweep 64q/ 1kv ratio 64 ctx 256: launches=1 ctas=64 call_ms med=0.106 p90=0.107 kernel_ms med=0.103 p90=0.103 kv_staged=12288 (naive 65536) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00332208 +PASS sweep 64q/ 1kv ratio 64 ctx 2048: launches=1 ctas=64 call_ms med=0.413 p90=0.414 kernel_ms med=0.408 p90=0.409 kv_staged=77824 (naive 524288) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00559141 +PASS sweep 64q/ 2kv ratio 32 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.107 kernel_ms med=0.103 p90=0.103 kv_staged=24576 (naive 131072) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00286709 +PASS sweep 64q/ 2kv ratio 32 ctx 2048: launches=1 ctas=64 call_ms med=1.124 p90=1.126 kernel_ms med=1.119 p90=1.121 kv_staged=155648 (naive 1048576) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00639622 +PASS sweep 64q/ 4kv ratio 16 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.121 kernel_ms med=0.103 p90=0.116 kv_staged=49152 (naive 262144) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00399345 +PASS sweep 64q/ 4kv ratio 16 ctx 2048: launches=1 ctas=64 call_ms med=1.125 p90=1.126 kernel_ms med=1.118 p90=1.119 kv_staged=311296 (naive 2097152) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00618912 +PASS sweep 64q/ 8kv ratio 8 ctx 256: launches=1 ctas=64 call_ms med=0.107 p90=0.108 kernel_ms med=0.103 p90=0.103 kv_staged=98304 (naive 524288) blocks=3/16 q=16384 tab=68 out=16384 worst=0.0028507 +PASS sweep 64q/ 8kv ratio 8 ctx 2048: launches=1 ctas=64 call_ms med=1.131 p90=1.134 kernel_ms med=1.121 p90=1.123 kv_staged=622592 (naive 4194304) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00529008 +PASS sweep 64q/16kv ratio 4 ctx 256: launches=1 ctas=64 call_ms med=0.109 p90=0.109 kernel_ms med=0.103 p90=0.104 kv_staged=196608 (naive 1048576) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00272721 +PASS sweep 64q/16kv ratio 4 ctx 2048: launches=1 ctas=64 call_ms med=1.041 p90=1.043 kernel_ms med=1.019 p90=1.020 kv_staged=1245184 (naive 8388608) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00565958 +PASS sweep 64q/32kv ratio 2 ctx 256: launches=1 ctas=64 call_ms med=0.111 p90=0.112 kernel_ms med=0.103 p90=0.104 kv_staged=393216 (naive 2097152) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00282842 +PASS sweep 64q/32kv ratio 2 ctx 2048: launches=1 ctas=64 call_ms med=1.067 p90=1.074 kernel_ms med=1.019 p90=1.022 kv_staged=2490368 (naive 16777216) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00670759 +PASS sweep 64q/64kv ratio 1 ctx 256: launches=1 ctas=64 call_ms med=0.116 p90=0.117 kernel_ms med=0.103 p90=0.104 kv_staged=786432 (naive 4194304) blocks=3/16 q=16384 tab=68 out=16384 worst=0.00284045 +PASS sweep 64q/64kv ratio 1 ctx 2048: launches=1 ctas=64 call_ms med=1.120 p90=1.129 kernel_ms med=1.019 p90=1.022 kv_staged=4980736 (naive 33554432) blocks=19/128 q=16384 tab=516 out=16384 worst=0.00870193 +sweep: 72 points (64 supported, 8 unsupported by the kernel envelope), device_opens=1 +PASS: 73 checks, 0 failed diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.json b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.json new file mode 100644 index 000000000..3e5ced1e3 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_TIMING_V1","gate_median_ms":3.0,"calls":100,"cases":[{"case":"gqa_f32_tinyllama_32q4kv_ctx2048","first_call_ms":125.048,"ok_calls":100,"violations":0,"worst_scaled_err":0.00323017,"median_ms":1.2043,"p90_ms":1.2445,"min_ms":1.1218,"max_ms":1.9153,"chip_us_mean":1131.7,"device_opens":1,"pass":true}],"checks":2,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_TIMING_PASS"} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.log b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.log new file mode 100644 index 000000000..c8bd7c9b0 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/hd64-regression/timing.log @@ -0,0 +1,2 @@ +PASS timing gqa_f32_tinyllama_32q4kv_ctx2048 first_call_ms=125.048 ok_calls=100/100 violations=0 worst_scaled_err=0.00323017 median_ms=1.204 p90_ms=1.245 min_ms=1.122 max_ms=1.915 chip_us_mean=1131.7 device_opens=1 +PASS: 2 checks, 0 failed diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/1-red-baseline.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/1-red-baseline.log new file mode 100644 index 000000000..dd51b3583 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/1-red-baseline.log @@ -0,0 +1,69 @@ +VARIANT baseline kernel_bytes=2688 +SNAP site=before_ctx1 utc=2026-10-07T02:44:26Z allocations=0 (device not open yet) +RESULT variant=baseline ctx=1 rc=0 utc_after=2026-10-07T02:44:26Z call_ns=135681551 chip_ns=219553 unwritten=0 max_abs_err=0 +SNAP site=after_ctx1 utc=2026-10-07T02:44:26Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x1000 end=0x1004134000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x1000 slack_in_alloc=1408 page_after_alloc=0x1004134000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004134000 size=0x2000 end=0x1004136000 uncached live + ALLOC #7 va=0x1004136000 size=0x4000 end=0x100413a000 uncached live + ALLOC #8 va=0x100413a000 size=0x1000 end=0x100413b000 uncached live + ALLOC #9 va=0x100413b000 size=0x4000 end=0x100413f000 uncached live +SNAP site=before_ctx17 utc=2026-10-07T02:44:26Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x1000 end=0x1004134000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x1000 slack_in_alloc=1408 page_after_alloc=0x1004134000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004134000 size=0x2000 end=0x1004136000 uncached live + ALLOC #7 va=0x1004136000 size=0x4000 end=0x100413a000 uncached live + ALLOC #8 va=0x100413a000 size=0x1000 end=0x100413b000 uncached live + ALLOC #9 va=0x100413b000 size=0x4000 end=0x100413f000 uncached live +RESULT variant=baseline ctx=17 rc=0 utc_after=2026-10-07T02:44:26Z call_ns=238786 chip_ns=104241 unwritten=0 max_abs_err=1.58e-07 +SNAP site=after_ctx17 utc=2026-10-07T02:44:26Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x1000 end=0x1004134000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x1000 slack_in_alloc=1408 page_after_alloc=0x1004134000 mapped_by=NONE-1 code_end+2047 mapped=NO + ALLOC #6 va=0x1004134000 size=0x2000 end=0x1004136000 uncached freed + ALLOC #7 va=0x1004136000 size=0x4000 end=0x100413a000 uncached live + ALLOC #8 va=0x100413a000 size=0x1000 end=0x100413b000 uncached live + ALLOC #9 va=0x100413b000 size=0x4000 end=0x100413f000 uncached live + ALLOC #10 va=0x100413f000 size=0x22000 end=0x1004161000 uncached live +SNAP site=before_ctx256 utc=2026-10-07T02:44:26Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x1000 end=0x1004134000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x1000 slack_in_alloc=1408 page_after_alloc=0x1004134000 mapped_by=NONE-1 code_end+2047 mapped=NO + ALLOC #6 va=0x1004134000 size=0x2000 end=0x1004136000 uncached freed + ALLOC #7 va=0x1004136000 size=0x4000 end=0x100413a000 uncached live + ALLOC #8 va=0x100413a000 size=0x1000 end=0x100413b000 uncached live + ALLOC #9 va=0x100413b000 size=0x4000 end=0x100413f000 uncached live + ALLOC #10 va=0x100413f000 size=0x22000 end=0x1004161000 uncached live +RESULT variant=baseline ctx=256 rc=-4 utc_after=2026-10-07T02:54:26Z call_ns=600000391378 chip_ns=0 unwritten=0 max_abs_err=inf +SNAP site=after_ctx256 utc=2026-10-07T02:54:26Z allocations=12 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x1000 end=0x1004134000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x1000 slack_in_alloc=1408 page_after_alloc=0x1004134000 mapped_by=NONE-1 code_end+2047 mapped=NO + ALLOC #6 va=0x1004134000 size=0x2000 end=0x1004136000 uncached freed + ALLOC #7 va=0x1004136000 size=0x4000 end=0x100413a000 uncached live + ALLOC #8 va=0x100413a000 size=0x1000 end=0x100413b000 uncached live + ALLOC #9 va=0x100413b000 size=0x4000 end=0x100413f000 uncached live + ALLOC #10 va=0x100413f000 size=0x22000 end=0x1004161000 uncached freed + ALLOC #11 va=0x1004161000 size=0x200000 end=0x1004361000 uncached live diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-1.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-1.log new file mode 100644 index 000000000..9e371fced --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-1.log @@ -0,0 +1,69 @@ +VARIANT padded kernel_bytes=2688 +SNAP site=before_ctx1 utc=2026-10-07T02:54:26Z allocations=0 (device not open yet) +RESULT variant=padded ctx=1 rc=0 utc_after=2026-10-07T02:54:26Z call_ns=133153532 chip_ns=214704 unwritten=0 max_abs_err=0 +SNAP site=after_ctx1 utc=2026-10-07T02:54:26Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +SNAP site=before_ctx17 utc=2026-10-07T02:54:26Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +RESULT variant=padded ctx=17 rc=0 utc_after=2026-10-07T02:54:26Z call_ns=260528 chip_ns=104208 unwritten=0 max_abs_err=1.58e-07 +SNAP site=after_ctx17 utc=2026-10-07T02:54:26Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +SNAP site=before_ctx256 utc=2026-10-07T02:54:26Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +RESULT variant=padded ctx=256 rc=0 utc_after=2026-10-07T02:54:26Z call_ns=648417 chip_ns=309968 unwritten=0 max_abs_err=2.25e-07 +SNAP site=after_ctx256 utc=2026-10-07T02:54:26Z allocations=12 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached freed + ALLOC #11 va=0x1004162000 size=0x200000 end=0x1004362000 uncached live diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-2.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-2.log new file mode 100644 index 000000000..29f3f5248 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-2.log @@ -0,0 +1,69 @@ +VARIANT padded kernel_bytes=2688 +SNAP site=before_ctx1 utc=2026-10-07T02:54:26Z allocations=0 (device not open yet) +RESULT variant=padded ctx=1 rc=0 utc_after=2026-10-07T02:54:26Z call_ns=133638652 chip_ns=213712 unwritten=0 max_abs_err=0 +SNAP site=after_ctx1 utc=2026-10-07T02:54:26Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +SNAP site=before_ctx17 utc=2026-10-07T02:54:26Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +RESULT variant=padded ctx=17 rc=0 utc_after=2026-10-07T02:54:26Z call_ns=237520 chip_ns=104128 unwritten=0 max_abs_err=1.58e-07 +SNAP site=after_ctx17 utc=2026-10-07T02:54:26Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +SNAP site=before_ctx256 utc=2026-10-07T02:54:26Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +RESULT variant=padded ctx=256 rc=0 utc_after=2026-10-07T02:54:26Z call_ns=621328 chip_ns=314672 unwritten=0 max_abs_err=2.25e-07 +SNAP site=after_ctx256 utc=2026-10-07T02:54:26Z allocations=12 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached freed + ALLOC #11 va=0x1004162000 size=0x200000 end=0x1004362000 uncached live diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-3.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-3.log new file mode 100644 index 000000000..2778ca14c --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-3.log @@ -0,0 +1,69 @@ +VARIANT padded kernel_bytes=2688 +SNAP site=before_ctx1 utc=2026-10-07T02:54:26Z allocations=0 (device not open yet) +RESULT variant=padded ctx=1 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=134189038 chip_ns=217329 unwritten=0 max_abs_err=0 +SNAP site=after_ctx1 utc=2026-10-07T02:54:27Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +SNAP site=before_ctx17 utc=2026-10-07T02:54:27Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +RESULT variant=padded ctx=17 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=256480 chip_ns=104160 unwritten=0 max_abs_err=1.58e-07 +SNAP site=after_ctx17 utc=2026-10-07T02:54:27Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +SNAP site=before_ctx256 utc=2026-10-07T02:54:27Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +RESULT variant=padded ctx=256 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=617281 chip_ns=309345 unwritten=0 max_abs_err=2.25e-07 +SNAP site=after_ctx256 utc=2026-10-07T02:54:27Z allocations=12 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached freed + ALLOC #11 va=0x1004162000 size=0x200000 end=0x1004362000 uncached live diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-4.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-4.log new file mode 100644 index 000000000..3358976c9 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-4.log @@ -0,0 +1,69 @@ +VARIANT padded kernel_bytes=2688 +SNAP site=before_ctx1 utc=2026-10-07T02:54:27Z allocations=0 (device not open yet) +RESULT variant=padded ctx=1 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=132285660 chip_ns=219136 unwritten=0 max_abs_err=0 +SNAP site=after_ctx1 utc=2026-10-07T02:54:27Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +SNAP site=before_ctx17 utc=2026-10-07T02:54:27Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +RESULT variant=padded ctx=17 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=248049 chip_ns=105185 unwritten=0 max_abs_err=1.58e-07 +SNAP site=after_ctx17 utc=2026-10-07T02:54:27Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +SNAP site=before_ctx256 utc=2026-10-07T02:54:27Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +RESULT variant=padded ctx=256 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=632400 chip_ns=310496 unwritten=0 max_abs_err=2.25e-07 +SNAP site=after_ctx256 utc=2026-10-07T02:54:27Z allocations=12 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached freed + ALLOC #11 va=0x1004162000 size=0x200000 end=0x1004362000 uncached live diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-5.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-5.log new file mode 100644 index 000000000..db7dd8bbe --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/2-green-padded-5.log @@ -0,0 +1,69 @@ +VARIANT padded kernel_bytes=2688 +SNAP site=before_ctx1 utc=2026-10-07T02:54:27Z allocations=0 (device not open yet) +RESULT variant=padded ctx=1 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=132116748 chip_ns=213584 unwritten=0 max_abs_err=0 +SNAP site=after_ctx1 utc=2026-10-07T02:54:27Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +SNAP site=before_ctx17 utc=2026-10-07T02:54:27Z allocations=10 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=#6 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached live + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live +RESULT variant=padded ctx=17 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=238896 chip_ns=103200 unwritten=0 max_abs_err=1.58e-07 +SNAP site=after_ctx17 utc=2026-10-07T02:54:27Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +SNAP site=before_ctx256 utc=2026-10-07T02:54:27Z allocations=11 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached live +RESULT variant=padded ctx=256 rc=0 utc_after=2026-10-07T02:54:27Z call_ns=610449 chip_ns=307728 unwritten=0 max_abs_err=2.25e-07 +SNAP site=after_ctx256 utc=2026-10-07T02:54:27Z allocations=12 + ALLOC #0 va=0x1004110000 size=0x1000 end=0x1004111000 uncached live + ALLOC #1 va=0x1004111000 size=0x10000 end=0x1004121000 uncached live + ALLOC #2 va=0x1004121000 size=0x1000 end=0x1004122000 uncached live + ALLOC #3 va=0x1004122000 size=0x1000 end=0x1004123000 uncached live + ALLOC #4 va=0x1004123000 size=0x10000 end=0x1004133000 uncached live + ALLOC #5 va=0x1004133000 size=0x2000 end=0x1004135000 uncached live CODE + CODE va=0x1004133000 code_bytes=2688 alloc=0x2000 slack_in_alloc=5504 page_after_alloc=0x1004135000 mapped_by=NONE-1 code_end+2047 mapped=yes + ALLOC #6 va=0x1004135000 size=0x2000 end=0x1004137000 uncached freed + ALLOC #7 va=0x1004137000 size=0x4000 end=0x100413b000 uncached live + ALLOC #8 va=0x100413b000 size=0x1000 end=0x100413c000 uncached live + ALLOC #9 va=0x100413c000 size=0x4000 end=0x1004140000 uncached live + ALLOC #10 va=0x1004140000 size=0x22000 end=0x1004162000 uncached freed + ALLOC #11 va=0x1004162000 size=0x200000 end=0x1004362000 uncached live diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded-receipt.json b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded-receipt.json new file mode 100644 index 000000000..cc0ffcfe7 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded-receipt.json @@ -0,0 +1 @@ +{"schema":"OMEGA_GPU_ATTENTION_V1","tolerances":{"rel":2e-4,"abs":2e-5,"large_scores_rel":1e-3,"large_scores_abs":1e-4},"cases":[{"case":"gqa_f32_qwen3_4b_32q8kv_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":216449,"call_ns":104928847,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8192,"kv_bytes_naive":8192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00198312,"pass":true,"chip_elapsed_ns":104192,"call_ns":248720,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":139264,"kv_bytes_naive":139264,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00219175,"pass":true,"chip_elapsed_ns":313456,"call_ns":693201,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2097152,"kv_bytes_naive":2097152,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00376301,"pass":true,"chip_elapsed_ns":1320049,"call_ns":3704596,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":16777216,"kv_bytes_naive":16777216,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=OK,bad=4090) NO_RESCALE:CAUGHT(rc=OK,bad=3905) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086)"},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.0019369,"pass":true,"chip_elapsed_ns":205441,"call_ns":334401,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1040384,"kv_bytes_naive":1040384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00195072,"pass":true,"chip_elapsed_ns":204992,"call_ns":224128,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00222211,"pass":true,"chip_elapsed_ns":205744,"call_ns":224240,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1056768,"kv_bytes_naive":1056768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00262496,"pass":true,"chip_elapsed_ns":306656,"call_ns":364752,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":2457600,"kv_bytes_naive":2457600,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_qwen3_4b_32q8kv_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00318626,"pass":true,"chip_elapsed_ns":720689,"call_ns":944385,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8192000,"kv_bytes_naive":8192000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":103728,"call_ns":283040,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096,"kv_bytes_naive":4096,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00213223,"pass":true,"chip_elapsed_ns":103088,"call_ns":107584,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":69632,"kv_bytes_naive":69632,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095)"},{"case":"gqa_f32_gqa8_32q4kv_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00193136,"pass":true,"chip_elapsed_ns":208480,"call_ns":318432,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00246504,"pass":true,"chip_elapsed_ns":1331393,"call_ns":1558353,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":4,"mutants_caught":4,"mutant_note":"SLOT:CAUGHT(rc=OK,bad=4084) NO_RESCALE:CAUGHT(rc=OK,bad=3914) Q_ROW:CAUGHT(rc=OK,bad=4078) OUT_ROW:CAUGHT(rc=OK,bad=4078)"},{"case":"gqa_f32_gqa8_32q4kv_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00243573,"pass":true,"chip_elapsed_ns":206384,"call_ns":309233,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":520192,"kv_bytes_naive":520192,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00180964,"pass":true,"chip_elapsed_ns":207969,"call_ns":217569,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00188256,"pass":true,"chip_elapsed_ns":204768,"call_ns":214384,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":528384,"kv_bytes_naive":528384,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00199715,"pass":true,"chip_elapsed_ns":308464,"call_ns":330688,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1228800,"kv_bytes_naive":1228800,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_gqa8_32q4kv_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00296202,"pass":true,"chip_elapsed_ns":1021633,"call_ns":1127505,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4096000,"kv_bytes_naive":4096000,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"gqa_f32_large_scores_32q4kv_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.0734338,"pass":true,"chip_elapsed_ns":206736,"call_ns":225552,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"NO_MAX:CAUGHT(rc=OK,bad=4096)"},{"case":"gqa_f32_mha_16q16kv_ctx300","n":2048,"rc":"OK","violations":0,"worst_scaled_err":0.00270879,"pass":true,"chip_elapsed_ns":309728,"call_ns":553105,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4915200,"kv_bytes_naive":4915200,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":3,"mutants_caught":3,"mutant_note":"Q_ROW:CAUGHT(rc=OK,bad=2043) OUT_ROW:CAUGHT(rc=OK,bad=2048) KV_HEAD:CAUGHT(rc=OK,bad=2048)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":104912,"call_ns":194000,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00226843,"pass":true,"chip_elapsed_ns":103216,"call_ns":188384,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":131072,"kv_bytes_naive":131072,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4094)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00208125,"pass":true,"chip_elapsed_ns":209681,"call_ns":319265,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1048576,"kv_bytes_naive":1048576,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00452839,"pass":true,"chip_elapsed_ns":1127457,"call_ns":1365665,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":8388608,"kv_bytes_naive":8388608,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4082) SLOT:CAUGHT(rc=OK,bad=4080) NO_RESCALE:CAUGHT(rc=OK,bad=3749) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086)"},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00214904,"pass":true,"chip_elapsed_ns":205056,"call_ns":339921,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00186122,"pass":true,"chip_elapsed_ns":104144,"call_ns":114512,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00167553,"pass":true,"chip_elapsed_ns":205088,"call_ns":216800,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":589824,"kv_bytes_naive":589824,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00198758,"pass":true,"chip_elapsed_ns":206432,"call_ns":232976,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":1245184,"kv_bytes_naive":1245184,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00529051,"pass":true,"chip_elapsed_ns":309952,"call_ns":324160,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":655360,"kv_bytes_naive":4128768,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx1","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0,"pass":true,"chip_elapsed_ns":103985,"call_ns":243921,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":32768,"kv_bytes_naive":32768,"kv_blocks_unique":1,"kv_blocks_logical":1,"mutants_run":1,"mutants_caught":1,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4096)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx17","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00260372,"pass":true,"chip_elapsed_ns":103776,"call_ns":183584,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":65536,"kv_bytes_naive":65536,"kv_blocks_unique":2,"kv_blocks_logical":2,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4096) SLOT:CAUGHT(rc=OK,bad=4094)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx256","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00241584,"pass":true,"chip_elapsed_ns":209120,"call_ns":304496,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":524288,"kv_bytes_naive":524288,"kv_blocks_unique":16,"kv_blocks_logical":16,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx2048","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00291129,"pass":true,"chip_elapsed_ns":1027409,"call_ns":1151810,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":4194304,"kv_bytes_naive":4194304,"kv_blocks_unique":128,"kv_blocks_logical":128,"mutants_run":5,"mutants_caught":5,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4086) SLOT:CAUGHT(rc=OK,bad=4081) NO_RESCALE:CAUGHT(rc=OK,bad=3543) Q_ROW:CAUGHT(rc=OK,bad=4082) OUT_ROW:CAUGHT(rc=OK,bad=4082)"},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx127","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00214133,"pass":true,"chip_elapsed_ns":205600,"call_ns":300544,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx128","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00222376,"pass":true,"chip_elapsed_ns":103072,"call_ns":109376,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":262144,"kv_bytes_naive":262144,"kv_blocks_unique":8,"kv_blocks_logical":8,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx129","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00203403,"pass":true,"chip_elapsed_ns":204992,"call_ns":212256,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":294912,"kv_bytes_naive":294912,"kv_blocks_unique":9,"kv_blocks_logical":9,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx300","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00186326,"pass":true,"chip_elapsed_ns":205425,"call_ns":217233,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":622592,"kv_bytes_naive":622592,"kv_blocks_unique":19,"kv_blocks_logical":19,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_gqa8_32q4kv_bs16_ctx1000","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.00422018,"pass":true,"chip_elapsed_ns":308240,"call_ns":316352,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":327680,"kv_bytes_naive":2064384,"kv_blocks_unique":10,"kv_blocks_logical":63,"mutants_run":0,"mutants_caught":0,"mutant_note":""},{"case":"paged_bf16_batch_3seq_32q8kv_ctx40_0_100","n":12288,"rc":"OK","violations":0,"worst_scaled_err":0.00189546,"pass":true,"chip_elapsed_ns":209072,"call_ns":555697,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":458752,"kv_bytes_naive":458752,"kv_blocks_unique":7,"kv_blocks_logical":7,"mutants_run":4,"mutants_caught":4,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=8189) SLOT:CAUGHT(rc=OK,bad=8186) Q_ROW:CAUGHT(rc=OK,bad=8180) OUT_ROW:CAUGHT(rc=OK,bad=8180)"},{"case":"paged_bf16_shared_prefix_4seq_8q2kv_10pre","n":4096,"rc":"OK","violations":0,"worst_scaled_err":0.0020284,"pass":true,"chip_elapsed_ns":206656,"call_ns":300576,"chip_calls":1,"unwritten_words":0,"kv_bytes_staged":311296,"kv_bytes_naive":802816,"kv_blocks_unique":19,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=4093) SLOT:CAUGHT(rc=OK,bad=4094)"},{"case":"paged_bf16_shared_prefix_4seq_32q8kv_10pre","n":16384,"rc":"OK","violations":0,"worst_scaled_err":0.00267069,"pass":true,"chip_elapsed_ns":416545,"call_ns":564017,"chip_calls":2,"unwritten_words":0,"kv_bytes_staged":1900544,"kv_bytes_naive":3211264,"kv_blocks_unique":29,"kv_blocks_logical":49,"mutants_run":2,"mutants_caught":2,"mutant_note":"KV_HEAD:CAUGHT(rc=OK,bad=16378) SLOT:CAUGHT(rc=OK,bad=16365)"}],"mutant_count":6,"mutants":{"NO_MAX":{"run":1,"caught":1},"KV_HEAD":{"run":11,"caught":11},"SLOT":{"run":9,"caught":9},"NO_RESCALE":{"run":4,"caught":4},"Q_ROW":{"run":6,"caught":6},"OUT_ROW":{"run":6,"caught":6}},"device_opens":1,"checks":122,"failed":0,"verdict":"OMEGA_GPU_ATTENTION_PASS"} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded.log b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded.log new file mode 100644 index 000000000..eb24925fc --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/3-hd128-padded.log @@ -0,0 +1,56 @@ +PASS gqa_f32_qwen3_4b_32q8kv_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=216449 call_ns=104928847 calls=1 unwritten=0 kv_staged=8192/8192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00198312 chip_ns=104192 call_ns=248720 calls=1 unwritten=0 kv_staged=139264/139264 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00219175 chip_ns=313456 call_ns=693201 calls=1 unwritten=0 kv_staged=2097152/2097152 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00376301 chip_ns=1320049 call_ns=3704596 calls=1 unwritten=0 kv_staged=16777216/16777216 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=4090) NO_RESCALE:CAUGHT(rc=OK,bad=3905) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086) +PASS gqa_f32_qwen3_4b_32q8kv_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.0019369 chip_ns=205441 call_ns=334401 calls=1 unwritten=0 kv_staged=1040384/1040384 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00195072 chip_ns=204992 call_ns=224128 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00222211 chip_ns=205744 call_ns=224240 calls=1 unwritten=0 kv_staged=1056768/1056768 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00262496 chip_ns=306656 call_ns=364752 calls=1 unwritten=0 kv_staged=2457600/2457600 blocks=1/1 | mutants 0/0 +PASS gqa_f32_qwen3_4b_32q8kv_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00318626 chip_ns=720689 call_ns=944385 calls=1 unwritten=0 kv_staged=8192000/8192000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=103728 call_ns=283040 calls=1 unwritten=0 kv_staged=4096/4096 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00213223 chip_ns=103088 call_ns=107584 calls=1 unwritten=0 kv_staged=69632/69632 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=4095) +PASS gqa_f32_gqa8_32q4kv_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00193136 chip_ns=208480 call_ns=318432 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00246504 chip_ns=1331393 call_ns=1558353 calls=1 unwritten=0 kv_staged=8388608/8388608 blocks=1/1 | mutants 4/4 SLOT:CAUGHT(rc=OK,bad=4084) NO_RESCALE:CAUGHT(rc=OK,bad=3914) Q_ROW:CAUGHT(rc=OK,bad=4078) OUT_ROW:CAUGHT(rc=OK,bad=4078) +PASS gqa_f32_gqa8_32q4kv_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.00243573 chip_ns=206384 call_ns=309233 calls=1 unwritten=0 kv_staged=520192/520192 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00180964 chip_ns=207969 call_ns=217569 calls=1 unwritten=0 kv_staged=524288/524288 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00188256 chip_ns=204768 call_ns=214384 calls=1 unwritten=0 kv_staged=528384/528384 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00199715 chip_ns=308464 call_ns=330688 calls=1 unwritten=0 kv_staged=1228800/1228800 blocks=1/1 | mutants 0/0 +PASS gqa_f32_gqa8_32q4kv_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00296202 chip_ns=1021633 call_ns=1127505 calls=1 unwritten=0 kv_staged=4096000/4096000 blocks=1/1 | mutants 0/0 +PASS gqa_f32_large_scores_32q4kv_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.0734338 chip_ns=206736 call_ns=225552 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=1/1 | mutants 1/1 NO_MAX:CAUGHT(rc=OK,bad=4096) +PASS gqa_f32_mha_16q16kv_ctx300 n=2048 rc=OK violations=0 worst_scaled_err=0.00270879 chip_ns=309728 call_ns=553105 calls=1 unwritten=0 kv_staged=4915200/4915200 blocks=1/1 | mutants 3/3 Q_ROW:CAUGHT(rc=OK,bad=2043) OUT_ROW:CAUGHT(rc=OK,bad=2048) KV_HEAD:CAUGHT(rc=OK,bad=2048) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=104912 call_ns=194000 calls=1 unwritten=0 kv_staged=65536/65536 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00226843 chip_ns=103216 call_ns=188384 calls=1 unwritten=0 kv_staged=131072/131072 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=4095) SLOT:CAUGHT(rc=OK,bad=4094) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00208125 chip_ns=209681 call_ns=319265 calls=1 unwritten=0 kv_staged=1048576/1048576 blocks=16/16 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00452839 chip_ns=1127457 call_ns=1365665 calls=1 unwritten=0 kv_staged=8388608/8388608 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=4082) SLOT:CAUGHT(rc=OK,bad=4080) NO_RESCALE:CAUGHT(rc=OK,bad=3749) Q_ROW:CAUGHT(rc=OK,bad=4086) OUT_ROW:CAUGHT(rc=OK,bad=4086) +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.00214904 chip_ns=205056 call_ns=339921 calls=1 unwritten=0 kv_staged=524288/524288 blocks=8/8 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00186122 chip_ns=104144 call_ns=114512 calls=1 unwritten=0 kv_staged=524288/524288 blocks=8/8 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00167553 chip_ns=205088 call_ns=216800 calls=1 unwritten=0 kv_staged=589824/589824 blocks=9/9 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00198758 chip_ns=206432 call_ns=232976 calls=1 unwritten=0 kv_staged=1245184/1245184 blocks=19/19 | mutants 0/0 +PASS paged_bf16_qwen3_4b_32q8kv_bs16_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00529051 chip_ns=309952 call_ns=324160 calls=1 unwritten=0 kv_staged=655360/4128768 blocks=10/63 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx1 n=4096 rc=OK violations=0 worst_scaled_err=0 chip_ns=103985 call_ns=243921 calls=1 unwritten=0 kv_staged=32768/32768 blocks=1/1 | mutants 1/1 KV_HEAD:CAUGHT(rc=OK,bad=4096) +PASS paged_bf16_gqa8_32q4kv_bs16_ctx17 n=4096 rc=OK violations=0 worst_scaled_err=0.00260372 chip_ns=103776 call_ns=183584 calls=1 unwritten=0 kv_staged=65536/65536 blocks=2/2 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=4096) SLOT:CAUGHT(rc=OK,bad=4094) +PASS paged_bf16_gqa8_32q4kv_bs16_ctx256 n=4096 rc=OK violations=0 worst_scaled_err=0.00241584 chip_ns=209120 call_ns=304496 calls=1 unwritten=0 kv_staged=524288/524288 blocks=16/16 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx2048 n=4096 rc=OK violations=0 worst_scaled_err=0.00291129 chip_ns=1027409 call_ns=1151810 calls=1 unwritten=0 kv_staged=4194304/4194304 blocks=128/128 | mutants 5/5 KV_HEAD:CAUGHT(rc=OK,bad=4086) SLOT:CAUGHT(rc=OK,bad=4081) NO_RESCALE:CAUGHT(rc=OK,bad=3543) Q_ROW:CAUGHT(rc=OK,bad=4082) OUT_ROW:CAUGHT(rc=OK,bad=4082) +PASS paged_bf16_gqa8_32q4kv_bs16_ctx127 n=4096 rc=OK violations=0 worst_scaled_err=0.00214133 chip_ns=205600 call_ns=300544 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx128 n=4096 rc=OK violations=0 worst_scaled_err=0.00222376 chip_ns=103072 call_ns=109376 calls=1 unwritten=0 kv_staged=262144/262144 blocks=8/8 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx129 n=4096 rc=OK violations=0 worst_scaled_err=0.00203403 chip_ns=204992 call_ns=212256 calls=1 unwritten=0 kv_staged=294912/294912 blocks=9/9 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx300 n=4096 rc=OK violations=0 worst_scaled_err=0.00186326 chip_ns=205425 call_ns=217233 calls=1 unwritten=0 kv_staged=622592/622592 blocks=19/19 | mutants 0/0 +PASS paged_bf16_gqa8_32q4kv_bs16_ctx1000 n=4096 rc=OK violations=0 worst_scaled_err=0.00422018 chip_ns=308240 call_ns=316352 calls=1 unwritten=0 kv_staged=327680/2064384 blocks=10/63 | mutants 0/0 +PASS paged_bf16_batch_3seq_32q8kv_ctx40_0_100 n=12288 rc=OK violations=0 worst_scaled_err=0.00189546 chip_ns=209072 call_ns=555697 calls=2 unwritten=0 kv_staged=458752/458752 blocks=7/7 | mutants 4/4 KV_HEAD:CAUGHT(rc=OK,bad=8189) SLOT:CAUGHT(rc=OK,bad=8186) Q_ROW:CAUGHT(rc=OK,bad=8180) OUT_ROW:CAUGHT(rc=OK,bad=8180) +PASS paged_bf16_shared_prefix_4seq_8q2kv_10pre n=4096 rc=OK violations=0 worst_scaled_err=0.0020284 chip_ns=206656 call_ns=300576 calls=1 unwritten=0 kv_staged=311296/802816 blocks=19/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=4093) SLOT:CAUGHT(rc=OK,bad=4094) +PASS paged_bf16_shared_prefix_4seq_32q8kv_10pre n=16384 rc=OK violations=0 worst_scaled_err=0.00267069 chip_ns=416545 call_ns=564017 calls=2 unwritten=0 kv_staged=1900544/3211264 blocks=29/49 | mutants 2/2 KV_HEAD:CAUGHT(rc=OK,bad=16378) SLOT:CAUGHT(rc=OK,bad=16365) +mutant NO_MAX: caught 1 of 1 +mutant KV_HEAD: caught 11 of 11 +mutant SLOT: caught 9 of 9 +mutant NO_RESCALE: caught 4 of 4 +mutant Q_ROW: caught 6 of 6 +mutant OUT_ROW: caught 6 of 6 +device_opens=1 + hd128 dominant token 5 (warp 0 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 40 (warp 1 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 70 (warp 2 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 100 (warp 3 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 127 (warp 3 of chunk 0): rc OK, 0 bad, worst 0 + hd128 dominant token 131 (warp 0 of chunk 1): rc OK, 0 bad, worst 0 + hd128 dominant token 299 (warp 1 of chunk 2): rc OK, 0 bad, worst 0 +PASS: 126 checks, 0 failed diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/5-kernel-log.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/5-kernel-log.txt new file mode 100644 index 000000000..2ddd080f7 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/5-kernel-log.txt @@ -0,0 +1 @@ +2026-10-06T21:44:26-05:00 spark-b87b kernel: NVRM: Xid (PCI:000f:01:00): 31, pid=4135588, name=va_camera_base, channel 0x00000002, intr 00000000. MMU Fault: ENGINE GRAPHICS GPC2 GPCCLIENT_GCC faulted @ 0x10_04134000. Fault is of type FAULT_PTE ACCESS_TYPE_VIRT_READ diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/end.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/end.txt new file mode 100644 index 000000000..3f23ed2bd --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/end.txt @@ -0,0 +1 @@ +2026-10-07T02:54:27Z diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/ground.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/ground.txt new file mode 100644 index 000000000..541861230 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/ground.txt @@ -0,0 +1,12 @@ +wt-base 9a20ca8fe6bc85967181afaa8c0a2d81c0ae0027 dirty=0 +wt-pad c7663bbfb9ecc01f03d407d981db5f48b987ed57 dirty=0 +omega f1d57c56c8ff277dfd1fc97b3d01c739e29f9900 dirty=0 +physics 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +NVIDIA GB10, 580.173.02, 0 % +7.0.0-1019-nvidia +7413297c2366b54aca668020eadb2368df52004c5250f65300229b4c0e50b0a4 /home/drakestapleton/workspace/investigations/2026-10-07-hd128-ctx256-stall/src/va_camera_base +f2d35f7da7b4b3d9c6be1a38266e98f1eacc639192437758681e06e7c11d1c39 /home/drakestapleton/workspace/investigations/2026-10-07-hd128-ctx256-stall/src/va_camera_pad +b15a3623ca9966713d543cb40d7df288f49243fed0e1f02daa7e99a7a87bbc77 /home/drakestapleton/workspace/hive/CODEPAD/wt-base/build/libomega_gpu.a +8248f0dbc1122ca4c1ea0cd5aea70527adc21feb3530347a064aa9c02ab4bf0f /home/drakestapleton/workspace/hive/CODEPAD/wt-pad/build/libomega_gpu.a +f60b100cb39fbd68ba06a3d14aeee8c282670ae42e1055919be0378da9af6d8f /home/drakestapleton/workspace/hive/CODEPAD/wt-pad/build/gpu_attention_test +xid_lines_before=1 diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/start.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/start.txt new file mode 100644 index 000000000..d286c318b --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/start.txt @@ -0,0 +1 @@ +2026-10-07T02:44:25Z diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/status.txt b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/status.txt new file mode 100644 index 000000000..ac8340c8c --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/status.txt @@ -0,0 +1,7 @@ +red rc=1 +green1 rc=0 +green2 rc=0 +green3 rc=0 +green4 rc=0 +green5 rc=0 +hd128 battery rc=0 diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/va_camera.c b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/va_camera.c new file mode 100644 index 000000000..418f0ea46 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/va_camera.c @@ -0,0 +1,81 @@ +/* omega#323 camera: replay hd128 gqa_f32 32q8kv ctx 1, 17, 256 in one process (the failing order) and + * record every chip allocation (link-time wrap of nvrm_alloc / nvrm_alloc_gpu_uncached / nvrm_free). + * The code buffer is found by content (the kernel bytes from codegen). Nothing in the launch path changes. + * usage: va_camera [ctx ...] (default ctx list: 1 17 256) */ +#include +#include +#include +#include +#include +#include +#include "nvrm.h" +#include "omega_gpu_attention_api.h" + +int __real_nvrm_alloc(Nvrm *rm, uint64_t size, NvrmMem *out); +int __real_nvrm_alloc_gpu_uncached(Nvrm *rm, uint64_t size, NvrmMem *out); +int __real_nvrm_free(Nvrm *rm, NvrmMem *m); + +typedef struct { uint64_t va, size; void *cpu; int live; const char *kind; } Rec; +static Rec g_rec[4096]; static int g_n; +static void rec_add(const NvrmMem *m, const char *kind) { if (g_n < 4096) g_rec[g_n++] = (Rec){ m->va, m->size, m->cpu, 1, kind }; } +int __wrap_nvrm_alloc(Nvrm *rm, uint64_t size, NvrmMem *out) { int rc = __real_nvrm_alloc(rm, size, out); if (rc == 0) rec_add(out, "cached"); return rc; } +int __wrap_nvrm_alloc_gpu_uncached(Nvrm *rm, uint64_t size, NvrmMem *out) { int rc = __real_nvrm_alloc_gpu_uncached(rm, size, out); if (rc == 0) rec_add(out, "uncached"); return rc; } +int __wrap_nvrm_free(Nvrm *rm, NvrmMem *m) { for (int i = 0; i < g_n; i++) if (g_rec[i].live && g_rec[i].va == m->va) g_rec[i].live = 0; return __real_nvrm_free(rm, m); } + +static void utc(char *b, size_t n) { struct timespec t; clock_gettime(CLOCK_REALTIME, &t); struct tm tm; gmtime_r(&t.tv_sec, &tm); strftime(b, n, "%Y-%m-%dT%H:%M:%SZ", &tm); } +static int live_covering(uint64_t va) { for (int i = 0; i < g_n; i++) if (g_rec[i].live && va >= g_rec[i].va && va < g_rec[i].va + g_rec[i].size) return i; return -1; } + +static void snap(const char *site, const uint8_t *kcode, size_t ksize) { + char ts[32]; utc(ts, sizeof ts); + printf("SNAP site=%s utc=%s allocations=%d\n", site, ts, g_n); + for (int i = 0; i < g_n; i++) { + int is_code = g_rec[i].live && g_rec[i].size >= ksize && g_rec[i].cpu && memcmp(g_rec[i].cpu, kcode, ksize) == 0; + printf(" ALLOC #%d va=0x%llx size=0x%llx end=0x%llx %s %s%s\n", i, (unsigned long long)g_rec[i].va, (unsigned long long)g_rec[i].size, + (unsigned long long)(g_rec[i].va + g_rec[i].size), g_rec[i].kind, g_rec[i].live ? "live" : "freed", is_code ? " CODE" : ""); + if (is_code) { + uint64_t end = g_rec[i].va + g_rec[i].size, code_end = g_rec[i].va + ksize; + int nxt = live_covering(end), nxt2 = live_covering(code_end + 2048 - 1); + printf(" CODE va=0x%llx code_bytes=%zu alloc=0x%llx slack_in_alloc=%llu page_after_alloc=0x%llx mapped_by=%s%d code_end+2047 mapped=%s\n", + (unsigned long long)g_rec[i].va, ksize, (unsigned long long)g_rec[i].size, (unsigned long long)(g_rec[i].size - ksize), + (unsigned long long)end, nxt >= 0 ? "#" : "NONE", nxt, nxt2 >= 0 ? "yes" : "NO"); + } + } + fflush(stdout); +} + +int main(int argc, char **argv) { + const char *variant = argc > 1 ? argv[1] : "unlabelled"; + uint32_t ctxs[16] = { 1, 17, 256 }; int nc = 3; + if (argc > 2) { nc = 0; for (int i = 2; i < argc && nc < 16; i++) ctxs[nc++] = (uint32_t)atoi(argv[i]); } + const uint32_t NQ = 32, NKV = 8, HD = 128, MAXC = 4096; + OmegaBlackwellKernel kk; memset(&kk, 0, sizeof kk); + if (omega_gpu_attention_codegen_hd(true, 12, 2, HD, &kk) != 0) { printf("codegen failed\n"); return 2; } + printf("VARIANT %s kernel_bytes=%zu\n", variant, (size_t)kk.code_size); + float *q = malloc(NQ * HD * 4), *k = malloc((size_t)MAXC * NKV * HD * 4), *v = malloc((size_t)MAXC * NKV * HD * 4), *o = malloc(NQ * HD * 4); + uint32_t s = 12345u; + for (size_t i = 0; i < NQ * HD; i++) { s = s * 1664525u + 1013904223u; q[i] = (float)((s >> 8) & 0xffff) / 32768.0f - 1.0f; } + for (size_t i = 0; i < (size_t)MAXC * NKV * HD; i++) { s = s * 1664525u + 1013904223u; k[i] = (float)((s >> 8) & 0xffff) / 32768.0f - 1.0f; + s = s * 1664525u + 1013904223u; v[i] = (float)((s >> 8) & 0xffff) / 32768.0f - 1.0f; } + int worst_rc = 0; + for (int c = 0; c < nc; c++) { + uint32_t ctx = ctxs[c]; char nm[32]; snprintf(nm, sizeof nm, "before_ctx%u", ctx); + if (c > 0) snap(nm, kk.code, kk.code_size); else { char ts[32]; utc(ts, sizeof ts); printf("SNAP site=%s utc=%s allocations=%d (device not open yet)\n", nm, ts, g_n); } + for (size_t i = 0; i < NQ * HD; i++) o[i] = NAN; + OmegaGpuAttnInfo info; memset(&info, 0, sizeof info); + int rc = omega_gpu_gqa_attention_f32(q, k, v, ctx, NQ, NKV, HD, o, &info); + double worst = 0; + for (uint32_t h = 0; h < NQ; h++) { + uint32_t kvh = h / (NQ / NKV); double m = -INFINITY, *sc = malloc(ctx * sizeof(double)), l = 0; + for (uint32_t t = 0; t < ctx; t++) { double d = 0; for (uint32_t x = 0; x < HD; x++) d += (double)q[h * HD + x] * k[((size_t)t * NKV + kvh) * HD + x]; sc[t] = d / sqrt((double)HD); if (sc[t] > m) m = sc[t]; } + for (uint32_t t = 0; t < ctx; t++) { sc[t] = exp(sc[t] - m); l += sc[t]; } + for (uint32_t x = 0; x < HD; x++) { double a = 0; for (uint32_t t = 0; t < ctx; t++) a += sc[t] * v[((size_t)t * NKV + kvh) * HD + x]; double e = fabs(a / l - o[h * HD + x]); if (!(e <= worst)) worst = isnan(e) ? INFINITY : e; } + free(sc); + } + char ts[32]; utc(ts, sizeof ts); + printf("RESULT variant=%s ctx=%u rc=%d utc_after=%s call_ns=%llu chip_ns=%llu unwritten=%llu max_abs_err=%.3g\n", variant, ctx, rc, ts, + (unsigned long long)info.call_ns, (unsigned long long)info.elapsed_ns, (unsigned long long)info.unwritten_words, worst); + snprintf(nm, sizeof nm, "after_ctx%u", ctx); snap(nm, kk.code, kk.code_size); + if (rc != 0) { worst_rc = rc; break; } + } + return worst_rc == 0 ? 0 : 1; +} diff --git a/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/window.sh b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/window.sh new file mode 100755 index 000000000..de935b820 --- /dev/null +++ b/evidence/CODEPAD-PREFETCH-f1d57c5/red-green-probe/window.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# omega#323 / #324 GB10 window (approved by merge control 3649dd). Run under quietlock hold. Never killed. +# 1 RED baseline (omega 9a20ca8 untouched) ctx 1,17,256, expect Xid 31 at ctx256 (host waits up to 600 s) +# 2 GREEN padded (9a20ca8 + e09adff) ctx 1,17,256, five fresh processes +# 3 padded hd128 full battery (gpu_attention_test --hd 128) +# 4 #324 head hd64 regression battery (tools/run_gpu_attention_chip.sh) +# stage a = 1-3 (hold 1), stage b = 4 (hold 2); 5 runs in both +# 5 kernel log (Xid) for the whole window +set -u +STAGE=${1:?stage a or b} +I=$HOME/workspace/investigations/2026-10-07-hd128-ctx256-stall; R=$I/runs/window-1$STAGE; C=$HOME/workspace/hive/CODEPAD +T0=$(date -u +%FT%TZ); echo "$T0" > $R/start.txt +{ for w in wt-base wt-pad omega; do echo "$w $(git -C $C/$w rev-parse HEAD) dirty=$(git -C $C/$w status --porcelain --untracked-files=no | wc -l)"; done + echo "physics $(git -C $C/physics rev-parse HEAD)"; nvidia-smi --query-gpu=name,driver_version,utilization.gpu --format=csv,noheader + nvidia-smi --query-compute-apps=pid,name --format=csv,noheader; uname -r + sha256sum $I/src/va_camera_base $I/src/va_camera_pad $C/wt-base/build/libomega_gpu.a $C/wt-pad/build/libomega_gpu.a $C/wt-pad/build/gpu_attention_test + journalctl -k --no-pager -o short-iso | grep -c 'Xid' | sed 's/^/xid_lines_before=/'; } > $R/ground.txt 2>&1 +if [ "$STAGE" = a ]; then +$I/src/va_camera_base baseline 1 17 256 > $R/1-red-baseline.log 2>&1; echo "red rc=$?" >> $R/status.txt +for n in 1 2 3 4 5; do $I/src/va_camera_pad padded 1 17 256 > $R/2-green-padded-$n.log 2>&1; echo "green$n rc=$?" >> $R/status.txt; done +(cd $C/wt-pad && ./build/gpu_attention_test --hd 128 --out $R/3-hd128-padded-receipt.json > $R/3-hd128-padded.log 2>&1); echo "hd128 battery rc=$?" >> $R/status.txt +fi +if [ "$STAGE" = b ]; then +(cd $C/omega && sh tools/run_gpu_attention_chip.sh $R/4-hd64-pr324 > $R/4-hd64-pr324.log 2>&1); echo "hd64 regression rc=$?" >> $R/status.txt +fi +journalctl -k --no-pager -o short-iso --since "$(date -d "$T0" '+%F %T')" > $R/5-kernel-log.txt 2>&1 +date -u +%FT%TZ > $R/end.txt +cd $R && sha256sum $(find . -type f ! -name SHA256SUMS | sort) > SHA256SUMS From d5dd2bfa592dbeab37bc5e89ac10b9406bc4f169 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 6 Oct 2026 21:55:37 -0500 Subject: [PATCH 4/4] crumb: recompile Co-Authored-By: Claude Opus 5.5 --- .crumb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.crumb b/.crumb index e8dc98a1c..e4da81044 100644 --- a/.crumb +++ b/.crumb @@ -106,14 +106,14 @@ } ], "children_root": "sha256:87e095b4a1eae6ee1dd0f225c362771e49ee3ac542c4d125f0760fcdc009161b", - "compiled_at": "2026-10-07T02:42:06Z", + "compiled_at": "2026-10-07T02:55:37Z", "compiler": "crumb-compile/1", - "digest": "sha256:8812e0794080481543c8ba1cf2d9103f9d96757495a5d5ba90a62b96e1078080", - "evidence_files": 4743, - "evidence_root": "sha256:34547c38b5669eb80fad819b39b679c1b425c66bc3e69d11431d684390b900e9", - "files": 6583, - "generated_at_commit": "e09adff92bf966b6b3471c129f8eb6ba1a211fb7", - "source_tree": "sha256:537d365b1471fcc12ed68e1ce28e32c3595796414b070245b0b918e4d0c43c16" + "digest": "sha256:f94d30694df98504baf7ef44036d281a5243e669cef99c5b1c3112defd02283a", + "evidence_files": 4777, + "evidence_root": "sha256:9748ca0a0301a9185d1623da4f264b34dc335d265752021052702f3d2114dcfc", + "files": 6617, + "generated_at_commit": "afa40707e02617d4055ecf50a7a81515270981fc", + "source_tree": "sha256:8008be6963727913bfff283658047bbcf23b61764d983bd8f85c6c612555e53d" }, "owner_lane": "", "provenance": {