interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / evidence / ARGUS / speed2 / SPEED2.md

141 lines · 10887 bytes Raw Blame History Rendered
1# ARGUS producer speed round 2 (feat/argus-producer, 2026-09-29)
2
3Base: 20e84b8 (producer v1.1 746b30b + H2 evidence). Result: 265b1c5 + this evidence.
4Host: GB10 Spark, X925 = CPUs 5-9,15-19, A725 = 0-4,10-14; gcc 13.3.0; kernel 7.0.0-1019-nvidia;
5perf_event_paranoid=1. ARGUS pinned at aienos feat/argus-0 b375dca (header unchanged, not edited).
6Every benchmark ran under `flock ~/workspace/.argus-bench.lock`; `.spark-quiet` was absent before each run.
7Caveat: another session was compiling (a cc1 process at about 100% CPU) during the final R8 runs.
8Interleaving with rotated order spreads that load over all configs, but absolute ms are slightly inflated.
9
10## Bar (fixed before measuring, unchanged)
11PASS = mean <= 5% loss on the micro-op median throughput AND mean <= 5% on R8 wall clock. If the 95% CI
12straddles 5%, add rounds until the half-width is <= 1%. Reported against the lane's 5% and the ADR 0017 2% target.
13
14## Profile (pre-fix build 20e84b8; tools/argus/r8_perthread.sh, r8_leaf.awk, r8_offcpu.awk)
15Q1. Does the consumer share cores with the workload? (perf record -s per-thread counts, 20 interleaved rounds,
16raw/perthread-base*.) All threads ran on the X925 cores (the A725 PMU counted 0).
17| per run | off | discard | ingest |
18|---|---|---|---|
19| main thread cycles / instructions | 57.2M / 127M | 61.5M / 148M | 60.6M / 147M |
20| main thread CPU time | 15.75 ms | 16.83 ms | 16.61 ms |
21| worker cycles (all worker threads) | 27.8M | 26.4M | 28.9M |
22| worker migrations | 14.3 | 25.4 | 20.6 |
23| consumer cycles / CPU time | - | 4.5M / 1.4 ms | 8.7M / 2.5 ms |
24Worker CPU is flat, so the consumer does not steal CPU from the workers. It does disturb scheduling:
25worker migrations rise, and so does lock waiting on the critical path (below).
26
27Q2. Where does the main thread (R8's serial critical path) lose time? Samples of main-thread cycles and
28instructions, and off-CPU time by blocking site (20 and 15 runs, raw/main-leaf-*, raw/main-offcpu-before-*):
29- On-CPU +3.0-3.5M cycles (~0.9 ms). About 1.4M of it is R8's own receipt: binary_digest() SHA-256s
30 /proc/self/exe, and the ARGUS build is 70 KB larger (149 KB -> 220 KB): 3.1M -> 4.5M cycles = ~1.1% of R8 wall.
31 It is present in emit-only mode too. It is a harness cost and was NOT changed. The rest: mutex atomics
32 (+0.7-1.1M), the use hook (+0.1M), kernel (+0.5M).
33- Off-CPU +1.1 ms, mostly the main thread waiting for w->mu in rx_world_publish_external
34 (4.27 ms off, 5.00 discard, 4.62 ingest; 507 -> 559 waits) and rx_argus_shutdown joining the sleeping
35 consumer (+0.12 ms). The capability checks run under w->mu (validate_caps, publish_external). So did the
36 park-time ARGUS flush (rx_world.c:1299).
37- The 50 posix_spawn()s (9.5 ms) are unchanged (raw/r8-spawn-phase.txt). The growth is in the other ~26 ms.
38
39Q3 (control, same session): emit-only / discard / ingest measured in every R8 run below, not inferred.
40
41Verdict: the remaining cost does not come from lock work or SHA-256 on the workers. It is (1) the consumer
42sharing the workload's cores, which shows up as worker migrations and longer w->mu waits on the main thread,
43and (2) a fixed ~1.1% harness cost from hashing a larger executable. The in-process SHA-256 chain (ingest
44vs discard) is about 0.5-0.8%.
45
46## Fixes (cheapest first, per the ladder)
47- b. Flush after unlock (110faaf): the park-time flush now runs outside w->mu, only when one is due, once
48 per park, and re-checks work after relocking. Flush-before-transition is unchanged. On its own it gave no
49 measurable gain: ingest +5.18% -> +5.04% (200 paired rounds, raw/r8-ab-200*). It is kept as a shorter
50 critical section. The main-thread off-CPU rerun (raw/main-offcpu-afterb-*) was too noisy at 15 runs to show a change.
51- a. Consumer placement (ec87160), tested after (b) failed. Q1 had first ruled it out on worker CPU, but the
52 migration signal re-opened it. Discriminating run, 200 rounds: ingest with the consumer pinned outside R8's
53 mask (CPU 2): +3.10% [+2.29, +3.91]; pinned onto an R8 core (CPU 9): +5.08%. So the cost is scheduling on
54 shared cores. Shipped as RX_ARGUS_CONSUMER_CPU:
55 - auto (default): pin to the online CPUs outside the process affinity mask at start, if any; otherwise unpinned.
56 - none: never pin.
57 - a CPU list: pin exactly there.
58 Failures are reported and never fatal. The summary records consumer_cpu and consumer_pin_rc.
59 Deployment requirement: give the consumer a core the workload does not use; a taskset workload gets that automatically.
60 Mechanism check (30 rounds, raw/perthread-final*): workers off 18.9M cycles / 1,880 context switches /
61 12.5 migrations; auto 22.9M / 2,175 / 13.5; unpinned 30.3M / 4,044 / 20.2. The consumer runs on the A725s.
62- c. Batch the SHA-256 chain: not applicable. By the ABI every well-formed event extends the chain
63 (argus_abi.h, argus_core.c step 6), and the hash runs inside argus_core_ingest in pinned ARGUS code. The
64 consumer's own per-event path is already a copy, a stream write if enabled, and the ingest call. Ingest vs
65 discard is ~0.5-0.8%.
66- Not done (boundaries): consumer out of process (ADR change); sampling or dropping USED; raising ARGUS_USE_FLUSH_OPS.
67 None was needed for 5%.
68
69## Final numbers (build 265b1c5)
70R8 wall clock (whole process, taskset 5-9,15-19, rotating interleave, paired per-round difference vs off, t-based 95% CI):
71| config | run 1 (200) | replicate (200) | pooled (400) |
72|---|---|---|---|
73| off mean | 35.10 ms | 35.03 ms | 35.06 ms |
74| emit only (RX_ARGUS=1) | +1.71% [+0.90, +2.52] | +2.46% [+1.56, +3.36] | +2.09% [+1.48, +2.69] |
75| discard, auto placement | +3.53% [+2.60, +4.46] | - | - |
76| **ingest, auto placement (shipped default)** | **+4.06% [+3.22, +4.91]** | **+3.68% [+2.83, +4.54]** | **+3.87% [+3.27, +4.47]** |
77| ingest, unpinned (none) | +5.31% [+4.45, +6.17] | +5.31% [+4.54, +6.08] | +5.31% [+4.74, +5.89] |
78| discard, unpinned | +4.99% [+4.13, +5.86] | - | - |
79| ingest, pre-fix 20e84b8 | +4.93% [+3.87, +5.98] | - | - |
80The replicate was decided before its result was seen, and both runs are reported. Every run passed (116 checks, 0 failures).
81Rough decomposition of the shipped +3.9%: ~1.1% harness (larger executable hashed by the receipt), ~1% producer
82hooks (emit-only minus harness), ~1.3% consumer presence even when off-core (cross-cluster cache traffic on the
83ring and publish lines), ~0.5% ingest SHA-256 chain. These are ranges, not exact attributions.
84
85Micro-op (rx_aegis_evaluate + rx_world_validate_cap, 20M ops/run, 30 interleaved rounds, raw/micro-*):
86| config | core 7: median ops/s | mean vs 0 [95% CI] | cores 7,8: median | mean vs 0 [95% CI] |
87|---|---|---|---|---|
88| 0 | 41.47M | - | 41.66M | - |
89| 1 emit only | 44.07M | +5.99% [+3.27, +8.72] | 43.26M | +3.62% [+0.17, +7.07] |
90| 2 discard (auto) | 43.83M | +4.73% [+2.10, +7.35] | 44.79M | +4.67% [+1.27, +8.08] |
91| 2 ingest (auto, shipped) | 44.64M | +5.96% [+3.60, +8.32] | 44.08M | +5.53% [+3.39, +7.67] |
92| 2 discard, unpinned | 40.31M | -3.77% [-6.47, -1.06] | - | - |
93| 2 ingest, unpinned | 41.31M | -3.51% [-6.00, -1.03] | - | - |
94The op p50/p99 is 48/64 ns in every mode; the use update p50 is 2.25 ns. Every ARGUS build, emit-only included,
95is 4-6% faster than the RX_ARGUS=0 build. That points to code layout, so this bench cannot resolve costs of a few
96percent. In the shipped default the consumer leaves core 7 and there is no loss. Unpinned on one core (consumer
97on the measured core) the loss is ~3.5%, with a CI that reaches past 5%. That is diagnostic only, not the shipped config.
98
99## Verdict
100- vs the lane's 5% bar: **PASS**. R8 +3.87% (pooled, CI +3.27..+4.47, half-width 0.60%; each run's CI is
101 below 5%). Micro-op: no loss.
102- vs the ADR 0017 2% target: **FAIL**. R8 +3.9% (CI excludes 2%). Even emit-only is +2.1%, and ~1.1% of R8's
103 cost is the receipt hashing a larger binary. 2% cannot be reached on R8 as built; a steady-state R8 variant
104 (without per-run fixed costs) is the way to test it. Noted, not built.
105- The pass depends on the consumer having a core the workload does not use. Unpinned, R8 is +5.3% (FAIL).
106
107## Correctness (RX_ARGUS=2 ingest, ARGUS_AUTH=observer, the successor of ARGUS_WRAP=1; detectors b375dca)
108Streams: ~/workspace/argus-runtime-streams/speed2-run1, speed2-run2 (make test-argus-runtime: no mask, so the
109consumer is "auto:unpinned") and speed2-pinned (taskset 5-9,15-19: "auto:0-4,10-14").
110- R7: 2 findings, code 13 (known open: a second authority instance restarts at boot generation 2). 320 events. The
111 stream is byte-identical in all three runs.
112- R8: 0 findings. R9: 0 findings. 0 ring refused, 0 summary refused, 0 late in every run.
113- Replay (raw/replay-digests.txt): every stream replayed twice gives the same state digest. R8/R9 live streams
114 differ run to run (timing-dependent flush points), as in H2.
115
116## Build checks
117- RX_ARGUS undefined: objdump -d of rx_aegis.o, rx_native_bind.o, rx_generation.o, rx_world.o is identical to
118 main bba3bd3 (raw/objdump-identity.txt). Default test-r7, test-r8 and test-r9 pass.
119- Makefile (0c00c5a): AIENOS_R7_DIR now defaults to $(OUT_DIR)/aienos-authority/c8ab65e, extracted from
120 AIENOS_LOCK_REPO at aienos.lock. AIENOS_R7_DIR=../aienos-r9 now stops with "has no native/capability"
121 instead of silently building against nothing.
122
123## Notes, not shipped
124- Shutdown: rx_argus_shutdown waits out the consumer's nanosleep back-off (~0.1 ms/run). A condvar wake would remove it.
125- claim() first-touches a producer slot under w->mu on a thread's first validate. R8's single-round-trip
126 "slow path" rises 49 -> 64-71 us in every ARGUS mode; pre-claiming at start would move this off the lock.
127- flush_all scans all 256 use slots on every park and on every wake (use_begin_slow). A touched-bitmap or an
128 ops-since-flush check would skip empty scans.
129- Out-of-process consumer: ADR boundary, not a speed fix.
130
131## Decisions and caveats to review
132- Policy: the default `auto` places the consumer thread OUTSIDE the affinity mask the operator gave the process.
133 That is what makes R8 pass. An operator who confined the process for isolation now has one thread outside that
134 confinement. `RX_ARGUS_CONSUMER_CPU=none` restores the old behaviour. Open for veto.
135- auto (all of 0-4,10-14: +3.87% pooled) and the single-CPU pin (CPU 2: +3.10%, earlier session) were never run
136 head to head. A single-core pin may be ~0.8% better; this was not tested, to avoid tuning to the numbers. Commit ec87160's
137 message quotes the +3.1% experiment; this file and PR #70 carry the shipped default's number.
138- consumer_auto_set bounds the scan by _SC_NPROCESSORS_ONLN and assumes CPUs are numbered 0..n-1 without gaps
139 (true on the Spark). With an offline CPU in the middle, the top CPU would be skipped.
140- The raw/main-* profile tables are aggregations of `perf script` output (tools/argus/r8_leaf.awk, r8_offcpu.awk),
141 not literal `perf report --stdio` text.