Repository navigation
Reload a lost qubit on Reset in the GPU simulator - #4352
Open
Andrew Casey (amcasey) wants to merge 1 commit into
Open
Andrew Casey (amcasey) wants to merge 1 commit into
Andrew Casey (amcasey) wants to merge 1 commit into
Conversation
The GPU shader's prep_measure_reset returned early for a Reset of a lost qubit without clearing its loss marker, so the qubit stayed lost and later gates on it were skipped, unlike on the CPU and stabilizer simulators. The reset branch now marks the qubit as not lost, as the measuring branch already does; a lost qubit was already collapsed and reset to |0> when it was lost, so its state needs no update. Regression tests cover the Adaptive and Base paths, with the same expectation checked on the CPU simulators. Not run on a GPU: none was available where this was written. Fixes #4250 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the GPU reset fix restoring lost-qubit reuse.
No open issues 🎉
What changed in this PR
Fixes #4250 by making GPU Reset reload lost qubits, matching CPU and stabilizer simulator behavior.
Changes:
- Clear the qubit’s loss marker when resetting a lost qubit.
- Add Base and Adaptive regression tests verifying that subsequent gates execute after reset.
| File | Description |
|---|---|
| source/simulators/src/gpu_full_state_simulator/gpu_statevector_shaders.wgsl | Clear the loss marker on reset. |
| source/qdk_package/tests/test_simulators_gates_noisy.py | Test reset and qubit reuse through Base QIR. |
| source/qdk_package/tests/test_adaptive_gpu_noise.py | Add Adaptive GPU regression coverage. |
| source/qdk_package/tests/test_adaptive_cpu_noise.py | Verify matching Adaptive CPU behavior. |
Review effort: Balanced
Andrew Casey (amcasey)
marked this pull request as ready for review
December 2, 2026 21:53
Andrew Casey (amcasey)
requested review from
Bill Ticehurst (billti),
Ian Davis (idavis) and
orpuente-MS
as code owners
December 2, 2026 21:53
This branch has not been deployed
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 GPU shader's prep_measure_reset returned early for a Reset of a lost qubit without clearing its loss marker, so the qubit stayed lost and later gates on it were skipped, unlike on the CPU and stabilizer simulators. The reset branch now marks the qubit as not lost, as the measuring branch already does; a lost qubit was already collapsed and reset to |0> when it was lost, so its state needs no update. Regression tests cover the Adaptive and Base paths, with the same expectation checked on the CPU simulators.
Fixes #4250