[QEC] Relax surface_code-1 emulate test tolerances for noise-model runs - #776
Merged
bmhowe23 merged 1 commit intoAug 7, 2026
Conversation
The two surface_code-1 --target quantinuum --emulate tests assert that the
live generate-and-decode run finds exactly 0 residual logical errors, on the
premise recorded in the CMake comment that "QIR emulation applies no noise".
That premise no longer holds on recent CUDA-Q. surface_code-1 attaches its
circuit-level depolarizing noise through a host-side cudaq::noise_model
handed to cudaq::run, and the noise model travels on the ExecutionContext:
runtime/common/ExecutionContext.h const noise_model *noiseModel;
runtime/nvqir/CircuitSimulator.h noiseModel = context.noiseModel;
if (!noiseModel) return; // no noise
CUDA-Q's emulated shot loop used to clear the thread-local execution context
for the duration of the loop, as a workaround for qubit deallocation being
skipped while a context is set. With the context cleared the simulator saw a
null noise model and every emulated shot ran noiselessly, which is what the
0-error expectation encoded. NVIDIA/cuda-quantum#5051 removed that workaround
in favour of a typed execution-mode flag, so the context -- and with it the
noise model -- now stays visible and the shots are genuinely noisy.
Nothing about the compiled program changed: the emitted QIR is byte-identical
for p_cnot=0.001 and p_cnot=0.2, and contains no noise operations at all. The
channels are injected by the simulator at runtime, keyed on gate name. Driving
p_cnot to ~0 yields 0 errors and 0 corrections, confirming the circuit itself
is unaffected.
Measured against cuda-quantum@edcb4b1b, the emulated runs now land in the same
regime as the local Stim runs:
distance 3 emulate 7 non-zero / 56 corrections local 6 / 71
distance 5 emulate 12 / 43
So bound the residual logical errors at 60, matching the local tests, and
leave the corrections bound at 0. The corrections bound is a lower bound and
was already vacuous at 0, so this does not weaken any check that was
previously meaningful. Both tests then pass whether or not the CUDA-Q in use
delivers the noise model, which lets this land ahead of any CUDA-Q bump.
surface_code-2 and surface_code-4-yaml are untouched: they apply noise
in-kernel via cudaq::apply_noise, which the erase-noise pass strips before
codegen for both hardware and emulation targets, so they never depended on
the cleared-context behaviour.
Verified with cuda-quantum@edcb4b1b installed:
app_examples.surface_code-1-quantinuum-emulate-test-distance-3-in-process
passes with the new bounds and fails with the old ones.
Signed-off-by: Ben Howe <bhowe@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.
The two surface_code-1 --target quantinuum --emulate tests assert that the live generate-and-decode run finds exactly 0 residual logical errors, on the premise recorded in the CMake comment that "QIR emulation applies no noise".
That premise no longer holds on recent CUDA-Q (since NVIDIA/cuda-quantum#5051. surface_code-1 attaches its circuit-level depolarizing noise through a host-side cudaq::noise_model handed to cudaq::run, and the noise model travels on the ExecutionContext