Skip to content

Support for qubit loss #2567

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

Merged
merged 28 commits into from
Jul 9, 2025
Merged

Support for qubit loss #2567

merged 28 commits into from
Jul 9, 2025

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented Jun 26, 2025

This PR adds support for qubit loss to the QDK. In particular, it adds the following features:

  • Simulator with configured qubit loss will probabilistically "lose" qubits during application of noise (ie: any gates, measurements, or calls to ApplyIdleNoise), treating futher operations on that qubit as no-op.
  • Qubits that are lost return neither Zero nor One during measurement but a special Loss value that cannot be used in comparisons, triggering a runtime failure if it is.
  • Std.Diagnostics.ConfigureQubitLoss to configure the probability of qubit loss on any operation.
  • Std.Measurement.MResetZChecked which returns a tuple of (Result, Bool) by checking for qubit loss as part of measurement.
  • Loss checks generate into QIR by emitting the __quantum__rt__read_loss runtime function (may not be supported on all QIR targets).

Additional features:

  • Extension setting alongside Pauli noise for configuring loss probability during histogram generation
  • OpenQASM support for special measurement that returns loss bit, exposed via new "qdk.inc" special include
  • Python API for configuring loss probability on calls to qsharp.run
  • Samples for configuring and detecting loss

Fixes #2484, fixes #2483

swernli added 3 commits June 26, 2025 16:40
This PR adds support for qubit loss to the QDK. In particular, it adds the following features:

- Simulator with configured qubit loss will probabilistically "lose" qubits during application of noise (ie: any gates, measurements, or calls to `ApplyIdleNoise`), treating futher operations on that qubit as no-op.
- Qubits that are lost return neither `Zero` nor `One` during measurement but a special `Loss` value that cannot be used in comparisons, triggering a runtime failure if it is.
- `Std.Diagnostics.ConfigureQubitLoss` to configure the probability of qubit loss on any operation.
- `Std.Measurement.MResetZChecked` which returns a tuple of `(Result, Bool)` by checking for qubit loss as part of measurement.
- Loss checks generate into QIR by emitting the `__quantum__rt__read_loss` runtime function (may not be supported on all QIR targets).

TODO:
 - [ ] Extension setting alongside Pauli noise for configuring loss probability during histogram generation
 - [ ] OpenQASM support for special measurement that returns loss bit
 - [ ] Python API for configuring loss probability on calls to `qsharp.run`
 - [ ] Samples

 Fixes #2484, #2483
@swernli swernli marked this pull request as ready for review July 1, 2025 20:06
Copy link

github-actions bot commented Jul 1, 2025

Change in memory usage detected by benchmark.

Memory Report for e8ac9f3

Test This Branch On Main Difference
compile core + standard lib 25719654 bytes 25682478 bytes 37176 bytes

Copy link

github-actions bot commented Jul 1, 2025

Change in memory usage detected by benchmark.

Memory Report for 1ae48a7

Test This Branch On Main Difference
compile core + standard lib 25719654 bytes 25682478 bytes 37176 bytes

Copy link

github-actions bot commented Jul 1, 2025

Change in memory usage detected by benchmark.

Memory Report for 804715b

Test This Branch On Main Difference
compile core + standard lib 25719654 bytes 25682478 bytes 37176 bytes

Copy link

github-actions bot commented Jul 2, 2025

Change in memory usage detected by benchmark.

Memory Report for 6d5684f

Test This Branch On Main Difference
compile core + standard lib 25719654 bytes 25682478 bytes 37176 bytes

Copy link

github-actions bot commented Jul 2, 2025

Change in memory usage detected by benchmark.

Memory Report for 14cfb62

Test This Branch On Main Difference
compile core + standard lib 25719654 bytes 25682478 bytes 37176 bytes

Copy link

github-actions bot commented Jul 2, 2025

Change in memory usage detected by benchmark.

Memory Report for 669e265

Test This Branch On Main Difference
compile core + standard lib 25719654 bytes 25682478 bytes 37176 bytes

Copy link

github-actions bot commented Jul 7, 2025

Change in memory usage detected by benchmark.

Memory Report for 5aea8d8

Test This Branch On Main Difference
compile core + standard lib 25723302 bytes 25682478 bytes 40824 bytes

Copy link

github-actions bot commented Jul 7, 2025

Change in memory usage detected by benchmark.

Memory Report for 57f2b0a

Test This Branch On Main Difference
compile core + standard lib 25723302 bytes 25682478 bytes 40824 bytes

Copy link

github-actions bot commented Jul 7, 2025

Change in memory usage detected by benchmark.

Memory Report for 5db9cae

Test This Branch On Main Difference
compile core + standard lib 25210566 bytes 25172910 bytes 37656 bytes

Copy link

github-actions bot commented Jul 7, 2025

Change in memory usage detected by benchmark.

Memory Report for 5a3bb11

Test This Branch On Main Difference
compile core + standard lib 25210566 bytes 25172910 bytes 37656 bytes

Copy link

github-actions bot commented Jul 8, 2025

Change in memory usage detected by benchmark.

Memory Report for 316efa3

Test This Branch On Main Difference
compile core + standard lib 25210566 bytes 25172910 bytes 37656 bytes

Copy link

github-actions bot commented Jul 8, 2025

Change in memory usage detected by benchmark.

Memory Report for 6941e18

Test This Branch On Main Difference
compile core + standard lib 25210566 bytes 25172910 bytes 37656 bytes

Copy link

github-actions bot commented Jul 8, 2025

Change in memory usage detected by benchmark.

Memory Report for 1c18ba4

Test This Branch On Main Difference
compile core + standard lib 25210566 bytes 25172910 bytes 37656 bytes

Copy link

github-actions bot commented Jul 9, 2025

Change in memory usage detected by benchmark.

Memory Report for 2688643

Test This Branch On Main Difference
compile core + standard lib 25211510 bytes 25172910 bytes 38600 bytes

@swernli swernli enabled auto-merge July 9, 2025 17:10
@swernli swernli added this pull request to the merge queue Jul 9, 2025
Merged via the queue into main with commit 004f69b Jul 9, 2025
18 checks passed
@swernli swernli deleted the swernli/qubit-loss branch July 9, 2025 17:48
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.

Simulation of atom loss Library and/or guidance for dealing with atom loss
5 participants