Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic in dump reordering after swap #67

Merged
merged 1 commit into from
May 12, 2023
Merged

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented May 12, 2023

This fixes an issue where state dump could crash if run after a swap of qubit ids. Specifically, a qubit id swap followed by a release of one of the qubits can put the id map into a state where not every desired id for the swap is occupied by an existing qubit. As a result, updating the map for the swapped key should be a best effort and not a panic if the key is not present. Also adds a unit test to cover this specific case.

This fixes an issue where state dump could crash if run after a swap of qubit ids. Specifically, a qubit id swap followed by a release of one of the qubits can put the id map into a state where not every desired id for the swap is occupied by an existing qubit. As a result, updating the map for the swapped key should be a best effort and not a panic if the key is not present.  Also adds a unit test to cover this specific case.
@swernli swernli requested review from idavis and billti as code owners May 12, 2023 17:27
@swernli swernli enabled auto-merge (squash) May 12, 2023 17:44
@swernli swernli merged commit 7141d6e into main May 12, 2023
@swernli swernli deleted the swernli/fix-dump-after-swap branch May 12, 2023 18:58
swernli added a commit to microsoft/qsharp that referenced this pull request May 12, 2023
This change includes two bugfixes:

- Evaluator now checks for qubit argument uniques on intrinsic gate invocation to avoid triggering a panic in the simulator (treated instead as a runtime error).
- Updates to a simulator package with the bug fix for dumping state after a swap of two qubits where one has been released (see qir-alliance/qir-runner#67)
swernli added a commit to microsoft/qsharp that referenced this pull request May 12, 2023
This change includes two bugfixes:

- Evaluator now checks for qubit argument uniques on intrinsic gate
invocation to avoid triggering a panic in the simulator (treated instead
as a runtime error).
- Updates to a simulator package with the bug fix for dumping state
after a swap of two qubits where one has been released (see
qir-alliance/qir-runner#67)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants