Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
31dd57f
Add a profiling benchmark suite with correctness fingerprints
meandmytram Sep 2, 2026
23f0202
Speed up the two SVD-path hotspots measured by the benchmark suite
meandmytram Sep 2, 2026
fff0766
Guard the reduced-SVD path against non-finite input; unpin the trunca…
meandmytram Sep 3, 2026
009826f
Make the negative-amplitude diagnostic testable deterministically
meandmytram Sep 3, 2026
e922e99
Address Copilot review: energy fingerprint and deterministic SVD cove…
meandmytram Sep 3, 2026
4ee6409
Mark the GPU-only conversion branch as uncovered by design
meandmytram Sep 3, 2026
06a4d85
Address Copilot round 2: posterior fingerprints, GPU finiteness, zero…
meandmytram Sep 3, 2026
3ae3673
Address Copilot round 3: unmeasured imports, aspect-first finiteness …
meandmytram Sep 3, 2026
2b94755
Pin rtol=0 on the truncation-error assertion too
meandmytram Sep 4, 2026
8b78219
Cache opt_einsum expressions in the contractor
meandmytram Sep 7, 2026
437e9a2
Use column-pivoted QR for pure orthogonality-centre moves
meandmytram Sep 7, 2026
b41b77f
Prune QR-move directions on the SVD path's absolute cut, not a relati…
meandmytram Sep 7, 2026
3968237
Route collapsed (dimension-0) bonds around the pivoted-QR move
meandmytram Sep 7, 2026
79c0c83
Let a pivoted-QR move collapse a sub-cut spectrum to rank 0
meandmytram Sep 8, 2026
5a2b555
Move the orthogonality centre by QR then an SVD of the R factor
meandmytram Sep 8, 2026
edde581
Test the QR+SVD(R) move against the SVD path on full-rank states
meandmytram Sep 8, 2026
c4456de
Refactor mps_from_dense call to set chi_max separately
meandmytram Sep 8, 2026
b716c3c
Address review findings on the perf branch
meandmytram Sep 8, 2026
7d6ac90
Merge remote-tracking branch 'origin/perf-profiling' into perf-profiling
meandmytram Sep 8, 2026
aec3734
Tidy the perf branch to match what it actually does
meandmytram Sep 8, 2026
ea0f194
Gate the one-site move on an isometric neighbour; anchor fingerprints…
meandmytram Sep 8, 2026
217a343
Skip the one-site factorisation when the bond already exceeds chi_max…
meandmytram Sep 8, 2026
7b1345f
Benchmark --check judges only the workloads it ran, and rejects NaN
meandmytram Sep 8, 2026
7d0cb62
Merge remote-tracking branch 'origin/main' into perf-profiling
meandmytram Sep 8, 2026
bd0e605
Make bench_suite --check and --write-baseline exclusive; targeted bas…
meandmytram Sep 8, 2026
7efccf5
Merge remote-tracking branch 'origin/main' into perf-profiling
meandmytram Sep 9, 2026
dae1101
Assert the negative-amplitude warning deterministically
meandmytram Sep 9, 2026
acc9039
Merge remote-tracking branch 'origin/main' into perf-profiling
meandmytram Sep 9, 2026
600040a
Benchmark the DEM decoder and the RCM qubit ordering
meandmytram Sep 9, 2026
198256b
Trim per-string overhead in the constraint sweep
meandmytram Sep 9, 2026
6d21cb2
Keep an orthogonality centre at site 0 across reverse()
meandmytram Sep 9, 2026
f71a80f
Describe the benchmark suite and its fingerprint contract
meandmytram Sep 9, 2026
2f3b3b6
Back-multiply only the kept singular vectors after a QR reduction
meandmytram Sep 9, 2026
59494dc
Take the one-site move for renormalised moves and returned spectra too
meandmytram Sep 9, 2026
49f468d
Slice and back-multiply the singular vectors before the host conversion
meandmytram Sep 9, 2026
5ad99df
Type the returned spectra of move_orth_centre as arrays
meandmytram Sep 9, 2026
9746e42
Compare the one-site move against an explicit two-site reference
meandmytram Sep 9, 2026
7da6ad4
Use the module-level split_two_site_tensor import in the test helper
meandmytram Sep 9, 2026
2fca2b8
Clarify bond collapse in test docstring
meandmytram Sep 10, 2026
2a70c51
Promote the isometry gate's Gram matrix to an inexact dtype
meandmytram Sep 10, 2026
1fc2749
Document svd's array return and QR pre-reduction (ultrareview nit)
meandmytram Sep 10, 2026
71ad15f
Merge remote-tracking branch 'origin/main' into perf-profiling
meandmytram Sep 10, 2026
732a01f
Trim the zip-up sweep: no two-site copy, no discarded norm, no per-si…
meandmytram Sep 10, 2026
5e6838e
Expose the qubit ordering in the four CSS campaign CLIs
meandmytram Sep 10, 2026
e0a6e73
Merge remote-tracking branch 'origin/main' into perf-profiling
meandmytram Sep 10, 2026
cb8078b
Update gram calculation for inexact dtype support
meandmytram Sep 10, 2026
a7c5ccc
Fix indentation for gram_dtype assignment
meandmytram Sep 10, 2026
3e36d22
Fix back_q initialization in SVD backend attempts
meandmytram Sep 10, 2026
4f811af
Record a truncation artefact per shot in the Nishimori harness instea…
meandmytram Sep 11, 2026
970d834
Route the SVD's QR pre-reduction through SciPy's LAPACK
meandmytram Sep 12, 2026
db756fb
Merge remote-tracking branch 'origin/main' into perf-profiling
meandmytram Sep 12, 2026
0ba5f0b
Disable the SVD's QR pre-reduction by default; keep it behind a flag
meandmytram Sep 12, 2026
f101cb0
Pin the distance-5 surface code's logical error rate on a fixed sample
meandmytram Sep 12, 2026
9ebcb29
Fingerprint the constrained LDPC state; derive the product-state cent…
meandmytram Sep 12, 2026
6c67154
Make the pre-reduction opt-in explicit and test the paths that are ac…
meandmytram Sep 12, 2026
e384d91
Cover the non-finite fallback chain on both SVD paths
meandmytram Sep 12, 2026
2f4eb3f
Gate the one-site move on the Frobenius norm of the Gram residual
meandmytram Sep 13, 2026
28057f6
Record the qubit ordering in the campaign data, and name files from it
meandmytram Sep 13, 2026
1396c21
Remove the SVD's QR pre-reduction and record why in a comment
meandmytram Sep 14, 2026
e456b8e
Move the allocator-churn SVD stress test behind the slow opt-in, in a…
meandmytram Sep 14, 2026
49be1c8
Merge origin/main into perf-profiling
meandmytram Sep 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions benchmarks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
results/
53 changes: 53 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Benchmarks

