[STIM] Support peek_loss - #3550
Open
João Boechat (joao-boechat) wants to merge 15 commits into
Open
Conversation
|
|
||
| // PEEK_LOSS: Reports whether a qubit was lost, but doesn't | ||
| // collapse the state. | ||
| case OP_PEEK_LOSS { |
There was a problem hiding this comment.
Being this is in the adaptive kernel, does this mean you can't use PEEK_LOSS in base profile programs? (Makes sense that you can't, we should just ensure that only adaptive programs are able to use it and give a useful error otherwise.
Contributor
Author
There was a problem hiding this comment.
The user currently can only run this instruction via qdk-stim (unless they type QIR directly, which is unusual), and by default the qdk stim compiler only generates adaptive profile QIR. In the future, we might also generate base profile, and will look into this again.
João Boechat (joao-boechat)
marked this pull request as ready for review
August 17, 2026 21:04
João Boechat (joao-boechat)
requested review from
Andrew Casey (amcasey),
Ian Davis (idavis),
orpuente-MS and
Stefan J. Wernli (swernli)
as code owners
August 17, 2026 21:04
…noise' into joaoboechat/support-peek-loss
João Boechat (joao-boechat)
changed the base branch from
main
to
joaoboechat/support-mpp-readout-noise
August 19, 2026 21:52
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.
Overview
This change adds end-to-end support for STIM's
PEEK_LOSSinstruction, allowing adaptive programs to report whether a qubit is lost without collapsing its state. The instruction produces a measurement-record result that can drive classical control while preserving the qubit for subsequent operations.STIM compiler
PEEK_LOSS, broadcasts it across qubit targets, allocates its result records, and lowers it to the__quantum__qis__peek_loss__bodyQIR intrinsic.PEEK_LOSSso they can be used by normal classical controls while rejecting unsupportedNOTLEAKEDreferences to those records. The reason why we don't allowNOTLEAKEDto reference a measurement record generated byPEEK_LOSSis simply because combining both instructions is ambiguous and doesn't make semantical sense.Adaptive execution
PEEK_LOSSadaptive bytecode opcode and emits it from the Python adaptive-profile pass.Onefor a lost qubit andZerootherwise.