Skip to content

Remove local tables - #191

Closed
sumeetshirgure wants to merge 10 commits into
oscarhiggott:masterfrom
sumeetshirgure:remove-local-tables
Closed

sumeetshirgure wants to merge 10 commits into
oscarhiggott:masterfrom
sumeetshirgure:remove-local-tables

Conversation

@sumeetshirgure

Copy link
Copy Markdown

No description provided.

Siyuan Niu and others added 10 commits October 1, 2026 22:14
…ual state

fastgap runs the ordinary PyMatching sparse-blossom decode and returns, per shot,
a certified lower bound on the complementary gap computed from the decoder's own
final dual state (no second decode, no volume sweep), following CLAUDE.md.

- C++ core in src/pymatching/fastgap/: gauge canonicalisation of the observable
  onto the boundary, dual-state extraction before shattering, GapIndex (boundary
  and landmark potentials, exact local tables, save/load), dense priced search,
  optional upper bound and diagnostics, exact two-decode and brute-force baselines.
- Python package src/fastgap/: GapIndex, GapDecoder, exact_gap_batch, pluggable
  landmark strategies, and the bench / build-index / landmark-report CLI.
- Only upstream source edit: two declarations in driver/mwpm_decoding.h.
- Tests: C++ GoogleTest next to each source; tests/fastgap covers the CLAUDE.md §9
  plan (10^5-shot soundness on rotated surface codes d=3..17, upstream parity,
  index round-trip).
- Benchmarks and raw per-shot CSVs in benchmarks/fastgap/; notes in NOTES.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add fastgap: certified complementary-gap lower bounds from the MWPM dual state
`fastgap bench --threads` now accepts several thread counts and records each one under
`throughput.by_threads` in the summary JSON (wall time, us/shot, core-seconds/shot, speedup).
The benchmark config measures T=4 and T=10, and all six rotated-memory results were re-run.
Soundness violations: 0 on every DEM; non-timing CSV columns are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Benchmark throughput at T=4 and T=10 threads
…act baseline

Intra-shot parallelism replaces shot-level parallelism. GapDecoder(num_threads=T) decodes shots
one after another; the calling thread runs the dense Dijkstra while T-1 threads (a spinning
SpinTeam) prefetch price rows for the states it is about to settle. Rows are deterministic and
ties are broken by (iteration, defect index), so results are bit-identical for every T. Shared
rows are int32 saturated at d_LR + 1, which is exact since the answer is at most d_LR.

The search also stores labels per hop target, making relaxation a contiguous branch-free pass
with a fused argmin. d=17, p=1e-3 gap stage: 29.5 -> 18.9 us (T=1), 11.9 us (T=4).

Benchmarks are latency-only: T=1 and T=4, 2e4 shots per DEM. The exact baseline times its two
decodes separately, and the summaries report gap-only speed-ups (baseline complementary-class
decode / fastgap gap stage): 9-29x at T=1, up to 45x at T=4. README gets an overview and the
table. Soundness: 0 violations; all C++ and Python tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Intra-shot parallel gap search; gap-only latency vs the exact baseline
The index now stores only the boundary and landmark potentials, and
d_hat(u, v) = LB(u, v). The table radius parameter, the table arrays and
the --table-radius CLI flag are gone, and the index file format moves to
version 2. Tests that exercised the tables now check that d_hat is a
lower bound, and that making every node a landmark reproduces exact
pricing. Soundness tests are unchanged and pass.

Adds GapIndexCore.dual_state(events), which exposes one shot's final dual
state for figures.

Benchmarks were re-run without gap_ub, with d=15, p=1e-3 added (0
soundness violations).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sumeetshirgure
sumeetshirgure deleted the remove-local-tables branch November 1, 2026 14:38
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.

2 participants