Add just-in-time DEM slice stitching - #664
Draft
qciaran wants to merge 16 commits into
Draft
Conversation
# Conflicts: # python/quantum-pecos/src/pecos/qec/surface/logical_circuit.py # python/quantum-pecos/tests/qec/surface/test_logical_circuit_decoder_windowing.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the PECOS-native representation, extraction, assembly, and first production integrations for just-in-time detector error models:
DemSlicetemplates with checked temporal horizonsDetectorErrorModelextraction that preserves independent sources, Y decompositions, arbitrary source-frame components, hyperedges, and correlated two-qubit sourcesDagFaultInfluenceMaplocations anddem_slice_roundDAG annotations[x, y, round]coordinatesThis remains a draft because repeated CX and mixed-gate composition, the correct bounded mid-cycle fold-transversal SZ/SZdg circuit, broader multi-patch families, and the anti-snake logical-subgraph window decoder remain follow-ups.
Motivation and design
Windowed decoding should not regenerate and filter a global DEM for every window. Under a bounded detector-correlation horizon, constant-depth physical operation templates can be compiled once and instantiated using relative detector addresses.
Physical cache identity is separated from scheduling state. Geometry, orientation, boundary bases, noise parameters, and physical family select the cache entry; absolute rounds, patch labels, qubit offsets, coordinate placement, and logical-output routing live on instances.
Output routing is an explicit GF(2) transformation. One local column may fan out to several algorithm-wide columns, repeated destinations cancel by parity, and an empty row deliberately projects a local column away. Missing mappings remain errors. This is the algebra needed to pass cached sources through later Clifford frames.
DemSlice::from_detector_error_modelrequires explicit mappings for everyD<n>,L<n>, andTP<n>identity. Location-selected extraction admits a physical source only when all its locations share the slice owner; partial or unattributed ownership fails loudly. Source components are checked to XOR to their complete effect.For surface circuits, the round schedule is derived from metadata PECOS already carries. Detector streams are seeded from the earliest full syndrome round, preserving physical syndrome-bit order when initialization declares only a subset. Each physical fault location inherits its owner from its annotated DAG gate.
Production families
A three-SEC-round memory fixture supplies initialization, stationary bulk, pre-terminal, and terminal families. Requested depth is not part of the key.
Transversal-H boundaries add pre-gate bulk, pre-gate boundary, H plus first post-gate SEC, and post-gate bulk families. Repeated H composition has four possible states: physical X/Z swap parity before the selected boundary and logical H parity still to come. An optional earlier H in the bounded fixture establishes the former; an optional later H establishes the latter for backward observable propagation. Three SEC rounds isolate the selected boundary from both auxiliaries. Cache cardinality is therefore constant in algorithm length. The current surface frontend declares one final measured observable, so its checked instance routing row is identity while each family’s effective final basis carries the later-H parity.
The transversal-CX provider retains native correlated two-patch sources and translates the two canonical detector-stream partitions independently. Matching shapes in the common registered/memory/CX order are supported; mismatched shapes, shallow boundaries, and noncanonical ordering use the fallback.
The current standalone SZ/SZdg emitter is deliberately not cached. Its detector span grows with the preceding memory depth (observed spans 3, 5, and 9), violating the bounded-correlation requirement. The paper protocol instead embeds a fold-transversal S operation midway through a syndrome-extraction round; that physical S-SE circuit is a prerequisite to a sound provider.
This follows the slicing/stitching architecture in arXiv:2608.11719. The static-Tanner/prior-only optimization in arXiv:2608.25027 remains a possible fast path only when topology is actually unchanged.
Verification
origin/devat9634becaf; the branch is currently 0 commits behindcargo test -p pecos-qec(816 unit tests: 810 passed, 6 expected ignored; all integration tests; 57 doc tests)cargo clippy -p pecos-qec -p pecos-rslib --all-targets -- -D warningscargo fmt --all -- --checkjust docs-build, andgit diff --checkFollow-ups