quil icon indicating copy to clipboard operation
quil copied to clipboard

Improve Quilt RFC

Open kalzoo opened this issue 3 years ago • 2 comments

Related to https://github.com/rigetti/pyquil/pull/1257, which will by default serve as the reference implementation of Quilt.

Mismatches between RFC and implemented grammar:

  • [ ] OpModifier used in place of GateModifier: CalibrationDefinition :: DEFCAL OpModifier* Name ( Parameter+ ) Qubit+ : Instruction+
  • [ ] SetPhase :: SET-PHASE Frame Float should be SetPhase :: SET-PHASE Frame Expression to match grammar
  • [ ] The inline spec for DEFCAL MEASURE shows a Name: MeasureCalibrationDefinition :: DEFCAL Name Qubit? Parameter : Instruction+, but the example doesn't match that spec: DEFCAL MEASURE 0 %dest:, and the implemented grammar is defMeasCalibration : DEFCAL MEASURE qubitOrFormal ( name )? COLON ( NEWLINE TAB instr )* ; which disagrees with both (example shows a variable not name)

Doc Improvements & Bugfixes:

  • [ ] No DEFFRAME example
  • [ ] Raw-capture example uses CAPTURE keyword: CAPTURE 0 "out" 200e-6 iqs
  • [ ] Example for DEFCAL MEASURE missing MEASURE
  • [ ] Typo: There is also support for shifted the phase
  • [ ] Are all frame attributes optional in a DEFFRAME?
  • [ ] Frame attribute CENTER-FREQUENCY missing in spec but present in grammar
  • [ ] LT instruction in example not described in spec (here or in main spec): LT %dest iq[0] 0.5 # thresholding

Spec improvements:

  • [ ] DELAY grammar is the only item which requires left recursion, because the required expression could match as an identifier. Is that worth reconsideration?
  • [ ] DEFCIRCUIT includes CircuitGates within its instruction block, which is the version of Gate with variable qubits. DELAY and FENCE, though, just allow variable qubits in the base instruction instead of a distinct CircuitDelay or CalibrationDelay. Is it worth reconsideration of CircuitGate to collapse it with Gate for consistency?

kalzoo avatar Oct 15 '20 19:10 kalzoo

Just a comment here -- working on a PR that addresses some of the other points

LT was afaik not in the original Quil spec, but is part of the "typed memory" extension, and documented here https://github.com/rigetti/quil/blob/master/rfcs/typed-memory.md

braised-babbage avatar Oct 15 '20 21:10 braised-babbage

Another: an example of CAPTURE 0 "out" flat(1e-6, 2+3i) iq doesn't name the parameters in the waveform invocation, which the grammar requires:

namedParam          : IDENTIFIER COLON expression ;
waveform            : waveformName (LPAREN namedParam ( COMMA namedParam )* RPAREN)? ;

This example, which invokes a waveform as part of an expression:

PULSE 0 "xy" flat(duration: 1e-6, iq: 2+3i)*%theta/(2*pi)

# Pulse definition:
pulse               : NONBLOCKING? PULSE frame waveform ;

# Waveform definition:
waveform            : waveformName (LPAREN namedParam ( COMMA namedParam )* RPAREN)? ;

kalzoo avatar Oct 16 '20 00:10 kalzoo