Surface code demo 1 refactor#685
Merged
Merged
Conversation
eliotheinrich
force-pushed
the
pr-surface-code-demo
branch
from
July 16, 2026 18:14
b0d6ec4 to
0859cc0
Compare
Signed-off-by: Eliot Heinrich <eheinrich@nvidia.com>
Collaborator
Author
|
/ok to test 4b79350 |
eliotheinrich
marked this pull request as ready for review
July 16, 2026 18:29
melody-ren
reviewed
Jul 16, 2026
melody-ren
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @eliotheinrich! I think there's a python counter part to this example which should also be updated. But that can come in a follow up to move things along quicker
…D decoding Signed-off-by: Eliot Heinrich <eheinrich@nvidia.com>
bmhowe23
reviewed
Jul 16, 2026
bmhowe23
left a comment
Collaborator
There was a problem hiding this comment.
This is gonna be great. I have 1 nit and 1 +1 on one of Melody's comments.
Note: I think GitHub is still showing my BP+OSD comment; I tried to delete it, but I started to make the comment and then didn't hit submit, and now that section of code is gone (good), so just ignore that one.
Signed-off-by: Ben Howe <bhowe@nvidia.com>
Collaborator
|
/ok to test e63925a |
bmhowe23
approved these changes
Jul 16, 2026
bmhowe23
enabled auto-merge (squash)
July 17, 2026 00:42
cketcham2333
added a commit
to cketcham2333/cudaqx
that referenced
this pull request
Jul 17, 2026
Replace the example source with the surface_code-1.cpp from NVIDIA#685 (new syndrome format, decoder_context_from_memory_circuit, seeded runs) and adapt the driver script, build, docs, and CI to its interface. The example copy differs from the in-tree file only in the header comment, the usage line, and the --save_syndrome capture, which now emits true-width groups (the packed bytes are byte-padded; the FPGA playback tool sets each replayed frame's num_syndromes from the group's line count, and the decoder's per-shot measurement capacity is the exact sum, so padded groups overran it). - run_realtime_decoding.sh: --p-cnot replaces --p-spam (two-qubit depolarizing on the CNOTs, default 0.001); new --seed (default 42 -- runs and pass/fail counts are reproducible); config/kernel phases use --save_dem / --load_dem; the kernel needs only QEC_DECODING_SERVER_PORT (the app brings up the udp channel itself in its QEC_APP_CQR build). Decoders: pymatching, nv-qldpc-decoder, multi_error_lut (trt_decoder is not supported by the new app and is dropped; sliding_window exists in the app but is not exposed -- over device calls it needs matching updates to the proprietary cudevice archive). - Pass/fail criteria keep the surface-code test checks (hard decoder-failure greps, corrections-line completion proof, num_shots/50 residual ceiling, num_shots*(num_rounds+3) server dispatch floor) and adopt the two-process test's server-ownership proof: the app's in-process dispatch count must be 0. - CMakeLists.txt: -DQEC_APP_CQR; link cudaq-qec-realtime-decoding + cudaq-qec-realtime-decoding-server-cqr (exports the dispatch-count symbol). - Docs: decoder tables/text updated (3 decoders, --p-cnot/--seed, criteria); the FPGA-predecoder page's pointer at this example is removed (trt dropped). - CI (lib_qec.yaml): the gpu-test trt step and its artifact plumbing are removed (trt dropped); the CPU job's pymatching decode now runs the seeded 200-shot default, making the ceiling check deterministic (the 50-shot unseeded run could statistically exceed a ceiling of 1 -- the amd64-12.6 failure on the previous run). Signed-off-by: Chuck Ketcham <cketcham@nvidia.com>
18 tasks
bmhowe23
added a commit
that referenced
this pull request
Jul 21, 2026
This PR is a follow-up to #685, addressing the issues in #704 as well as adding a few new CLI args. These new args are purely additive, so this PR should otherwise have identical behavior on the happy paths of #685. --------- Signed-off-by: Eliot Heinrich <eheinrich@nvidia.com> Co-authored-by: Ben Howe <141149032+bmhowe23@users.noreply.github.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
This PR updates the surface code demo (/libs/qec/unittests/realtime/app_examples/surface_code-1.cpp) to use the new syndrome format and decoder context objects. Semantically, the demo should remain very similar to the original version, but I have aimed to remove the hand-rolled sections and replace them with CUDA-QX features as much as possible. I have also refactored for readability.
Notes for reviewers
The return format of the entry QPU kernel changed; now, the low 32 bits correspond to the values of the logical qubits, and the high 32 bits correspond to the total number of corrections applied by the decoders during the shot. The test can therefore now accommodate up to 32 logical qubits with no restrictions on distance.
Stationary window removed; now either monolithic decoding or sliding window. See the performance note below.
Depends on #656 and #671.
Runtime / performance impact
The removal of the stationary decoding window affected some multi-error-lut tests, as the LUT tables were too large. In particular, I had to reduce the number of rounds in the surface-code-1-quantinuum distance=5 test, although it still represents a performance regression on it and some similar tests. I'm open to re-introducing the decoder window if we want to keep that functionality, but as it doesn't represent a proper decoding flow, I prefer to remove it.
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.