omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
GitHub aien-dev/omega-mv#459 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/99426fbfcd933a6d.bundle -o 99426fbfcd933a6d.bundle git fetch 99426fbfcd933a6d.bundle refs/pull/459/head
Provenance
github-import 1
aien-dev/omega-mv
459
2cdba231aa273fc69b61baf8e2bbffe384313500
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":459,"url":"https://github.com/aien-dev/omega-mv/pull/459","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:57Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index f970bd751..4a3c11e3e 100644 --- a/.crumb +++ b/.crumb @@ -63,8 +63,8 @@ "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "b98001ac8c91759a2eb2125dadf492b7cb2dc1072279baad13a5d7c50470df12", - "last_commit": "710d438c", + "digest": "60ff5250efa4158d1e8305c087451dbcaa0d61ce78c24970767d53d11fd70285", + "last_commit": "da14b6c7", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, @@ -87,33 +87,33 @@ "purpose": "Directory spec. Purpose not yet described by a human." }, { - "digest": "d69b7371545db3c5920b5e035b3d1d8b8205664f393fedd7b9fc1bb582f23821", - "last_commit": "8d0698e9", + "digest": "a3c042a09369c70110537ae23049899329c50e59779add5efc9e656575a4116d", + "last_commit": "0e028587", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "8401c311b8d73c13a75937463ca173dba2af1a3e79fda3e126be4e1918f56436", - "last_commit": "710d438c", + "digest": "94680b854341a6f363654ac26e2bc9a4eb99a62995e660da90c21f313cf77fe4", + "last_commit": "0e028587", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { - "digest": "84e7502fdc66e65c9c94ffaa834cc53aec818ee3215716ba98926cf1c70bcca8", - "last_commit": "8d0698e9", + "digest": "61e2f6659e703f6e943059dc77af397dedc7951f146cf2a3a65c7c184eed316b", + "last_commit": "68725b10", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:44431b7effe75de4017e5a7fe6e7810607b465f61b217cf1df997d7cf1f9788f", - "compiled_at": "2026-10-15T01:56:24Z", + "children_root": "sha256:8653adc2d7587f9d40fb4d65e8bb1d67d93fed9f42ac450fdd98e528033009a2", + "compiled_at": "2026-10-15T02:29:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:7ef7d0ef646b0b36c0234f60d12a394e4fdb75cab2a8d3fa32a928d5505eff21", + "digest": "sha256:ce7d8aa03acad8ceed98bb5238e8e22ddda9c424665317fb52673a2d3c99e752", "evidence_files": 8525, "evidence_root": "sha256:7e338e990796a9edfddac421772f65cfe8bfdef7432fcfcb55685c44db83af7c", - "files": 11293, - "generated_at_commit": "c732af7e70e0fdad016a3c4f8555ffa25afccfd7", - "source_tree": "sha256:1b48524c014108a701e61791df2c07b30c6a5da6e470295f6448f95bf9527644" + "files": 11295, + "generated_at_commit": "0e028587d774a2864fb5ae3f95ab17a6613f369e", + "source_tree": "sha256:56f39edcd5f8cf23220e3307fff0466d9d887423b127233f971881fe128d5a1b" }, "owner_lane": "", "provenance": { diff --git a/.github/workflows/host-suites-2.yml b/.github/workflows/host-suites-2.yml index 2d3cdc94f..7c8644052 100644 --- a/.github/workflows/host-suites-2.yml +++ b/.github/workflows/host-suites-2.yml @@ -159,7 +159,7 @@ jobs: sel argus "^src/runtime/|^tests/runtime/|^tests/bench_rx_argus\.c$|^mk/machine-identity\.mk$|^src/(sha256|omega_evidence)\.|^(physics|aienos|argus)\.lock$" sel numeric2 "^tests/(test_omega_reduce|test_omega_divsqrt_gb10)\.c$|^tests/numeric_oracle\.h$|^src/(omega_numeric|omega_blackwell_(encoder|codegen|matmul|qmd)|sha256)" sel tensor "^tools/m20_receipt(_mutations)?\.sh$|^tests/test_m20_receipt\.sh$|^tests/fixtures/m20_receipt/|^src/tensor/|^tests/test_omega_tensor(_store)?\.c$|^tools/tensor_mutations\.sh$|^mk/tensor\.mk$|^src/(omega_numeric|omega_blackwell_(encoder|codegen|matmul|qmd)|sha256)" - sel gpuengine "^src/omega_gpu_(engine|platform)\.|^src/omega_blackwell_(encoder|qmd|realize|codegen|matmul)\.|^src/omega_gpu_(session|serving|matmul_api|attention_api|wait|fmt|platform_linux)\.|^src/sha256\.|^tests/test_omega_(gpu_engine|gpu_engine_compile|gpu_platform|codegen_freestanding|gpu_session_platform|gpu_platform_linux)\.c$|^tests/fake_m16_native\.c$|^physics\.lock$|^tools/gpu_engine_mutations\.sh$|^mk/omega-gpu-engine\.mk$" + sel gpuengine "^src/omega_gpu_(engine|platform)\.|^src/omega_blackwell_(encoder|qmd|realize|codegen|matmul)\.|^src/omega_gpu_(session|serving|matmul_api|attention_api|wait|fmt|platform_linux|cmdlist|mem_cached)\.|^src/sha256\.|^tests/test_omega_(gpu_engine|gpu_engine_compile|gpu_platform|codegen_freestanding|gpu_session_platform|gpu_platform_linux)\.c$|^tests/fake_m16_native\.c$|^physics\.lock$|^tools/gpu_engine_mutations\.sh$|^mk/omega-gpu-engine\.mk$" visor: needs: changes diff --git a/Makefile b/Makefile index 6a406f72b..455c492bc 100644 --- a/Makefile +++ b/Makefile @@ -2462,6 +2462,12 @@ test-gpu-fp8: $(GPU_FP8_TEST) ./$(GPU_FP8_TEST) --host-only ./$(GPU_FP8_TEST) --sim +# omega #457 (2026-10-15): host rewrite of a GPU-cached buffer must be visible to the next launch. Chip only; the gate +# is tools/run_gpu_l2_stale_chip.sh. +GPU_L2_STALE_TEST = $(OUT_DIR)/gpu_l2_stale_test +$(GPU_L2_STALE_TEST): tests/gpu_l2_stale_test.c src/omega_gpu_fp8_api.h src/omega_gpu_session.h $(OUT_DIR)/libomega_gpu.a + $(CC) $(CFLAGS) -ffp-contract=off -o $@ tests/gpu_l2_stale_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm + # OWN-30B cut 8 (2026-10-13): one-launch decode attention (omega_gpu_decode_attn_api.h). test-gpu-decode-attn is # host-only + simulator; the chip gate is tools/run_gpu_decode_attn_chip.sh. .PHONY: test-gpu-decode-attn diff --git a/mk/.crumb b/mk/.crumb index b0f15c987..42bf35a59 100644 --- a/mk/.crumb +++ b/mk/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-15T00:04:44Z", + "compiled_at": "2026-10-15T02:29:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:b98001ac8c91759a2eb2125dadf492b7cb2dc1072279baad13a5d7c50470df12", + "digest": "sha256:60ff5250efa4158d1e8305c087451dbcaa0d61ce78c24970767d53d11fd70285", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 70, - "generated_at_commit": "accd294d335a05aceda8428bef1f808bb4a24dd4", - "source_tree": "sha256:c7b5c521643f1d61e749a4a478093741aaf8b8fe7cc79739c8a383d34336dd24" + "generated_at_commit": "0e028587d774a2864fb5ae3f95ab17a6613f369e", + "source_tree": "sha256:316b8ec770d32728ad72be7affd36b16fa0b7ae8f6f427040e4122490285c095" }, "owner_lane": "", "provenance": { diff --git a/mk/omega-gpu-engine.mk b/mk/omega-gpu-engine.mk index 0f044a9d6..9e0260e92 100644 --- a/mk/omega-gpu-engine.mk +++ b/mk/omega-gpu-engine.mk @@ -195,10 +195,15 @@ build/test_omega_gpu_session_platform: tests/test_omega_gpu_session_platform.c $ @mkdir -p build gcc -std=gnu11 -O2 -Wall -Wextra -Werror -Isrc -DOMEGA_GPU_NO_POSIX -o $@ tests/test_omega_gpu_session_platform.c $(GPU_FS_LINK) GPU_LINUX_REF_SRCS = src/omega_gpu_session.c src/omega_gpu_platform.c src/omega_gpu_platform_linux.c src/omega_gpu_fmt.c src/omega_blackwell_qmd.c -build/test_omega_gpu_platform_linux: tests/test_omega_gpu_platform_linux.c tests/fake_m16_native.c tests/fake_m16_native.h $(GPU_LINUX_REF_SRCS) $(GPU_FS_HDRS) src/omega_gpu_platform_linux.h +# omega #459: the command list over the reference (near-full ring with the #457 L2 invalidate prefix pending) needs the +# cached allocation, the command list and the codegen behind its nop kernel. +GPU_LINUX_REF_CMDLIST_SRCS = src/omega_gpu_mem_cached.c src/omega_gpu_cmdlist.c src/omega_blackwell_codegen.c src/omega_blackwell_encoder.c \ + src/omega_blackwell_matmul.c src/omega_blackwell_realize.c src/sha256.c +build/test_omega_gpu_platform_linux: tests/test_omega_gpu_platform_linux.c tests/fake_m16_native.c tests/fake_m16_native.h $(GPU_LINUX_REF_SRCS) $(GPU_FS_HDRS) src/omega_gpu_platform_linux.h \ + src/omega_gpu_cmdlist.h src/omega_gpu_mem_cached.h $(GPU_LINUX_REF_CMDLIST_SRCS) @mkdir -p build gcc -std=gnu11 -O2 -Wall -Wextra -Werror -D_GNU_SOURCE -pthread -Isrc -Itests $(GPU_ENGINE_PHYS_INC) \ - -o $@ tests/test_omega_gpu_platform_linux.c tests/fake_m16_native.c $(GPU_LINUX_REF_SRCS) + -o $@ tests/test_omega_gpu_platform_linux.c tests/fake_m16_native.c $(GPU_LINUX_REF_SRCS) $(GPU_LINUX_REF_CMDLIST_SRCS) -lm test-gpu-session-platform: build/test_omega_gpu_session_platform build/test_omega_gpu_platform_linux test-gpu-session-mutants ./build/test_omega_gpu_session_platform ./build/test_omega_gpu_platform_linux diff --git a/src/.crumb b/src/.crumb index 109ba55dc..9eec9344d 100644 --- a/src/.crumb +++ b/src/.crumb @@ -80,7 +80,7 @@ }, { "digest": "bdc017bf3baddb9034478651fb3f170f045ce8aa27187481d15ac5da7fbfd18c", - "last_commit": "18531691", + "last_commit": "1edf41a5", "name": "compiler", "purpose": "Directory src/compiler. Purpose not yet described by a human." }, @@ -140,19 +140,19 @@ }, { "digest": "4785d8df268c31047589c5dff4ebc1f9a12a0fa4d5c94ce6dee156a841cf9502", - "last_commit": "", + "last_commit": "dd67f6bd", "name": "reservoir", "purpose": "Ionic-droplet reservoir simulator (omega#440): binary32 fixed-step RK4 of the authors' droplet m" }, { "digest": "9e27882accc1db2881793e3f389519f5dd37f83cd37c4d1a6e19f2aa2e84d217", - "last_commit": "501d555c", + "last_commit": "5901baa5", "name": "runtime", "purpose": "Directory src/runtime. Purpose not yet described by a human." }, { "digest": "d7bb5fb627dfe92066f94fa556e86be5d025c0ff5e81d823ba177a56ea099d31", - "last_commit": "5ae192a4", + "last_commit": "5901baa5", "name": "searchtrace", "purpose": "Directory src/searchtrace. Purpose not yet described by a human." }, @@ -182,14 +182,14 @@ } ], "children_root": "sha256:93f32e91c5b498226d6ef4a040e3fbd2873dfb1f8b2405c26ea63b3a63df5f22", - "compiled_at": "2026-10-14T21:46:29Z", + "compiled_at": "2026-10-15T02:29:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:d69b7371545db3c5920b5e035b3d1d8b8205664f393fedd7b9fc1bb582f23821", + "digest": "sha256:a3c042a09369c70110537ae23049899329c50e59779add5efc9e656575a4116d", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 534, - "generated_at_commit": "2a6d6d7b9091bd2184b15dcde893035dbcca40d3", - "source_tree": "sha256:c8f51a54a529457e4d7f2a0280349ddb609d67ab3793b6aecabc9599de6fc88e" + "generated_at_commit": "0e028587d774a2864fb5ae3f95ab17a6613f369e", + "source_tree": "sha256:a4a2bc54f5d4e03a803a5399921ad7456257e397edbcee0f4702958ebeba5740" }, "owner_lane": "", "provenance": { diff --git a/src/omega_gpu_cmdlist.c b/src/omega_gpu_cmdlist.c index 6b0b168f0..a403e250f 100644 --- a/src/omega_gpu_cmdlist.c +++ b/src/omega_gpu_cmdlist.c @@ -257,6 +257,11 @@ int omega_gpu_cmdlist_submit(OmegaGpuCmdList *cl, const OmegaGpuCmdListOpts *opt } const uint32_t per_launch = (o.mode == OMEGA_GPU_CMDLIST_INLINE ? 4u + 2u * 99u : 8u) + (o.stamps ? STAMP_WORDS : 0u); + /* The platform may put its own words ahead of ours in the ring (the Linux reference: the omega #457 L2 invalidate + * after a host write to a GPU-cached buffer). Budget what it publishes, or a near-full submission is refused. */ + const uint32_t prefix = omega_gpu_session_submit_prefix_words(); + const uint32_t avail = cl->words_cap - 18u - TAIL_WORDS - 2u - STAMP_WORDS; + if (prefix > avail || avail - prefix < per_launch) { omega_gpu_session_set_error("cmdlist submit: the platform submit prefix leaves no room for a launch"); return -1; } uint64_t *stamp_cpu = cl->stamps.cpu; cl->stamped = o.stamps ? 1 : 0; if (o.stamps) { @@ -265,7 +270,7 @@ int omega_gpu_cmdlist_submit(OmegaGpuCmdList *cl, const OmegaGpuCmdListOpts *opt omega_gpu_session_set_error("cmdlist submit: sync stamps"); return -1; } } - const uint32_t room = (cl->words_cap - 18u - TAIL_WORDS - 2u - STAMP_WORDS) / per_launch; + const uint32_t room = (avail - prefix) / per_launch; uint64_t elapsed = 0, host = p->time_now_ns(p->ctx) - th0; uint32_t done = 0, submits = 0, words = 0; while (done < cl->n) { diff --git a/src/omega_gpu_platform.h b/src/omega_gpu_platform.h index dedc4c669..c45225fdd 100644 --- a/src/omega_gpu_platform.h +++ b/src/omega_gpu_platform.h @@ -122,6 +122,9 @@ typedef struct { uint32_t max_inflight; /* jobs in flight per queue (concurrency limit) */ uint64_t max_buffer_bytes; /* one buffer */ uint64_t max_total_bytes; /* all live buffers */ + uint32_t submit_prefix_words; /* most words queue_submit may put ahead of the caller's words in the ring (the Linux + * reference: the omega #457 L2 invalidate); a caller filling the ring budgets + * ring words minus this. 0 = never. Not negotiated. */ } OmegaGpuPlatformCaps; /* ---- refusals ----------------------------------------------------------- */ diff --git a/src/omega_gpu_platform_linux.c b/src/omega_gpu_platform_linux.c index dc02aab42..d76543f4b 100644 --- a/src/omega_gpu_platform_linux.c +++ b/src/omega_gpu_platform_linux.c @@ -31,6 +31,8 @@ typedef struct { OmegaGpuHandleTable t; NvrmMem mem[OMEGA_GPU_HANDLE_SLOTS]; uint32_t rights[OMEGA_GPU_HANDLE_SLOTS]; + uint8_t gpu_cached[OMEGA_GPU_HANDLE_SLOTS]; /* allocated GPU-cached (nvrm_alloc), omega #457 */ + int l2_inval_pending; /* a host sync into a GPU-cached buffer since the last submission, omega #457 */ M16NativeContext m16; OmegaGpuDeviceHandle dev; /* generation 0 = closed */ OmegaGpuQueueHandle queue; @@ -42,7 +44,14 @@ static LinuxRef g_ref = { .locks = {PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER}, }; +/* omega #457: MEM_OP_A..D = 0, 0, 0, OPERATION L2_SYSMEM_NCOH_INVALIDATE 0x11 in D bits 31:27 (clc96f.h:30-73), the + * same method form as the C3 tail's L2_FLUSH_DIRTY. ref_queue_submit puts it ahead of the next submission after a host + * sync into a GPU-cached buffer; g_caps.submit_prefix_words is its size, so callers budget exactly what is written. */ +static const uint32_t L2_INVAL_PREFIX[] = { (2u << 28) | (4u << 16) | (0x0028u >> 2), 0, 0, 0, 0x11u << 27 }; +#define L2_INVAL_PREFIX_WORDS ((uint32_t)(sizeof L2_INVAL_PREFIX / sizeof L2_INVAL_PREFIX[0])) + static const OmegaGpuPlatformCaps g_caps = { + .submit_prefix_words = L2_INVAL_PREFIX_WORDS, .abi_major = OMEGA_GPU_PLATFORM_ABI_MAJOR, .abi_minor = OMEGA_GPU_PLATFORM_ABI_MINOR, .services = OMEGA_GPU_SVC_REQUIRED_SESSION, /* no MMIO (RM owns the registers), no IRQ (polling only) */ @@ -157,9 +166,11 @@ static int ref_device_close(void *ctx, OmegaGpuDeviceHandle dev) { (void)omega_gpu_handles_close(&r->t, i, r->t.generation[i], r->t.kind[i]); memset(&r->mem[i], 0, sizeof r->mem[i]); r->rights[i] = 0; + r->gpu_cached[i] = 0; } (void)omega_gpu_handles_close(&r->t, dev.index, dev.generation, OMEGA_GPU_HANDLE_DEVICE); memset(&r->dev, 0, sizeof r->dev); + r->l2_inval_pending = 0; /* omega #457: nothing pending survives the device */ memset(&r->queue, 0, sizeof r->queue); (void)m16_native_close(&r->m16); ref_unlock(r); @@ -192,12 +203,13 @@ static int ref_dma_alloc(void *ctx, OmegaGpuDeviceHandle dev, const OmegaGpuBuff NvrmMem m; if ((cached ? nvrm_alloc(&r->m16.rm, desc->bytes, &m) : nvrm_alloc_gpu_uncached(&r->m16.rm, desc->bytes, &m)) != 0) { (void)omega_gpu_handles_close(&r->t, idx, gen, desc->kind); /* this slot never got memory: its generation moves on */ - rc = refuse(r, OMEGA_GPU_PLAT_REFUSED_DEVICE, "nvrm_alloc_gpu_uncached"); + rc = refuse(r, OMEGA_GPU_PLAT_REFUSED_DEVICE, cached ? "nvrm_alloc" : "nvrm_alloc_gpu_uncached"); ref_unlock(r); return rc; } r->mem[idx] = m; r->rights[idx] = desc->rights; + r->gpu_cached[idx] = (uint8_t)cached; out->index = idx; out->generation = gen; cpu->ptr = m.cpu; cpu->len = (size_t)m.size; gpu->va = m.va; @@ -218,6 +230,7 @@ static int ref_dma_free(void *ctx, OmegaGpuBufferHandle b) { (void)omega_gpu_handles_close(&r->t, b.index, b.generation, kind); memset(&r->mem[b.index], 0, sizeof r->mem[b.index]); r->rights[b.index] = 0; + r->gpu_cached[b.index] = 0; ref_unlock(r); return OMEGA_GPU_PLAT_OK; } @@ -230,18 +243,22 @@ static void barrier(void) { #endif } -static int ref_sync(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint64_t len, const char *stage) { +static int ref_sync(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint64_t len, const char *stage, int to_gpu) { LinuxRef *r = ctx; ref_lock(r); int rc = buf_ok(r, b, NULL); if (rc == OMEGA_GPU_PLAT_OK) rc = range_ok(r, b, off, len); if (rc != OMEGA_GPU_PLAT_OK) rc = refuse(r, rc, stage); + /* omega #457 (chip, 2026-10-15): after the host rewrites a GPU-cached buffer the GPU already read, every later launch + * read the old bytes from L2 (nvos.h:1117 "For system memory this will not be coherent with direct CPU mappings"). + * The next submission therefore starts with L2_SYSMEM_NCOH_INVALIDATE (ref_queue_submit). */ + else if (to_gpu && r->gpu_cached[b.index]) r->l2_inval_pending = 1; ref_unlock(r); if (rc == OMEGA_GPU_PLAT_OK) barrier(); /* uncached system memory: a full barrier is the whole sync */ return rc; } -static int ref_sync_to_gpu(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint64_t len) { return ref_sync(ctx, b, off, len, "sync_cpu_to_gpu"); } -static int ref_sync_to_cpu(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint64_t len) { return ref_sync(ctx, b, off, len, "sync_gpu_to_cpu"); } +static int ref_sync_to_gpu(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint64_t len) { return ref_sync(ctx, b, off, len, "sync_cpu_to_gpu", 1); } +static int ref_sync_to_cpu(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint64_t len) { return ref_sync(ctx, b, off, len, "sync_gpu_to_cpu", 0); } static int ref_poll_word(void *ctx, OmegaGpuBufferHandle b, uint64_t off, uint32_t expected, uint64_t timeout_ms, uint32_t *observed) { LinuxRef *r = ctx; @@ -297,9 +314,26 @@ static int ref_queue_submit(void *ctx, OmegaGpuQueueHandle q, const uint32_t *wo ref_lock(r); int rc = queue_ok(r, q); if (rc == OMEGA_GPU_PLAT_OK && (!words || nwords == 0u)) rc = OMEGA_GPU_PLAT_REFUSED_ARGS; - if (rc == OMEGA_GPU_PLAT_OK && (uint64_t)nwords * 4u > r->m16.pb_mem.size) rc = OMEGA_GPU_PLAT_REFUSED_BAD_LENGTH; - if (rc == OMEGA_GPU_PLAT_OK && m16_native_submit_methods(&r->m16, words, nwords) != 0) rc = OMEGA_GPU_PLAT_REFUSED_DEVICE; - if (rc != OMEGA_GPU_PLAT_OK) rc = refuse(r, rc, "submit_methods"); + /* omega #457: a host sync into a GPU-cached buffer is pending, so this submission starts with L2_INVAL_PREFIX. + * No dirty line is dropped: every earlier submission ended with L2_FLUSH_DIRTY and the host waited for it. + * DOCS SILENT on ordering between this MEM_OP and the launch that follows (no WFI is inserted); the chip gate + * tools/run_gpu_l2_stale_chip.sh (20/20 FRESH) is the only proof. The prefix counts against the ring like any + * word; callers budget it from g_caps.submit_prefix_words (omega_gpu_cmdlist.c). */ + const uint32_t pre = r->l2_inval_pending ? L2_INVAL_PREFIX_WORDS : 0u; + if (rc == OMEGA_GPU_PLAT_OK && ((uint64_t)nwords + pre) * 4u > r->m16.pb_mem.size) rc = OMEGA_GPU_PLAT_REFUSED_BAD_LENGTH; + uint32_t *buf = NULL; const char *stage = "submit_methods"; + if (rc == OMEGA_GPU_PLAT_OK && pre) { + buf = malloc(((size_t)nwords + pre) * 4u); + if (!buf) { rc = OMEGA_GPU_PLAT_REFUSED_LIMIT; stage = "submit_methods (host copy for the #457 L2 invalidate prefix)"; } + else { + memcpy(buf, L2_INVAL_PREFIX, sizeof L2_INVAL_PREFIX); + memcpy(buf + pre, words, (size_t)nwords * 4u); + } + } + if (rc == OMEGA_GPU_PLAT_OK && m16_native_submit_methods(&r->m16, buf ? buf : words, nwords + pre) != 0) rc = OMEGA_GPU_PLAT_REFUSED_DEVICE; + if (rc == OMEGA_GPU_PLAT_OK && pre) r->l2_inval_pending = 0; + free(buf); + if (rc != OMEGA_GPU_PLAT_OK) rc = refuse(r, rc, stage); ref_unlock(r); return rc; } diff --git a/src/omega_gpu_session.c b/src/omega_gpu_session.c index 1e7c63722..5dcaaadc2 100644 --- a/src/omega_gpu_session.c +++ b/src/omega_gpu_session.c @@ -99,6 +99,7 @@ static const OmegaGpuPlatform *platform(void) { } const OmegaGpuPlatform *omega_gpu_session_platform(void) { return platform(); } +uint32_t omega_gpu_session_submit_prefix_words(void) { return platform() ? g_caps.submit_prefix_words : 0u; } /* g_caps is written before g_p is published */ OmegaGpuCompletionMode omega_gpu_session_completion_mode(void) { return OMEGA_GPU_COMPLETION_POLLING; } uint64_t omega_gpu_session_now_ns(void) { diff --git a/src/omega_gpu_session.h b/src/omega_gpu_session.h index cd454d49a..82c5e5d22 100644 --- a/src/omega_gpu_session.h +++ b/src/omega_gpu_session.h @@ -118,6 +118,9 @@ int omega_gpu_session_set_platform(const OmegaGpuPlatform *p, const OmegaGpuPlat /* The installed platform (the hosted build installs the Linux reference here when none was installed); NULL in the * freestanding build until omega_gpu_session_set_platform. */ const OmegaGpuPlatform *omega_gpu_session_platform(void); +/* The installed platform's caps.submit_prefix_words: words queue_submit may put ahead of the caller's in the ring, so a + * caller that fills the ring budgets ring words minus this (omega #457 L2 invalidate prefix). 0 with no platform. */ +uint32_t omega_gpu_session_submit_prefix_words(void); /* Completion is observed by polling a GPU-uncached word; the session never claims interrupt support. */ typedef enum { OMEGA_GPU_COMPLETION_POLLING = 1 } OmegaGpuCompletionMode; diff --git a/tests/.crumb b/tests/.crumb index 7832f925f..b6f9c56fe 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -296,14 +296,14 @@ } ], "children_root": "sha256:007780788467b076e31455e97b09ed7fb861af2e96184fd750995606dac0dc60", - "compiled_at": "2026-10-15T00:25:19Z", + "compiled_at": "2026-10-15T02:29:25Z", "compiler": "crumb-compile/1", - "digest": "sha256:8401c311b8d73c13a75937463ca173dba2af1a3e79fda3e126be4e1918f56436", + "digest": "sha256:94680b854341a6f363654ac26e2bc9a4eb99a62995e660da90c21f313cf77fe4", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", - "files": 1182, - "generated_at_commit": "6dd6b739360d4ac2f5f997a96b6f8b110951a0a1", - "source_tree": "sha256:d63ab817e1db8f8495a6745545d980db3e21e84764d6715978083babea6905cb" + "files": 1183, + "generated_at_commit": "0e028587d774a2864fb5ae3f95ab17a6613f369e", + "source_tree": "sha256:0ad3b4a705fc933075766b6d55bb78ccb544e5cbb0c3465c18470b6f544bad89" }, "owner_lane": "", "provenance": { diff --git a/tests/fake_m16_native.c b/tests/fake_m16_native.c index d8888e9fa..5adc437c6 100644 --- a/tests/fake_m16_native.c +++ b/tests/fake_m16_native.c @@ -20,6 +20,7 @@ FakeDriver fk; typedef struct { uint32_t handle; void *ptr; + uint64_t size; } LiveAlloc; static LiveAlloc g_live[FK_LIVE_MAX]; @@ -99,13 +100,14 @@ static int inject(Nvrm *rm, int rc) return rc; } -static void live_add(uint32_t handle, void *ptr) +static void live_add(uint32_t handle, void *ptr, uint64_t size) { size_t i; for (i = 0; i < FK_LIVE_MAX; i++) { if (g_live[i].handle == 0) { g_live[i].handle = handle; g_live[i].ptr = ptr; + g_live[i].size = size; fk.live++; return; } @@ -195,6 +197,21 @@ static void run_kernel(const uint32_t *q) *word_at(sem) = q[17] + (fk.sem_mode == FK_SYNC_OVERSHOOT ? 1u : 0u); } +/* SEND_PCAS_A carries the QMD address >> 8 in 32 bits (a 40-bit GPU address). The fake's GPU address is the host + * pointer, which can be wider: find the live allocation whose low 40 bits match. NULL if none does. */ +static const uint32_t *qmd_from_shifted8(uint32_t s8) +{ + const uint64_t low = (uint64_t)s8 << 8, mask40 = (1ull << 40) - 1u; + size_t i; + for (i = 0; i < FK_LIVE_MAX; i++) { + uint64_t base = (uint64_t)(uintptr_t)g_live[i].ptr, a = (base & ~mask40) | low; + if (g_live[i].handle == 0) continue; + if (a < base) a += 1ull << 40; + if (a >= base && a + 96u * 4u <= base + g_live[i].size) return (const uint32_t *)(uintptr_t)a; + } + return NULL; +} + /* Walks the submitted pushbuffer. exec == 0 only collects addresses (so the * state at the doorbell can be captured first); exec == 1 runs it. Every packet * is a header (type 2 or 6 in bits 31:28, count in 28:16, subchannel in 15:13, @@ -257,6 +274,11 @@ static void walk(const uint32_t *w, size_t n, int exec) logev(FK_EV_PB_QMD, qaddr, (launch && (q[9] & 1u) != 0) ? 1u : 0u, 0); if (launch && (q[9] & 1u) != 0) run_kernel(q); } + } else if (subc == 1u && mthd == 0x02b4u && cnt == 1u) { + /* SEND_PCAS_A (clcec0.h, QMD address >> 8): a standalone QMD the command list (src/omega_gpu_cmdlist.c) + * wrote to memory. Modelled only with FK_KERNEL_SKIP: the launch releases its completion semaphore. */ + const uint32_t *q = exec && fk.kernel_mode == FK_KERNEL_SKIP ? qmd_from_shifted8(d[0]) : NULL; + if (q && (q[9] & 1u) != 0) run_kernel(q); } else if (subc == 0u && mthd == 0x005cu && cnt == 5u) { uint64_t addr = ((uint64_t)d[1] << 32) | d[0]; uint32_t payload = d[2]; @@ -336,7 +358,7 @@ int nvrm_alloc(Nvrm *rm, uint64_t size, NvrmMem *out) out->size = size; out->cpu = p; out->va = (uint64_t)(uintptr_t)p; - live_add(out->handle, p); + live_add(out->handle, p, size); if (fk.alloc_size_n < FK_SIZE_LOG) fk.alloc_size_log[fk.alloc_size_n] = size; fk.alloc_size_n++; if (fk.alloc_calls >= 1 && fk.alloc_calls <= 16) fk.alloc_va[fk.alloc_calls - 1] = out->va; diff --git a/tests/fake_m16_native.h b/tests/fake_m16_native.h index bd17562bf..079da0b1b 100644 --- a/tests/fake_m16_native.h +++ b/tests/fake_m16_native.h @@ -38,7 +38,7 @@ #define FK_TEXT "fake driver says no" #define FK_EV_MAX 512 #define FK_SNAP_WORDS 256 -#define FK_PB_MAX 2048 +#define FK_PB_MAX 16384 /* the whole 64 KiB session ring (omega_gpu_cmdlist.c RING_WORDS), so a near-full command list fits */ /* Event kinds in the log (fk.ev). */ enum { diff --git a/tests/gpu_l2_stale_test.c b/tests/gpu_l2_stale_test.c new file mode 100644 index 000000000..f11c84ae7 --- /dev/null +++ b/tests/gpu_l2_stale_test.c @@ -0,0 +1,106 @@ +/* gpu_l2_stale_test: omega #457 regression test (chip). After the host rewrites a GPU-cached (CPU_WRITE | GPU_READ) buffer that the GPU has + * already read, does the next launch read the old bytes from GPU L2? + * + * Real path only: omega_gpu_fp8_tensor_upload (memcpy into the CPU mapping + omega_gpu_session_sync_to_gpu, which is + * a dsb sy and nothing else) and omega_gpu_fp8_gemv_f32 (one launch, C3 tail, output read back from uncached memory). + * One variable per process: --cached 0|1 (omega_gpu_fp8_set_weight_cache). --cached 0 is the negative control + * (uncached mapping: nvos.h:1117-1118 says only the cached case is not coherent with CPU mappings). + * + * Tensor: 1 expert x N=256 x K=2048 e4m3 (512 KB), scales bf16 1.0, x = 1.0. + * A = every weight +1.0 (0x38) -> every y = +2048. B = every weight -1.0 (0xB8) -> every y = -2048. + * Camera: a row's 2048 bytes are 16 lines of 128 B; a stale line adds +128 instead of -128, so + * stale_lines(row) = (y + 2048) / 256, exact in f32. Any other y is printed as UNDECODED. + * Modes: + * rewrite upload A, GEMV (GPU reads A), host memcpy B into the SAME buffer + sync_to_gpu, then GEMV x reps. + * realloc upload A, GEMV, free A, upload B (fresh buffer: VA printed, same-VA noted), then GEMV x reps. + * The first GEMV on A must read +2048 on every row: that shows the decode can see A's bytes at all. + * Exit 0 = FRESH, 1 = STALE_READ or API failure, 2 = usage. Red receipt (unfixed platform, omega 710d438c): rewrite + * --cached 1 read 4096 of 4096 lines stale on every launch, 5/5; --cached 0 FRESH 5/5. */ +#include "omega_gpu_fp8_api.h" +#include "omega_gpu_session.h" +#include <inttypes.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* Copied verbatim from omega src/omega_gpu_fp8_api.c:20-24 (frozen candidate, not modified). Checked at run time + * against the public omega_gpu_fp8_tensor_entry() VAs; a mismatch aborts. */ +struct OmegaGpuFp8Tensor { + uint32_t experts, n, k; + OmegaGpuMem w; /* experts * n * k e4m3 bytes, row-major */ + OmegaGpuMem s; /* experts * (n/128) * (k/128) f32 (scale * 2^56) */ +}; + +#define N 256u +#define K 2048u + +static int snap(const char *site, const float *y, float expect) { + uint32_t stale_rows = 0, stale_lines = 0, undecoded = 0; float lo = y[0], hi = y[0]; + for (uint32_t r = 0; r < N; r++) { + if (y[r] < lo) lo = y[r]; + if (y[r] > hi) hi = y[r]; + if (expect > 0) { if (y[r] != 2048.0f) undecoded++; continue; } + float s = (y[r] + 2048.0f) / 256.0f; + if (s != (float)(int)s || s < 0 || s > 16) { undecoded++; continue; } + if (s > 0) { stale_rows++; stale_lines += (uint32_t)s; } + } + printf("SNAP site=%s expected=%.0f rows=%u stale_rows=%u stale_lines=%u of %u undecoded=%u y_min=%.1f y_max=%.1f\n", + site, expect, N, stale_rows, stale_lines, N * 16u, undecoded, lo, hi); + if (undecoded) printf("SNAP site=%s y_row0=%.3f interpretation=UNDECODED\n", site, y[0]); + return expect > 0 ? (undecoded ? -1 : 0) : (int)(stale_lines + undecoded); +} + +int main(int argc, char **argv) { + const char *mode = NULL; int cached = -1; uint32_t reps = 3; + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--mode") == 0 && i + 1 < argc) mode = argv[++i]; + else if (strcmp(argv[i], "--cached") == 0 && i + 1 < argc) cached = atoi(argv[++i]); + else if (strcmp(argv[i], "--reps") == 0 && i + 1 < argc) reps = (uint32_t)atoi(argv[++i]); + else { printf("usage: %s --mode rewrite|realloc --cached 0|1 [--reps R]\n", argv[0]); return 2; } + } + if (!mode || (strcmp(mode, "rewrite") && strcmp(mode, "realloc")) || (cached != 0 && cached != 1) || reps == 0 || reps > 64) { + printf("usage: %s --mode rewrite|realloc --cached 0|1 [--reps R]\n", argv[0]); return 2; + } + (void)omega_gpu_session_set_spin_us(2000); + omega_gpu_fp8_set_weight_cache(cached); + printf("RUN mode=%s cached=%d weight_cache_now=%d n=%u k=%u reps=%u\n", mode, cached, omega_gpu_fp8_weight_cache(), N, K, reps); + + uint8_t *wa = malloc((size_t)N * K), *wb = malloc((size_t)N * K); + uint16_t sc[(N / 128) * (K / 128)]; float x[K], y[N]; + memset(wa, 0x38, (size_t)N * K); memset(wb, 0xB8, (size_t)N * K); + for (size_t i = 0; i < sizeof sc / sizeof sc[0]; i++) sc[i] = 0x3F80; + for (uint32_t i = 0; i < K; i++) x[i] = 1.0f; + + OmegaGpuFp8Tensor *t = NULL; + int rc = omega_gpu_fp8_tensor_upload(1, N, K, wa, sc, &t); + if (rc != OMEGA_GPU_FP8_OK) { printf("FAIL upload A: %s\n", omega_gpu_fp8_last_error()); return 1; } + uint64_t wva = 0, sva = 0; + if (omega_gpu_fp8_tensor_entry(t, 0, &wva, &sva) != 0 || wva != t->w.va || sva != t->s.va || !t->w.cpu) { + printf("FAIL mirror struct does not match omega (entry w_va 0x%" PRIx64 " vs mirror 0x%" PRIx64 ")\n", wva, t->w.va); return 1; + } + const uint64_t va_a = t->w.va; + memset(y, 0, sizeof y); + if ((rc = omega_gpu_fp8_gemv_f32(t, 0, x, y, NULL)) != OMEGA_GPU_FP8_OK) { printf("FAIL gemv A: %s\n", omega_gpu_fp8_last_error()); return 1; } + if (snap("gemv-A", y, 2048.0f) != 0) { printf("STALE verdict=INVALID reason=first read of A is not +2048 (decode cannot see A)\n"); return 1; } + + if (strcmp(mode, "rewrite") == 0) { + memcpy(t->w.cpu, wb, (size_t)N * K); /* what omega_gpu_fp8_tensor_upload does, on the same buffer */ + if (omega_gpu_session_sync_to_gpu(&t->w) != 0) { printf("FAIL sync: %s\n", omega_gpu_session_last_error()); return 1; } + printf("HOST rewrote w (va 0x%" PRIx64 ") with B and synced\n", va_a); + } else { + omega_gpu_fp8_tensor_free(t); t = NULL; + if ((rc = omega_gpu_fp8_tensor_upload(1, N, K, wb, sc, &t)) != OMEGA_GPU_FP8_OK) { printf("FAIL upload B: %s\n", omega_gpu_fp8_last_error()); return 1; } + printf("HOST freed A (va 0x%" PRIx64 "), uploaded B at va 0x%" PRIx64 " same_va=%s phys=UNKNOWN reason=no physical address in the API\n", + va_a, t->w.va, t->w.va == va_a ? "yes" : "no"); + } + uint32_t total = 0; + for (uint32_t r = 0; r < reps; r++) { + char site[32]; snprintf(site, sizeof site, "gemv-B-%u", r + 1); + for (uint32_t i = 0; i < N; i++) y[i] = 12345.0f; + if ((rc = omega_gpu_fp8_gemv_f32(t, 0, x, y, NULL)) != OMEGA_GPU_FP8_OK) { printf("FAIL gemv B: %s\n", omega_gpu_fp8_last_error()); return 1; } + total += (uint32_t)snap(site, y, -2048.0f); + } + printf("STALE mode=%s cached=%d stale_or_undecoded_lines_total=%u verdict=%s\n", mode, cached, total, total ? "STALE_READ" : "FRESH"); + omega_gpu_fp8_tensor_free(t); free(wa); free(wb); + return total ? 1 : 0; +} diff --git a/tests/test_omega_gpu_platform_linux.c b/tests/test_omega_gpu_platform_linux.c index 0fae39ab1..c568222df 100644 --- a/tests/test_omega_gpu_platform_linux.c +++ b/tests/test_omega_gpu_platform_linux.c @@ -12,6 +12,8 @@ #include "fake_m16_native.h" #include "nvrm.h" #include "omega_blackwell_submit.h" +#include "omega_gpu_cmdlist.h" +#include "omega_gpu_mem_cached.h" #include "omega_gpu_platform_linux.h" #include "omega_gpu_session.h" @@ -161,6 +163,83 @@ static void c_marker_never_latches(void) { EXPECT(ps.buffers == 4); } +/* omega #457: the L2_SYSMEM_NCOH_INVALIDATE prefix, MEM_OP_A..D = 0, 0, 0, 0x11 << 27 (clc96f.h:30-73). The fake logs + * every MEM_OP as FK_EV_PB_FLUSH with a = the operation word. */ +#define L2_INVAL_OP (0x11u << 27) +static int count_l2_inval(void) { + int n = 0; + for (int i = 0; i < fk.nev; i++) n += fk.ev[i].kind == FK_EV_PB_FLUSH && fk.ev[i].a == L2_INVAL_OP; + return n; +} + +static void c_l2_inval_prefix_once(void) { + fake_reset(); + fk.kernel_mode = FK_KERNEL_SKIP; + OmegaGpuPlatformCaps caps; + (void)omega_gpu_platform_linux(&caps); + EXPECT(caps.submit_prefix_words == 5u); /* the cost the platform publishes is the prefix it writes */ + omega_gpu_session_lock(); + OmegaGpuSession *s = omega_gpu_session_open(); + EXPECT(s != NULL); + if (!s) { omega_gpu_session_unlock(); return; } + const OmegaGpuPlatform *p = omega_gpu_session_platform(); + OmegaGpuMem cached; + EXPECT(omega_gpu_session_alloc_cached(4096, &cached) == 0); + OmegaGpuLaunch L = launch_desc(1000); + EXPECT(omega_gpu_session_launch(&L, NULL, NULL) == 0); + EXPECT(count_l2_inval() == 0); /* no host write into a GPU-cached buffer yet: no prefix */ + const size_t plain = fk.pb_len; + EXPECT(p->sync_cpu_to_gpu(p->ctx, s->marker.handle, 0, 4) == OMEGA_GPU_PLAT_OK); /* an uncached buffer: no prefix */ + EXPECT(omega_gpu_session_launch(&L, NULL, NULL) == 0); + EXPECT(count_l2_inval() == 0 && fk.pb_len == plain); + EXPECT(p->sync_cpu_to_gpu(p->ctx, cached.handle, 0, 4096) == OMEGA_GPU_PLAT_OK); + EXPECT(omega_gpu_session_launch(&L, NULL, NULL) == 0); + EXPECT(count_l2_inval() == 1); /* exactly once, at the head of the next submission */ + EXPECT(fk.pb_len == plain + 5u); + EXPECT(fk.pb[0] == ((2u << 28) | (4u << 16) | (0x0028u >> 2)) && fk.pb[1] == 0 && fk.pb[2] == 0 && fk.pb[3] == 0 && + fk.pb[4] == L2_INVAL_OP); + EXPECT(omega_gpu_session_launch(&L, NULL, NULL) == 0); + EXPECT(count_l2_inval() == 1 && fk.pb_len == plain); /* consumed: the launch after it has none */ + EXPECT(p->sync_gpu_to_cpu(p->ctx, cached.handle, 0, 4096) == OMEGA_GPU_PLAT_OK); /* GPU to CPU is no host write */ + EXPECT(omega_gpu_session_launch(&L, NULL, NULL) == 0); + EXPECT(count_l2_inval() == 1 && fk.pb_len == plain); + EXPECT(fk.pb_parse_error == 0 && fk.ev_overflow == 0); + omega_gpu_session_unlock(); +} + +/* Fable review of omega #459: a stamped standalone list of >= 1167 launches filled one submission to 16381 words; with + * the 5-word prefix pending that is 16386 > 16384 ring words, refused BAD_LENGTH on every retry. The command list must + * budget the prefix the platform publishes (caps.submit_prefix_words). */ +static void c_cmdlist_near_cap_with_l2_inval_pending(void) { + fake_reset(); + fk.kernel_mode = FK_KERNEL_SKIP; + fk.alloc_max = 4u << 20; /* the 2048-launch bank and QMD buffers are 2 MiB each */ + OmegaGpuCmdList *cl = NULL; + EXPECT(omega_gpu_cmdlist_create(OMEGA_GPU_CMDLIST_MAX_LAUNCHES, &cl) == 0); + if (!cl) { printf(" %s\n", omega_gpu_session_last_error()); return; } + omega_gpu_session_lock(); + OmegaGpuLaunch L = launch_desc(1000); + for (uint32_t i = 0; i < OMEGA_GPU_CMDLIST_MAX_LAUNCHES; i++) EXPECT(omega_gpu_cmdlist_add(cl, &L) == (int)i); + const OmegaGpuPlatform *p = omega_gpu_session_platform(); + OmegaGpuMem cached; + EXPECT(omega_gpu_session_alloc_cached(4096, &cached) == 0); + EXPECT(p->sync_cpu_to_gpu(p->ctx, cached.handle, 0, 4096) == OMEGA_GPU_PLAT_OK); /* the prefix is now pending */ + const int submits0 = fk.submit_calls; + OmegaGpuCmdListOpts o = { .mode = OMEGA_GPU_CMDLIST_PCAS, .barrier = OMEGA_GPU_CMDLIST_BARRIER_WFI, .timeout_ms = 1000, .stamps = 1 }; + OmegaGpuCmdListStats st; + const int rc = omega_gpu_cmdlist_submit(cl, &o, &st); + if (rc != 0) printf(" cmdlist submit: %s (platform: %s)\n", omega_gpu_session_last_error(), p->diag_text(p->ctx)); + EXPECT(rc == 0); + EXPECT(st.sems_done == OMEGA_GPU_CMDLIST_MAX_LAUNCHES && st.first_missing == -1); + EXPECT(st.submits == 2 && fk.submit_calls - submits0 == 2); + EXPECT(count_l2_inval() == 1); /* the first submission only */ + for (int i = 0; i < fk.nev; i++) + if (fk.ev[i].kind == FK_EV_SUBMIT) EXPECT(fk.ev[i].a * 4u <= fk.pb_mem_size); /* prefix included, inside the ring */ + EXPECT(fk.pb_parse_error == 0 && fk.ev_overflow == 0); + EXPECT(!omega_gpu_session_is_blocked() && !omega_gpu_cmdlist_is_latched()); + omega_gpu_session_unlock(); +} + typedef struct { const char *id; void (*fn)(void); } Case; static const Case CASES[] = { {"LINUX_REF_CAPS_NO_MMIO_NO_IRQ", c_caps}, @@ -169,6 +248,8 @@ static const Case CASES[] = { {"REFERENCE_REFUSALS_CACHED_POLLED_RING_STALE", c_reference_refusals}, {"OPEN_FAILURE_KEEPS_DRIVER_TEXT", c_open_failure_text}, {"MARKER_NEVER_LATCHES_AND_PARKS", c_marker_never_latches}, + {"L2_INVAL_PREFIX_ONCE_AFTER_CACHED_HOST_WRITE", c_l2_inval_prefix_once}, + {"CMDLIST_NEAR_CAP_SUBMITS_WITH_L2_INVAL_PENDING", c_cmdlist_near_cap_with_l2_inval_pending}, }; int main(void) { diff --git a/tools/.crumb b/tools/.crumb index 2fb6e8215..b30623b28 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -50,7 +50,7 @@ }, { "digest": "b91acbb0b29060651bc17dc79406adeb9376748f4d4a3005175cd307aa52b9c8", - "last_commit": "", + "last_commit": "dd67f6bd", "name": "reservoir", "purpose": "Gate 2 tooling for the reservoir (omega#440): in-house zlib inflate and MAT v5 reader, the archi" }, @@ -62,14 +62,14 @@ } ], "children_root": "sha256:e1f826c2beb8604bb0dcba49575f7c6b48cf5488c40b616b212fda2ed70c62ee", - "compiled_at": "2026-10-14T21:46:29Z", + "compiled_at": "2026-10-15T01:26:44Z", "compiler": "crumb-compile/1", - "digest": "sha256:84e7502fdc66e65c9c94ffaa834cc53aec818ee3215716ba98926cf1c70bcca8", + "digest": "sha256:61e2f6659e703f6e943059dc77af397dedc7951f146cf2a3a65c7c184eed316b", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 165, - "generated_at_commit": "2a6d6d7b9091bd2184b15dcde893035dbcca40d3", - "source_tree": "sha256:163386bc23529fbe9000dab6ba742deaffb524e8e65cb2c8f3a10674b9a1e743" + "files": 166, + "generated_at_commit": "68725b10b43803c097b7ac261e0caa703b62458a", + "source_tree": "sha256:abdf594ff6042475b39f57684c8c0205138fd9e9fbcb8cb426c07f2441d44d0f" }, "owner_lane": "", "provenance": { diff --git a/tools/run_gpu_l2_stale_chip.sh b/tools/run_gpu_l2_stale_chip.sh new file mode 100755 index 000000000..6f2c9a52f --- /dev/null +++ b/tools/run_gpu_l2_stale_chip.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# run_gpu_l2_stale_chip.sh EVIDENCE_DIR [PHYSICS_DIR] +# omega #457 chip gate: after the host rewrites a GPU-cached (CPU_WRITE | GPU_READ) buffer the GPU already read, the next +# launches must read the new bytes. tests/gpu_l2_stale_test.c, 5 rounds of 4 cases: +# rewrite --cached 1 the case under test (unfixed platform: 4096 of 4096 lines stale on every launch, 5/5) +# rewrite --cached 0 negative control (uncached mapping, nvos.h:1117-1118): FRESH on any platform +# realloc --cached 0|1 free + fresh upload: FRESH on any platform +# Every case first proves the GEMV sees A's bytes (+2048 on every row) before judging B. +# Caller holds the GB10 lock: flock /tmp/aien-gb10.lock tools/run_gpu_l2_stale_chip.sh EVID +# Verdict line last: "GPU_L2_STALE_CHIP: PASS|FAIL". PASS = all 20 runs FRESH (exit 0). +set -u +EVID="${1:?evidence dir}"; PHYS="${2:-$HOME/workspace/physics-own30b-k}" +HERE="$(cd "$(dirname "$0")/.." && pwd)" +mkdir -p "$EVID" +cd "$HERE" || exit 2 +{ + echo "start $(date -u +%FT%TZ) omega=$(git rev-parse HEAD) branch=$(git rev-parse --abbrev-ref HEAD) dirty=$(git status --porcelain | wc -l) physics=$PHYS physics_commit=$(git -C "$PHYS" rev-parse HEAD) physics_lock=$(cat physics.lock 2>/dev/null | head -1)" + uname -a; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null; free -g | head -2 +} > "$EVID/device.txt" +make PHYSICS_DIR="$PHYS" -j10 build/gpu_l2_stale_test > "$EVID/build.log" 2>&1 || { echo "GPU_L2_STALE_CHIP: FAIL build"; exit 1; } +T=./build/gpu_l2_stale_test +fail=0 +for r in 1 2 3 4 5; do for m in rewrite realloc; do for c in 0 1; do + f="$EVID/$m-c$c-r$r.log" + $T --mode "$m" --cached "$c" --reps 3 > "$f" 2>&1; e=$? + echo "# exit $e" >> "$f" + [ "$e" = 0 ] || fail=1 + echo "r$r $(grep -h '^STALE\|INVALID\|^FAIL' "$f" | tail -1) exit=$e" +done; done; done | tee "$EVID/summary.txt" +grep -q 'exit=[^0]' "$EVID/summary.txt" && fail=1 +( cd "$EVID" && sha256sum device.txt build.log summary.txt *-r*.log > SHA256SUMS ) +if [ $fail = 0 ]; then echo "GPU_L2_STALE_CHIP: PASS"; else echo "GPU_L2_STALE_CHIP: FAIL"; exit 1; fi