Skip to content

Benchmark qualification and host-wide timing lock - #92

Merged
akutuva21 merged 14 commits into
mainfrom
codex/bng3-20261002-performance
Oct 4, 2026
Merged

akutuva21 merged 14 commits into
mainfrom
codex/bng3-20261002-performance

Conversation

@akutuva21

@akutuva21 akutuva21 commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Scope

This branch qualifies the remaining performance and benchmark-measurement work against the current corrected BNG3 source. It adds the host-wide benchmark lock and robustness tests, reproducible network-generation and seeded-SSA harnesses, exact-source evidence for PR44/PR58, and the PR67 documentation source-anchor correction. It does not change production simulator code.

Findings

  • PR42 network generation: current-main is a baseline, not a production speedup. All 11 fixtures were byte-stable across five repetitions (median total 13.137 s). Against pinned Perl BNG2 revision 9601746f8884ed19ab2acea49fe87fc4660ace46, 10 fixtures passed and fceri_ji_gen.bngl was explicitly unsupported by that oracle because of a dangling numbered bond; there were 0 mismatches among supported cases. The old TLBR nondeterminism exemption was removed after main's determinism fix.
  • PR44 SSA: exact-current-source baseline reverses only historical commit 3471714032bd880b03d776b922a02d16c4317ebb. Independent seeded identity checks passed 8/8 cases. On one synthetic ring fixture over five pairs, raw median throughput ratio was 1.45294x (probe-corrected estimate 1.48524x), with essentially unchanged peak RSS. This is one-fixture evidence, not a general BNG3 speed claim.
  • PR58 CPU batch SSA: the baseline is the pre-integrator-sharing source with current seed derivation applied identically to both arms. Full dumps matched for six historical multicore configurations plus a small single-worker control. On the heavy EGFR case, candidate median process CPU was 2.2% higher (no CPU speedup observed) while median peak RSS was 48.64% lower. Timing samples are exploratory because host load rose during the run. The historical EGFR 800/1-thread case is unverified: baseline was terminated before output and candidate was not run. Dynamic functional-rate michment remains outside this measurement pending the parity lane's correction.
  • PR67 / PR78 / PR82: the expression-profile documentation source anchor is refreshed; the seeded harness fixes pass their focused regressions; host-wide benchlock acceptance passes 26/26, including interrupt forwarding, descendant-held slot lifetime, process-table errors, and race cases.

Local verification

  • 12/12 Python unit tests across PR78 harness, PR42 netgen, BNG2 adapter, and fixture generator.
  • 26/26 benchlock acceptance checks with process-table access.
  • Batch SSA runner shell harness and shell syntax checks pass; the permanent Ninja helper built, and its isomerization dump matched the verified candidate binary.
  • PR44/PR58 identity and measurement details, exact patches, raw samples, co-tenant/load context, and unsupported or unverified cases are recorded under bench/evidence/.

Hosted checks are reported below against this PR's exact head SHA. This is a draft for review; no merge, close, or release is requested.

Exact-head hosted checks

All runs are terminal for head cd81d5ed5f417b268aae33339156410eb0e0cc01 against base c345f3aa635aac0048681b79c6a4ff1e75a298f7:

  • CI run 37127752892: 6 passed, 20 failed, 8 skipped. The 20 failures match the exact-base CI run 36812376393: two Black formatting findings (test_mm_free_substrate_root.py, test_observable_type_support.py), the Windows unistd.h include in test_gdat_output_format.cpp, and all 18 Python 3.9–3.14 / Ubuntu–macOS–Windows jobs failing to import _bionetgen_cpp during collection of test_thermodynamic_parse_path.py. No files in those failure paths are changed in this branch, and the exact-base logs show the same failure signatures. No patch-introduced CI failure was identified.
  • The passing CI checks include Linux GCC 12, Linux Clang 15, macOS arm64 Clang, C++ ASan, CPU batch-SSA analytical reference parity, and the CUDA batch-SSA job. The CUDA job returned success but logged that nvcc is absent, so no CUDA backend was compiled or exercised.
  • Cross-tool parity run 37127752908: independent BNG2 networks, independent NFsim, and parity source-lock validation passed. PyBioNetGen API compatibility failed at tests/python/conftest.py because bionetgen._bionetgen_cpp is unavailable after resolving the source tree; the exact-base parity run 36812376327 has the same failure. Scheduled NFsim historical validation was skipped.
  • CodeQL run 37127752883 passed both C++ and Python analyses. Lean semantic kernel run 37127752870 passed.
  • Full-corpus validation, corpus parse inventory, wheel/sdist/package smoke, Docker, integration, and PyPI jobs were skipped by the pull-request workflow. They provide no release or full-corpus evidence here.

The PR remains a draft for review. No merge, close, or release is requested.

memWatch and others added 14 commits October 2, 2026 23:47
Caps how many timing-sensitive benchmarks run at once on one host, across
every worktree. Written during a session in which measured contention came
from concurrent BENCHMARKS rather than from builds: 1-minute loadavg ranged
23-131 while peak resident memory never moved and no process exceeded its
memory cap.

The discriminator is whether a run's RESULT depends on machine timing, not
whether it consumes CPU. An A/B or a benchmark harness needs a slot; a
correctness run, a single-model invocation, a ctest or a determinism census
does not. Counting allocations, instructions or events is deterministic and
cannot move under load, and that exemption must be declared rather than
quietly folded into a speedup claim.

Uses fcntl.flock rather than a directory lock, because on a host where
agents are routinely culled a stale counter lock wedges the protocol
permanently while the kernel releases flock on process death for any reason.

On release each holder receives a co-tenant ADVISORY in two classes. NEW is
the obvious one - processes started during the hold. PERSIST covers processes
alive at release that were already alive at acquire, which a start-time diff
misses entirely: a long-running correctness sweep that began before the A/B
took its slot never starts during the window yet loads the machine
throughout it. The advisory judges nothing and blocks on nothing; it exists
so that an undeclared co-tenant becomes a declared one, because a reader
who was not told cannot weigh the number.

Tests: 21 + 9 assertions plus a 6-way race, all using a unique lock
directory per invocation. That isolation is load-bearing rather than
housekeeping: every assertion concerns exact slot occupancy, so a shared
path makes concurrent runs fight and report slot leaks that do not exist.
Verified with 16 simultaneous full-suite instances on a loaded host, 16/16
clean, where 8 concurrent instances previously produced 8 failures.

race_test.py asserts the invariant that matters - never more than MAX held
at any single instant - not 'only MAX racers ever win', which is not an
invariant, since a holder that finishes legitimately frees its slot.

No production code touched. Adds tools/benchlock/ only.
Reject SSA runs unless they produce fresh nonempty network output and a complete numeric time grid. Persist per-case validity and action-derived sampling expectations, then have the comparator verify case coverage, required files, hashes, and grid contents. Add regressions for missing, empty, truncated, and wrong-endpoint outputs and mismatched coverage.
Replace the toolchain-sensitive comparison of two small batch-mean samples with a direct check of the 32-bit trajectory RNG keys. The old additive mapping reuses 511 of 512 keys for adjacent base seeds. Centralize the existing low-32-bit and zero-to-one conversion so the test covers the same key construction used by single-worker, multi-worker, and integrated batch SSA. The SplitMix mapping and resulting seed streams are unchanged.
@akutuva21
akutuva21 marked this pull request as ready for review October 4, 2026 01:14
@akutuva21
akutuva21 merged commit 7107b6c into main Oct 4, 2026
45 checks passed
@akutuva21
akutuva21 deleted the codex/bng3-20261002-performance branch October 4, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant