Skip to content

Split the surface-code LER equivalence test into per-distance and suppression tests - #798

Open
ciaranra wants to merge 4 commits into
devfrom
split-ler-test-787
Open

ciaranra wants to merge 4 commits into
devfrom
split-ler-test-787

Conversation

@ciaranra

@ciaranra ciaranra commented Sep 18, 2026

Copy link
Copy Markdown
Member

Part of #787.

Why

neo_surface_ler_test is the longest test binary in the PR gate's workspace phase. Its single surface_memory_ler_matches_across_stacks test ran the d=3 and d=5 memory experiments one after another on both stacks and then asserted equivalence and suppression, so a failure at either distance reported through one test name and libtest could not overlap the two distances.

What

The test is now three: d3_ler_matches_across_stacks, d5_ler_matches_across_stacks and d5_suppresses_ler_below_d3. Each distance is simulated and decoded once per test binary through logical_errors(distance) (two OnceLock statics); the suppression test reads both cached results instead of resampling, and a thread that reaches a slot another test is still filling blocks on the lock until that run finishes. Every assertion is unchanged: same p, shots, seed and confidence levels, the same per-stack Jeffreys overlap check and the same pooled d5.hi < d3.lo suppression check. The calibration comments moved onto the P and SHOTS constants.

Verification

  • cargo fmt --check, cargo clippy -p pecos --features neo --tests -- -D warnings, pre-commit on the file: clean.
  • cargo test -p pecos --features neo --test neo_surface_ler_test passed three times; the --nocapture run printed distinct intervals for the two slots (d=3: engines 106/20000, neo 75/20000; d=5: engines 38/20000, neo 35/20000), consistent with the calibration recorded in the file.
  • Wall time pinned to four cores with taskset -c 0-3 to match the runner: 204 s for the single test on dev (one sample, 760 CPU-s) against 186 s and 183 s for the split (725 and 716 CPU-s). The gain is about 9 percent, smaller than PR gate: neo_surface_ler_test bounds the pr-core-rust workspace test phase #787 estimated: run_stack already uses four workers, so the old test was CPU-bound at 3.7 of 4 cores and the d=5 simulations are nearly the entire cost (d=3 finishes in under a minute). The remaining lever in PR gate: neo_surface_ler_test bounds the pr-core-rust workspace test phase #787 is the per-shot cost of the d=5 simulation, not scheduling.

Review

Independent correctness review (Codex, read-only) of the split against origin/dev: SHIP, no must-fixes. It confirmed the assertion predicates and inputs line by line, that the OnceLock sharing has no cyclic dependency under any libtest thread count, ordering or test filter, and that no other file references the old test name. One note, verified against the std 1.98.1 source (once_lock.rs, get_or_init uses call_once_force): the cell is never poisoned, so if the initializer panics the waiting test re-runs the simulation itself and then fails or passes on its own. A failing distance therefore costs one extra run rather than a hang; the doc comment on logical_errors now says so.

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