Support Stim DEM strings in get_decoder#571
Merged
vedika-saravanan merged 18 commits intoJun 8, 2026
Merged
Conversation
e034551 to
b3aa44a
Compare
b3aa44a to
bccd851
Compare
5b57205 to
6603369
Compare
bmhowe23
reviewed
Jun 3, 2026
bmhowe23
reviewed
Jun 3, 2026
bmhowe23
reviewed
Jun 4, 2026
71c1666 to
1b2c61c
Compare
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
00a9838 to
fb6dcfc
Compare
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
d6be6ce to
f428c85
Compare
…vailable Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
f428c85 to
1253540
Compare
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
ccb933f to
05b5d5a
Compare
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
bmhowe23
reviewed
Jun 8, 2026
bmhowe23
left a comment
Collaborator
There was a problem hiding this comment.
This is looking good...thanks, @vedika-saravanan. Just a few follow-up questions below.
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
bmhowe23
approved these changes
Jun 8, 2026
bmhowe23
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! Could you please create a follow-up PR/issue to add docs for this capability? We should add a public example for this.
Collaborator
Author
|
GHI for adding docs and example #595 |
Collaborator
|
@vedika-saravanan can you please do |
vedika-saravanan
added a commit
that referenced
this pull request
Jun 10, 2026
…598) ## Description Updates QEC docs and adds public C++ and Python examples for decoder construction from Stim DEM strings. Closes: #595 ## Runtime / performance impact N/A. Documentation/example-only change. ## Self-review checklist Please confirm each item before requesting review. Check `[x]` or strike through and explain. ### Before requesting review - [x] I reviewed my own full diff in GitHub or my editor. - [ ] PR is in Draft if it is not yet ready for review. - [x] Temporary / debugging changes have been removed. - [x] Local test logs reviewed; no unexplained warnings or errors. - [x] CI logs reviewed; no unexplained warnings or errors. - [x] Full CI has been run. ### Scope and size - [x] PR is under ~1000 lines, or an exception is justified in the description. - [ ] Refactoring-only changes are isolated in their own PR(s). - [x] No existing tests were disabled or modified just to make this PR pass (if so, an issue has been raised). ### Tests - [ ] New functionality has new tests: Docs/example-only PR; runtime functionality is covered by #571 tests. - [ ] Tests fail if the new functionality is broken (including crashes), not just when it is missing: N/A, no runtime behavior added. - [ ] Negative tests added where exceptions are expected: N/A - [ ] Truth data added where simple `EXPECT_*` / `assert` checks are insufficient for algorithmic correctness: N/A - [x] CI runtime impact considered; team notified if significant. ### Documentation - [x] Public-facing APIs have Doxygen docs. - [x] User-visible behavior changes have public docs, or a follow-up is tracked. ### Code style - [x] Naming follows the existing convention (`snake_case` vs `camelCase`) for the area being modified. ### Dependencies - [x] No new third-party dependencies, **or** the team has been notified and OSRB tickets filed. --------- Signed-off-by: vedika-saravanan <vsaravanan@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.
Description
Adds unified decoder initialization from either a parity-check matrix or raw Stim detector error model text.
This supports both existing PCM-based decoders and DEM-native decoders needed by #546. PCM-based decoders can parse DEM text into
H,O, anderror_rate_vecdefaults, while DEM-native decoders can consume the raw DEM text without going through a lossy matrix conversion.API (
cudaq/qec/decoder.h)decoder_init = std::variant<sparse_binary_matrix, std::string>as the decoder registry construction input.get_decoder(name, H, options)decoder::get(name, H, options)get_decoder(name, dem_text, options)decoder::get(name, dem_text, options)dem_from_stim_text(dem_text)to parse Stim DEM text intodetector_error_model.Oanderror_rate_vecare supplied as defaults when not explicitly provided by the user.The DEM-to-detector_error_model parser is lossy: it extracts detector flips, observable flips, and per-error probabilities, but drops detector coordinates and separator-encoded correlation structure. DEM-native decoders should consume the raw string alternative in decoder_init.
Python:
cudaq_qec.get_decoder(...)now accepts Stim DEM strings. Python-registered decoders currently receive parsedHplus DEM-derivedO/error_rate_vecdefaults, not raw DEM text.Dependency / build
QEC now provides its own Stim dependency via
FetchContentwhenlibstimis not already available, so standalone QEC builds do not depend on parent CUDA-Q interim build artifacts.Tests
C++ gtests and Python tests cover:
get_decoder(...)stim::DemTargetcategory assumptionsOut of scope / follow-ups
Chromobius plugin integration itself; detector-coordinate storage on
detector_error_model; optional PyMatching-specific improvements; user-facing Sphinx/RST docs.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.
release (the docs site publishes immediately on merge to the default
branch, so feature docs must not land before the feature ships).
Code style
snake_casevscamelCase) forthe area being modified.
Dependencies
OSRB tickets filed.