`bench_suite.py` is the profiling and correctness harness behind the
optimisation work. Every workload is deterministic (fixed seeds) and returns a
*fingerprint*; `baseline.json` holds the fingerprints of the unoptimised code,
and a change is only accepted if the fingerprints still match.

| Workload | What it exercises | Contract |
| --- | --- | --- |
| `surface_bitflip` | 5x5 surface code, bit-flip noise, 6 shots, χ = 64, natural qubit order | verdicts exact, posterior entries within 1e-2 |
| `css_optimised` | the same code under `qubit_order_strategy="Optimised"` (reverse Cuthill-McKee) | as above |
| `shor_depolarising` | Shor code, depolarising noise, 40 shots, χ = 128: the dense-readout path | as above |
| `classical_ldpc` | random (3,4) LDPC code, XOR constraints + dephasing-DMRG readout | overlaps exact to 1e-10 |
| `dmrg_ground_state` | DMRG on a 24-site transverse-field Ising chain | energy exact to 1e-10 |
| `dem_d3` | circuit-level detector error model, d=3 r=3 p=0.8%, eight busiest syndromes, χ = 32 | verdicts exact, class masses within 1e-2 |
| `dem_d5` | the same at d=5 r=5 p=0.5%, busiest syndrome, χ = 32 | as above |

"Exact" means the value must agree to 1e-10; χ-truncated posterior entries get
1e-2 because a different but equally valid SVD gauge in a near-degenerate
spectrum changes which directions the truncation keeps (verdicts and
converged results are unaffected). A NaN never matches.

## Running

```bash
# time every workload and compare against the committed baseline
python benchmarks/bench_suite.py --check

# one workload, with a cProfile dump and a text top-30 in benchmarks/results/
python benchmarks/bench_suite.py --workload dem_d5 --profile

# record a new baseline for a workload (only after the change is validated
# some other way: exact enumeration, agreement at converged chi)
python benchmarks/bench_suite.py --workload NAME --write-baseline
```

`--check` and `--write-baseline` are mutually exclusive, and a targeted
`--write-baseline` touches only the workloads it ran. `results/` is
gitignored; `summary.json` there keeps the last wall time per workload.

## Writing a baseline from the reference code

The baseline must come from code *without* the optimisations under test.
With a clean checkout of `main` next to this one:

```bash
PYTHONPATH=/path/to/mdopt-main python benchmarks/bench_suite.py --workload NAME --write-baseline
PYTHONPATH=/path/to/this-checkout python benchmarks/bench_suite.py --workload NAME --check
```

`python -c` puts the current directory first on `sys.path`, so verify which
package a run imports (`mdopt.__file__`) from a neutral directory before
trusting a measurement.
Loading