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
omega-mv / evidence / OWN30B-REQUAL-MAIN-710d438c-20261015 / omega457 / plan.md
| 1 | # Plan (omega #457) |
| 2 | DOCS READ: nvos.h:1117-1118 "YES - Enable gpu caching if supported on this surface type. For system memory this will not be coherent with direct CPU mappings." clc96f.h:73 L2_SYSMEM_NCOH_INVALIDATE 0x11 (no comment). DOCS SILENT on whether the next launch sees a host write to a GPU-cached sysmem buffer without an L2 invalidate. |
| 3 | QUESTION (one line): after the host rewrites a GPU-cached (CPU_WRITE|GPU_READ) buffer the GPU already read, does the next launch read the old bytes from L2? |
| 4 | OUR CODE: omega src/omega_gpu_mem_cached.c (alloc GPU_CACHED), omega_gpu_platform_linux.c:180-187 (comment: written once before any GPU read), ref_sync = dsb sy only (:233-241). Only user: omega_gpu_fp8_api.c:268 (AIEN_OMEGA_FP8_WEIGHT_CACHE=1). |
| 5 | SMALLEST REPRO: src/l2_stale_test.c on the real FP8 GEMV path. Tensor 1 expert x 256 x 2048 (512 KB, L2-sized), scales 1.0, x = 1.0. |
| 6 | A = all weights e4m3 +1.0 (0x38) -> y = +2048 per row. B = all -1.0 (0xB8) -> y = -2048. |
| 7 | CAMERA: y decodes exactly into stale 128-byte lines per row: stale_lines = (y + 2048) / 256 (16 lines per row). |
| 8 | VARIANTS (one variable: cache policy; each run is one process): |
| 9 | rewrite: upload A, GEMV (GPU reads A), host memcpy B into the same buffer + sync_to_gpu (what upload does), GEMV, decode. |
| 10 | realloc: upload A, GEMV, free, upload B (new buffer, VA printed, same-VA noted), GEMV, decode. |
| 11 | each run under cached=0 (NEGATIVE CONTROL: uncached mapping, must read 0 stale) and cached=1; 5 runs each. |
| 12 | Instrument-can-say-yes check: the first GEMV on A must give +2048 (if the decode is broken it cannot show A). |
| 13 | RULES: candidate untouched (repro lives here, links the frozen build/libomega_gpu.a); no chip kill; GB10 lock + quiet hold. |
| 14 | ## Deviations |
| 15 | - PINS first recorded scaffold defaults; corrected (appended) to omega-requal-main 710d438c clean, physics 6d7cf0d4 clean. |
| 16 | - After the answer (YES) a fix candidate was built in a separate worktree (~/workspace/omega-457-fix, branch fix/457-l2-inval-after-host-write) |
| 17 | and measured as one variable (variant=fix). It is proposed, not merged here. |
| 18 | ## Result |
| 19 | ANSWER: YES. A host rewrite of a GPU-cached buffer the GPU already read is NOT seen by later launches. |
| 20 | BASELINE (variant=baseline, lib 6a6cb4df = omega main archive, runs/summary.txt): |
| 21 | rewrite cached=1: STALE_READ 5/5, 4096 of 4096 lines stale on each of 3 launches after the rewrite (y = +2048, want -2048) [OBSERVED runs/rewrite-c1-r*.log] |
| 22 | rewrite cached=0 (negative control): FRESH 5/5. realloc cached=0|1: FRESH 5/5 each (same VA 0x1004133000 reused; phys UNKNOWN). |
| 23 | Instrument can say yes: gemv-A read +2048 on all 256 rows in every run. |
| 24 | VARIANT fix (lib 8b7c0678, fix-variant.diff: pending L2_SYSMEM_NCOH_INVALIDATE at the start of the next submission after |
| 25 | sync_cpu_to_gpu on a GPU-cached buffer): 20/20 FRESH, incl. rewrite cached=1 5/5 (runs/summary-fix.txt). |
| 26 | REGRESSION GATE tools/run_gpu_l2_stale_chip.sh: red on unfixed 710d438c = FAIL (rewrite c1 STALE_READ 5/5, others FRESH 15/15, |
| 27 | gate-red/); green on fix = PASS 20/20 (gate-fix/). Same base 710d438c, one variable (platform change). |
| 28 | NO-REGRESSION on fix: fp8, decode_graph cached, cmdlist chip gates PASS (fixgates/). |
| 29 | LIMITS: one tensor shape (512 KB, L2-sized); fp8 GEMV path only; production code today writes cached weights once before any |
| 30 | GPU read, so no live corruption was observed; realloc FRESH does not prove RM invalidates at free (DOCS SILENT). |