Dynamic DEM Initial Infrastructure - #759
Open
tlshannon wants to merge 5 commits into
Open
Conversation
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
tlshannon
marked this pull request as ready for review
August 3, 2026 14:33
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.
Description
Dynamic DEM construction for streaming decoders
css_code_matrices/css_noise_params(code_matrices.h) — new types that encode a CSS code's parity-check and logical-operator matrices plus a depolarizing (optionally phenomenological) noise model as plain sparse-binary structs, decoupled from thecodebase class.dem_from_css_matrices()(dem_construction.h) — builds a T-rounddetector_error_modeldirectly from CSS matrices and noise, no stabilizer circuit or Stim round-trip required. Acode-object overload (dem_construction_code.h) wraps the matrix version for callers that already have acodeinstance.extended_dem(extended_dem.h) — a sparse, partitioned DEM chunk carrying four row groups:interior,observables,in_syndrome, andout_syndrome. Supports an explicit stitching algebra:extended_dem_from_css_matrices()— build a one-round chunk.dem_stitch(a, b)/dem_stitch_all(chunks)— left-fold chunk composition, contracting outgoing/incoming seam rows.dem_merge_duplicate_columns()— collapse fault columns with identical support using either exact XOR-probability or linear-sum combination.dem_close()/dem_close_all()— convert a stitched chunk to a flatdetector_error_modelin O(T) time.dem_chunks_spec/dem_chunk_spec— declarative init/bulk/final phase specs (YAML-serialisable).dem_chunks_to_pcm(),dem_chunks_to_o_sparse(),dem_chunks_to_d_sparse(),dem_chunks_to_detector_round()— produce the exact inputsdecoder::set_O_sparse()/set_D_sparse()expect, so no decoder plugin needs to know aboutextended_deminternals.decoder_configadditions (realtime/decoding_config.h) — the flat-form fields (H_sparse,O_sparse,D_sparse,block_size,syndrome_size) are now complemented by an optionaldem_chunks+num_roundspair.expand_dem_chunks()rewrites a chunk-form config into the equivalent flat form at decoder construction time, so the rest of the realtime pipeline is unchanged.New YAML format
Decoders may now be configured with a compact phase description instead of pre-expanded flat matrices. The round count becomes a runtime field, so the same config serves experiments of any length.
expand_dem_chunks()is called duringfinalize_decoders()and rewrites the chunk form into the flat fields in-place; all downstream decoder construction sees the familiar flat representation. A config that already carries a nonemptyH_sparseis left untouched, so an expanded config round-trips through YAML without re-expansion.Future PR: decoder plugin updates
This PR does not modify any decoder plugin. A follow-up PR will wire
dem_chunksawareness directly into individual decoders where it adds value.Lines of code
This PR is >1000 lines due to the creation of new functionality. Tests are almost half the line count.
Runtime / performance impact
N/A
Self-review checklist
Please confirm each item before requesting review. Check
[x]or strikethrough and explain.
Before requesting review
Scope and size
(if so, an issue has been raised).
Tests
just when it is missing.
EXPECT_*/assertchecks areinsufficient for algorithmic correctness.
Documentation
tracked.
Code style
snake_casevscamelCase) forthe area being modified.
Dependencies
OSRB tickets filed.