Quil-T extension: Named measurements#97
Open
antalsz wants to merge 4 commits intoquil-lang:masterfrom
Open
Conversation
This was referenced Sep 20, 2025
4445af9 to
5c1c4ba
Compare
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.
This change extends Quil-T with the ability to specify multiple distinct calibrations for measuring a single qubit, allowing us to distinguish
MEASURE 0 roandMEASURE!midcircuit 0 ro. You can read the rendered form of the specification with these changes.Since the discussion of named measurements in #90 has calmed down, it seems like it's time to advance this proposal as a PR which resolves #90.
In particular, I believe the right way to think about named measurements is as a Quil-T extension to Quil, just as we think about all pulse-level functionality. This is indeed the point of having annexes to the main specification; as the specification says in §1.2
Thus, I have only modified the main body of the Quil specification by adding a forwards-looking note to §7, "Measurements", indicating that Quil-T modifies these productions. The remaining changes are exclusively to Annex T.
I went with the syntax
MEASURE!midcircuitfor named measurements, as this seemed to capture the annotation-like form that we wanted and there was some concern about parentheses and brackets being too overloaded to use.Note that this PR also includes the changes from #96, which can be reviewed separately or simply superseded by this PR.
I'll recapitulate the motivation from #90 below, slightly modified for this new context.
Currently, Quil-T only supports one form of measurement: the
MEASUREinstruction, which measures a single qubit in one of two ways:This physical interpretation of this measurement is done by the
DEFCAL MEASUREcalibration, which can specify one interpretation for each of those two forms of measurement:For each qubit, then, Quil-T provides only two ways to realize measurement: one way for effect and one way for retrieving the data. However, we somewhat regularly find ourselves needing to support measurements in ways that go beyond this. In particular:
Midcircuit measurement often needs a lighter touch than end-of-circuit measurement, to avoid destroying the qubit state entirely, so we want a midcircuit measurement of a qubit to be realized with a lighter touch than our end-of-circuit result collection.
Conditional
RESETis implemented in terms of a measurement operation, but one that may benefit from its own physical realization; at a minimum, it wants to look like midcircuit measurement. We do not address how to specify conditionalRESETin this proposal, but it would be most natural to build it on this functionality.In order to solve this, we would like to have multiple distinct physical realizations of
MEASURE qfor a given qubitq. We indicate these with a!bang;MEASURE!midcircuit 0 roindicates a distinct measurement operation fromMEASURE 0 ro.