Dynamic DEM Initial Infrastructure - #759
Merged
Merged
Conversation
tlshannon
marked this pull request as ready for review
August 3, 2026 14:33
tlshannon
force-pushed
the
dyn_dem
branch
2 times, most recently
from
August 10, 2026 20:48
3d5a616 to
6cf24cd
Compare
tlshannon
requested review from
bmhowe23,
justinlietz and
melody-ren
and removed request for
justinlietz and
melody-ren
August 11, 2026 15:51
bmhowe23
reviewed
Aug 11, 2026
bmhowe23
left a comment
Collaborator
There was a problem hiding this comment.
Thanks, Tracy. I think this is looking great. Just a few comments below.
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>
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>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
…out of public header Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
Signed-off-by: Tracy Shannon <tshannon@nvidia.com>
melody-ren
added a commit
to melody-ren/cudaqx
that referenced
this pull request
Aug 14, 2026
No conflicts. The nine commits since the last merge touch the realtime path again -- NVIDIA#769 serves HOST_CALL inline and retires the worker threads, queues, and CqrTransceiver; NVIDIA#759 adds the dynamic-DEM infrastructure that reshapes create_realtime_decoder around chunk expansion -- but none of it reaches the inproc_rpc path this branch removes: no reference to inproc_rpc, qec_realtime_session, or rpc_producer comes back, and none of the deleted sources reappear. NVIDIA#778 moves the CUDA-Q pin to 28f195f4, so verification needs a toolchain rebuilt at that commit. Signed-off-by: Melody Ren <melodyr@nvidia.com>
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.
Dynamic DEM construction for streaming decoders
css_code_matrices/css_noise_params(code_matrices.h) — 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.seam_id/phase_id(extended_dem.h) — lightweightuint32_tidentifiers whose value is the FNV1a-32 hash of a name string, computed at compile time. The same string always produces the same ID; no manual numbering required. A runtime name registry (seam_id::register_name/seam_id::name()) provides human-readable error messages. Standard memory-experiment names:extended_dem(extended_dem.h) — a single H matrix holding all detector rows, plus a flat list of named seam descriptors that identify which row bands participate in stitching. Interior rows are the complement. O (observables) is separate.Supports an explicit stitching algebra:
extended_dem_from_css_matrices()— build a one-round chunk.dem_stitch(a, b, from_seam, to_seam)/dem_stitch_all(chunks)— left-fold chunk composition, contracting named seam row bands.dem_merge_duplicate_columns()— collapse fault columns with identical support using either exact XOR-probability or linear-sum combination.dem_close(dem, to_seam)/dem_close_all(chunks)— convert a stitched chunk to a flatdetector_error_modelin O(T) time.dem_chunks_spec/dem_chunk_spec— declarative named phase specs (YAML-serialisable);num_roundsis optional and absent for streaming.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 complemented by an optionaldem_chunksfield.num_roundsmoves insidedem_chunksand is optional (omit for streaming).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 is optional — omit it for streaming decoders where the total is not known at configuration time.
The
connectionslist encodes the phase graph. A self-loop (from: bulk, to: bulk) identifies the repeating phase;num_roundscontrols how many copies are inserted.H_sparseat chunk level is the memory-experiment shorthand (all seams share the same rows); aseam_specslist gives per-seam rows for non-memory circuits.expand_dem_chunks()is called duringfinalize_decoders()and rewrites the chunk form into flat fields in-place; all downstream decoder construction sees the familiar flat representation. A config that already carries a nonemptyH_sparseis left untouched.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 exceeds 1000 lines due new functionality and its test suite. Tests are roughly half the line count.
Runtime / performance impact
N/A
Self-review checklist
Before requesting review
Scope and size
Tests
Documentation
Code style
Dependencies