-
Notifications
You must be signed in to change notification settings - Fork 130
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
base: main
Are you sure you want to change the base?
Support for qubit loss #2567
Conversation
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
Change in memory usage detected by benchmark. Memory Report for e8ac9f3
|
@@ -633,6 +636,11 @@ operation ccz(ctrl1 : Qubit, ctrl2 : Qubit, target : Qubit) : Unit is Adj + Ctl | |||
h(target); | |||
} | |||
|
|||
operation mresetzchecked(q : Qubit) : Result[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of mresetzchecked
as the name here, but I'm not familiar enough with the naming conventions in OpenQASM to suggest an alternative. @idavis and @orpuente-MS, any suggestions? Something like mresetz_checked
or other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a real naming standard for defs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mresetz_checked
is easier to read. I would go with that instead. About the naming standard, they use both snake_case and camelCase in the official spec. So, I would just pick one (snake case is my personal preference).
Change in memory usage detected by benchmark. Memory Report for 1ae48a7
|
Change in memory usage detected by benchmark. Memory Report for 804715b
|
Change in memory usage detected by benchmark. Memory Report for 6d5684f
|
Change in memory usage detected by benchmark. Memory Report for 14cfb62
|
This PR adds support for qubit loss to the QDK. In particular, it adds the following features:
ApplyIdleNoise
), treating futher operations on that qubit as no-op.Zero
norOne
during measurement but a specialLoss
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.__quantum__rt__read_loss
runtime function (may not be supported on all QIR targets).Additional features:
qsharp.run
Fixes #2484, fixes #2483