Skip to content

Conversation

antalsz
Copy link
Contributor

@antalsz antalsz commented Sep 19, 2025

This change extends Quil-T with the ability to specify multiple distinct calibrations for measuring a single qubit, allowing us to distinguish MEASURE 0 ro and MEASURE!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

There are additional sections, called annexes, which are optional extensions to the Quil language. These extensions may modify the syntax or semantics of the base specification in noted ways.

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!midcircuit for 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 MEASURE instruction, which measures a single qubit in one of two ways:

Measurement for Effect⟩ ::= MEASUREFormal Qubit

Measurement for Record⟩ ::= MEASUREFormal Qubit⟩ ⟨Memory Reference

Measurement Instruction⟩ ::= ⟨Measurement for Effect⟩ | ⟨Measurement for Record

This physical interpretation of this measurement is done by the DEFCAL MEASURE calibration, which can specify one interpretation for each of those two forms of measurement:

Measure Calibration⟩ ::= DEFCAL MEASUREFormal Qubit⟩ ⟨Identifier⟩? :Instruction⟩+

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 RESET is 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 conditional RESET in 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 q for a given qubit q. We indicate these with a !bang; MEASURE!midcircuit 0 ro indicates a distinct measurement operation from MEASURE 0 ro.

@antalsz antalsz force-pushed the 90-quil-t-extension-named-measurements branch from 4445af9 to 5c1c4ba Compare October 18, 2025 01:02
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.

Proposal: Named measurements

1 participant