Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/docs/perf/DECODE_GRAPH_RECEIPT.md # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / docs / perf / DECODE_GRAPH_RECEIPT.md` 133 lines ยท 8860 bytes Raw Blame History Rendered 1 # Decode-graph performance receipt (`omega-decode-graph-receipt/1`) 2 3 Lane P1 of aien-architecture#233. `tools/dgraph_receipt.c` turns one existing run of the decode-graph 4 chip test into one machine-readable receipt bound to the commit that was measured, and checks such 5 receipts. It reads files only: no GPU, no `libomega_gpu`, no new counters. This change does not touch 6 GPU numerics, barriers, prefetch, submission, memory ownership or any hot path: it only reads the 7 numbers that `omega_gpu_decode_graph` and `gpu_decode_graph_test` already produce. 8 9 ## Where the numbers come from 10 11 | receipt field | source | clock | 12 |---|---|---| 13 | `per_token.graph.launches` | `OmegaGpuDecodeGraphStats.launches`: "launches recorded for the token" | count | 14 | `per_token.graph.submits` | `.submits`: "submissions (1 normally; = launches with flush_each)" | count | 15 | `per_token.graph.chip_ns` | `.chip_ns`: "sum of the list submissions' first-submit-to-last-marker time" | **host** | 16 | `per_token.graph.record_ns` | `.record_ns`: "host: begin_token to the submit (recording)" | host | 17 | `per_token.graph.total_ns` | `.total_ns`: "host: begin_token to end_token return" | host | 18 | `per_token.graph.sems_done` | `.sems_done`: "launch semaphores found DONE" (not written by the test: `null` + note) | count | 19 | `per_token.graph.host_overhead_ns` | derived: `total_ns - chip_ns` | host | 20 | `stamped_token.span_ns`, `stages[].device_ns` | `omega_gpu_decode_graph_stamps()`: "Launch i took stamps[i + 1] - stamps[i] ns" | **device** (PTIMER) | 21 | `stamped_token.chip_ns` | the stamped token's `.chip_ns` | host | 22 | `stamped_token.unattributed_ns` | derived: `chip_ns - span_ns` | host minus device | 23 | `per_token.flush_each.*` | the same list submitted one launch per submission (TEST ONLY `set_flush_each`) | as above | 24 25 Quotes are from `src/omega_gpu_decode_graph.h`. The stats are copied from the `--out` JSON of 26 `tests/gpu_decode_graph_test.c`; the run's barrier, prefetch and cached-weights settings from its log 27 ("dgraph prefetch" and "fp8 knobs" lines); commit, dirty flag, host and GPU from the runner's 28 `device.txt`; binary identity from `binaries.sha256`. 29 30 ### Host clock vs device clock 31 32 - **`chip_ns` is host time, not device time.** `omega_gpu_cmdlist_submit()` reads the platform clock 33 (`omega_gpu_session_now_ns()`, `CLOCK_MONOTONIC` on Linux, `omega_gpu_platform_linux.c`) just before 34 `queue_submit` and again after both completion-marker words were seen and synced. It holds the device 35 work plus the submit call, the front-end start and the host's marker poll. 36 - **The device clock appears only with stamps on.** `set_stamps(1)` writes a GPU PTIMER timestamp 37 before the first launch and after every launch, "taken after its WAIT_FOR_IDLE" 38 (`omega_gpu_cmdlist.h`). The test runs one extra token this way; its `span_ns` is device time and 39 always fits inside that token's host `chip_ns` (the checker enforces `span_ns <= chip_ns`). 40 - `unattributed_ns = chip_ns - span_ns` is the part of the host submit span the device stamps do not 41 cover. 42 - `host_overhead_ns = total_ns - chip_ns`: host work outside the submit span (recording, the attention 43 counter check, output sync, token read, lock). 44 45 ### Serial vs overlapping time 46 47 - `chip_ns` is a serial sum: one host span per submission, and submissions never overlap. A graph 48 token is one submission; a `flush_each` token is one per launch. 49 - With prefetch off, every barrier mode except the TEST ONLY `none` puts a WAIT_FOR_IDLE before each 50 stamp, so launches run one after another. The stage times are a serial partition of `span_ns`: they 51 add up to it exactly (the checker enforces `stage_sum_ns == span_ns`). 52 - With prefetch on (`AIEN_OMEGA_DGRAPH_PREFETCH=1`), each layer adds one o_proj prefetch launch marked 53 independent (no barrier before it) and tagged `attn`. Its stamp is the front-end time while the 54 attention may still be running. So the `attn` stage is the attention-plus-prefetch window. Overlap 55 is **visible but not measurable**: no counter splits that window. 56 - `overlap_measurable` is `false` in every receipt this tool writes, and the `reason` field says why. 57 58 ## Statuses 59 60 `VERIFIED | EXPERIMENTAL | HISTORICAL | NOT_RUN | FAIL | SUPERSEDED`. Receipts rebuilt from old 61 evidence logs are **HISTORICAL**: the chip was not run to make them. `VERIFIED` needs a clean tree and a 62 PASS run. `EXPERIMENTAL` needs a PASS run. Neither is allowed with `hardware.gpu` `none_detected` (what the 63 generator writes when `nvidia-smi` found no GPU). `NOT_RUN` carries `per_token: null`, `stamped_token: null` and 64 a `not_run_reason`, so it holds no numbers. 65 66 ## Making a receipt from a run 67 68 From the repo root, after `make dgraph-receipt`: 69 70 ``` 71 build/dgraph_receipt/dgraph_receipt \ 72 --run-dir evidence/OWN30B-REQUAL-MAIN-`710d438c`-`20261015`/gates/decode_graph \ 73 --stats evidence/OWN30B-REQUAL-MAIN-`710d438c`-`20261015`/gates/decode_graph/receipt-main.json \ 74 --log evidence/OWN30B-REQUAL-MAIN-`710d438c`-`20261015`/gates/decode_graph/main.log \ 75 --status HISTORICAL --repo aien-spark/omega \ 76 --model "synthetic Qwen3-30B-A3B-shaped decode step, random weights" \ 77 --precision "FP8 e4m3 weights (qkv, o, gate_up, down), BF16 lm_head, f32 activations" \ 78 --mode "decode, one token per command list (omega_gpu_decode_graph_token), batch 1" \ 79 --runner "tools/run_gpu_decode_graph_chip.sh EVIDENCE_DIR main" \ 80 --out receipt.json 81 build/dgraph_receipt/dgraph_receipt --check receipt.json --evidence-root . 82 ``` 83 84 The generator runs the checker on its own output first and refuses to write a receipt the checker 85 rejects. It also refuses a log that lacks the run's settings and a stats file and log from different 86 runs. The exact commands behind the golden fixtures are in `tests/dgraph_receipt/run.sh`. 87 88 ## What the checker rejects 89 90 Missing fields, wrong types, unknown top-level fields, a schema other than `/1`, a status outside the 91 enum, a commit that is not 40 lowercase hex digits, a non-`OWNER/NAME` repo, placeholder strings 92 anywhere (`""`, `TBD`, `unknown`, `TODO`, `N/A`, `none`, ...), zero tokens, derived numbers that do not 93 match their inputs (`host_overhead_ns`, `unattributed_ns`, `stage_sum_ns`), stages that do not add up to 94 `span_ns` or whose sums overflow 64 bits, `span_ns > chip_ns`, `sems_done` neither equal to `launches` nor 95 `null` with a note, `VERIFIED` on a dirty tree, `VERIFIED` or `EXPERIMENTAL` with no detected GPU, 96 measurements on a `NOT_RUN` receipt, absolute or `..` evidence paths, and, 97 with `--evidence-root`, evidence paths that do not exist. `make test-dgraph-receipt` proves each rule 98 with a fixture in `tests/dgraph_receipt/fixtures/` (table: `tests/dgraph_receipt/negatives.txt`). 99 100 ## Reproduced numbers (HISTORICAL) 101 102 These are the only numbers here. They are copies of existing evidence, not new claims: 103 104 - `tests/dgraph_receipt/fixtures/good-historical-`710d438c`-main.json`, from 105 `evidence/OWN30B-REQUAL-MAIN-`710d438c`-`20261015`/gates/decode_graph/` (omega `710d438c`, clean tree, GB10, 106 2 layers, 20 tokens, prefetch off). Per-token medians: 22 launches in 1 submission, total 3 978 675 ns, 107 chip (host clock) 3 975 395 ns, record 2 464 ns. Stamped token: device span 3 989 568 ns inside a host 108 chip span of 4 076 853 ns. 109 - `tests/dgraph_receipt/fixtures/good-historical-`710d438c`-prefetch.json`, from 110 `evidence/OWN30B-REQUAL-MAIN-`710d438c`-`20261015`/gates/l2d_prefetch/` run `4-cached-prefetch` (cached 111 weights, prefetch on, 10 tokens, 24 launches). 112 113 ## Limitations 114 115 - Synthetic step on random weights, one fixed position, the same token every rep: this is not a 116 serving or end-to-end tokens-per-second figure. 117 - Per-token values are medians taken field by field, so `host_overhead_ns` is a difference of medians. 118 - The stamped token is one sample. 119 - No aggregate totals or percentiles: the test writes medians only. 120 - When `make` did not rebuild the test, `build.log` has no compile line. The receipt then says so and 121 names the binary by sha256. 122 123 ## Gaps (counters that do not exist; none added here) 124 125 - `sems_done` per token: the test's `--out` writer (`tests/gpu_decode_graph_test.c`) does not write it. 126 - The method-stream build time: `OmegaGpuCmdListStats.host_ns` is filled by `omega_gpu_cmdlist_submit()`, 127 but `submit_now()` in `src/omega_gpu_decode_graph.c` does not add it to `OmegaGpuDecodeGraphStats`. 128 - Submit call vs wait inside `chip_ns`: `omega_gpu_cmdlist_submit()` times `queue_submit` through the 129 marker poll as one span. Splitting them needs a clock read after `queue_submit` returns. 130 - Per-token distributions: `gpu_decode_graph_test` keeps the per-rep arrays but writes only 131 `median_u64()` of each. 132 - Attention vs prefetch inside the overlapped window: with an independent launch, `omega_gpu_cmdlist_submit()` 133 emits the stamp before it with no WAIT_FOR_IDLE, so no stamp marks the end of the attention alone.