Skip to content

Weigh connected-cluster states with fewer mispredicted branches - #1065

Merged
perlinm merged 4 commits into
mainfrom
perf/dist-cc-state
Nov 26, 2026
Merged

perlinm merged 4 commits into
mainfrom
perf/dist-cc-state

Conversation

@perlinm

@perlinm perlinm commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

A state of the connected-cluster search that forbids variables that are not viable summed the weights of the unsatisfied checks of each available symbol in turn. The processor often mispredicted the branches of those loops. On codes with dense checks or wide syndromes, such as quadratic-residue and BCH codes, this weighing took most of the search, at 1.0-1.8 µs per state.

Changes

A state now adds the weight of each unsatisfied check to the repair of each of its symbols, and allows the viable symbols by selects instead of branches. A state whose unsatisfied checks have more entries in total than there are symbols takes the overlaps of all symbols in one pass, and clears all repairs at once. Memos of a state now hold overlaps only. A state that restricts its subtree sums the repairs of all its symbols check by check, in distance searches and syndrome queries alike. connected_cluster.md (Sections 2, 3.8 and 4) describes the new weighing and the rule for the one-pass overlaps.

Validation

The searches visit the same states and find the same witnesses. Per-limit state counts and witnesses are identical on 8 codes. On 39 small and medium codes, distances equal the baseline, the literature and the other methods, and every witness is checked to be a valid logical operator of the reported weight. A new test pads the checks of the Golay code with variables that are in no check: with one such variable, many states take overlaps in one pass; with as many as the checks have entries, none does. It checks that both searches visit the same states and find no witness of weight 6, and, as plain Python, that only the first takes the overlaps of the padded variables.

Connected-cluster distance searches, 1 thread, warm:

Code Before → after
[[71,1,11]] quadratic-residue code 3.14 → 2.20 s (1.43x)
[63,30,13] BCH code 25.8 → 17.2 CPU-s (1.5x)
quantum Tanner code 0.665 → 0.526 s (1.26x)
[[276,98,14]] pair-partition code 0.647 → 0.545 s (1.19x)
lifted quadratic-residue code of 47 qubits (single runs, x86 node) 619 → 399 s (1.55x)
light LDPC codes (e.g. the gross code) 1.0-1.1x, milliseconds

Syndrome queries of the coset-leader searches, which share this kernel, run at the same speed.

perlinm and others added 4 commits November 25, 2026 14:54
A state of the connected-cluster search that forbids variables that are
not viable summed the weights of the unsatisfied checks of each available
symbol in turn, in loops whose branches the processor often mispredicted.
It now adds the weight of each unsatisfied check to the repair of each of
its symbols, and allows the viable symbols by selects.  A state whose
unsatisfied checks have more entries than there are symbols also takes
the overlaps of all symbols at once, and clears all repairs at once.

The searches visit the same states and find the same witnesses.  On one
thread, distance searches of a quantum Tanner code and of the
[[276, 98, 14]] pair-partition code take about 1.2 to 1.3 times less
time, and those of the [[71, 1, 11]] quadratic-residue code and of the
[63, 30, 13] BCH code about 1.45 times less.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Memos of a connected-cluster state now hold overlaps only: a state that
restricts its subtree sums the repairs of all its symbols check by check,
in distance searches and syndrome queries alike, and its branches reuse
them.  The guide and the docstrings now say so, and state the rule by
which a state takes the overlaps of all symbols in one pass: its number
of unsatisfied checks times the average number of entries of a check
exceeds the number of symbols.

A new test pads binary and symplectic syndrome queries with variables in
no check, which makes every state compute the overlap of each entry, and
checks that the returned symbols and counts of states match those of the
one-pass route, with and without memos.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep one Golay search per route to overlaps, and check through a wrapper
that only the dense one takes the overlaps of variables in no check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Compiled code cannot inline a wrapper, so installing it failed when no
compiled code was cached.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@perlinm
perlinm merged commit baaa8f1 into main Nov 26, 2026
9 checks passed
@perlinm
perlinm deleted the perf/dist-cc-state branch November 26, 2026 18:11
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