‘pulse’ Dialect#

Linear-typed MLIR dialect for pulse-level quantum control

The pulse dialect provides explicit timing control and pulse-level operations on quantum hardware with compile-time verification of drive-operation exclusivity, monotone time, and tone-as-linear-resource semantics.

Key concepts:

  • Lines: Drive and readout lines connected to qudits (linear resources)

  • Tones: Carrier signals with frequency and phase (linear resources)

  • Waveforms: Pulse envelopes (value types, freely copyable)

  • Timing: Current time tracked per line, explicit waits and syncs

  • Waveform algebra: Element-wise add/sub/mul/scale/neg on envelopes

Durations are in cycles of the program clock (the clock of the module’s pulse.control_system); scheduling records each timed op’s start_cycles and duration_cycles in the same unit.

Example:

  %q0 = pulse.qudit_alloc {qudit = 0 : i64} : !pulse.qudit
  %d0, %tone_q0 = pulse.get_drive_line %q0
      : (!pulse.qudit) -> (!pulse.drive_line, !pulse.tone)
  %duration = arith.constant 40 : i64
  %amplitude = arith.constant 0.3 : f64
  %sigma = arith.constant 10.0 : f64
  %wf = pulse.gaussian %duration, %amplitude, %sigma
      : i64, f64, f64 -> !pulse.waveform
  %d0_out, %tone_out = pulse.drive %d0, %wf, %tone_q0
      : !pulse.drive_line, !pulse.waveform, !pulse.tone
      -> !pulse.drive_line, !pulse.tone

Operations#

pulse.add (::pulse::PulseAddOp)#

Add two waveforms element-wise

Syntax:

operation ::= `pulse.add` $lhs `,` $rhs attr-dict `:` qualified(type($result))

The element-wise sum of two waveforms. Both must have the same duration when it is known; a mismatch is an error rather than a truncation.

Traits: AlwaysSpeculatableImplTrait, Commutative

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

lhs

Pulse envelope shape (value type, not linear)

rhs

Pulse envelope shape (value type, not linear)

Results:#

Result

Description

result

Pulse envelope shape (value type, not linear)

pulse.call (::pulse::CallOp)#

Run a function scheduled on its own, placed as one unit

Syntax:

operation ::= `pulse.call` $callee `(` $args `)` `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` functional-type($args, results)

Runs callee, a function of the module with a schedule of its own, at one start time: every timed op of the callee keeps its start relative to the call’s start, wherever and however often it is called.

Lines, tones and measurements cross as with pulse.schedule_block: each timed operand is the callee’s matching argument, and each result is what the callee returns at that place. A line or tone that enters the call continues as one of its results. Numbers (f64, i64) are the values at the call.

The callee records its length in pulse.length_cycles. A placed call lasts duration_cycles, at least that length. When it lasts longer, every line the callee plays on is held until the call’s end, so nothing else plays on it before then.

func.func private @x90(%d: !pulse.drive_line, %t: !pulse.tone)
    -> (!pulse.drive_line, !pulse.tone)
    attributes {pulse.length_cycles = 40 : i64} { ... }

%d1, %t1 = pulse.call @x90(%d0, %t0) <{duration_cycles = 40 : i64, start_cycles = 8 : i64}>
    : (!pulse.drive_line, !pulse.tone) -> (!pulse.drive_line, !pulse.tone)

Interfaces: SymbolUserOpInterface

Attributes:#

AttributeMLIR TypeDescription
callee::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands:#

Operand

Description

args

variadic of any type

Results:#

Result

Description

results

variadic of a pulse line, tone, measurement, link or call handle

pulse.cosine (::pulse::CosinePulseOp)#

Create a raised-cosine envelope pulse

Syntax:

operation ::= `pulse.cosine` $duration `,` $amplitude attr-dict `:` type($duration) `,` type($amplitude) `->` type($pulse)

A raised-cosine envelope amplitude (1 - cos(2 pi t / duration)) / 2 over duration clock cycles, zero at both ends.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

64-bit signless integer

amplitude

floating-point

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.create_iq (::pulse::CreateIQOp)#

Create IQ data from I and Q values

Syntax:

operation ::= `pulse.create_iq` $i_value `,` $q_value attr-dict `:` type($i_value) `,` type($q_value) `->` qualified(type($iq_data))

An IQ point from its in-phase and quadrature components.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

i_value

64-bit float

q_value

64-bit float

Results:#

Result

Description

iq_data

Raw IQ signal data from readout (value type)

pulse.custom (::pulse::CustomOp)#

Create a custom waveform via callback function

Syntax:

operation ::= `pulse.custom` $callee `,` $duration attr-dict `:` type($duration) `->` type($pulse)

A waveform whose envelope is the function callee, for compiler experiments. Execution needs samples, so the GPU lowering rejects it until a pass specializes it to pulse.custom_samples.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:#

AttributeMLIR TypeDescription
callee::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands:#

Operand

Description

duration

64-bit signless integer

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.custom_samples (::pulse::CustomSamplesOp)#

Create a waveform from raw sample data

Syntax:

operation ::= `pulse.custom_samples` $samples attr-dict `:` type($pulse)

A waveform from explicit real samples, each held constant until the next. Without rate there is one sample per clock cycle, so the duration is the number of samples; with rate = array<i64: n, d> there are n samples every d cycles (the rate of the line’s controller the samples were made for), and the samples must last a whole number of cycles. The array must not be empty.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:#

AttributeMLIR TypeDescription
samples::mlir::ArrayAttr64-bit float array attribute
rate::mlir::DenseI64ArrayAttri64 dense array attribute

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.drag (::pulse::DRAGPulseOp)#

Create a DRAG pulse for reducing leakage

Syntax:

operation ::= `pulse.drag` $duration `,` $amplitude `,` $sigma `,` $beta attr-dict `:` type($duration) `,` type($amplitude) `,` type($sigma) `,` type($beta) `->` type($pulse)

A DRAG envelope, G + i beta dG/dt for the Gaussian G of pulse.gaussian: the imaginary part is -beta (t - duration / 2) / sigma^2 times G. sigma and beta are in clock cycles. Leakage of a transmon is smallest near beta = -1 / alpha, for the anharmonicity alpha in radians per clock cycle.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

64-bit signless integer

amplitude

floating-point

sigma

floating-point

beta

floating-point

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.drive (::pulse::DriveOp)#

Apply a waveform to a drive line at a tone

Syntax:

operation ::= `pulse.drive` $line `,` $pulse `,` $tone `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` qualified(type($line))
              `,` qualified(type($pulse)) `,` qualified(type($tone))
              `->` qualified(type($updated_line)) `,` qualified(type($updated_tone))

Applies a waveform to a drive line at the specified tone’s frequency and phase. Advances line time by pulse duration. Returns the updated drive line and tone. The tone’s frame is as the frame changes before the drive on that tone left it: a change takes effect at the next pulse.

Operands:#

Operand

Description

line

Physical drive channel (linear resource)

pulse

Pulse envelope shape (value type, not linear)

tone

Carrier signal tone (frequency and phase, linear resource)

Results:#

Result

Description

updated_line

Physical drive channel (linear resource)

updated_tone

Carrier signal tone (frequency and phase, linear resource)

pulse.duration_from_int (::pulse::DurationFromIntOp)#

Convert an integer to a duration

Syntax:

operation ::= `pulse.duration_from_int` $cycles attr-dict `:` functional-type(operands, results)

A !pulse.duration of cycles clock cycles, as pulse.wait takes.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

cycles

64-bit signless integer

Results:#

Result

Description

duration

Time interval in clock cycles

pulse.duration_to_int (::pulse::DurationToIntOp)#

Convert a duration to an integer

Syntax:

operation ::= `pulse.duration_to_int` $duration attr-dict `:` functional-type(operands, results)

The number of clock cycles of a duration.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

Time interval in clock cycles

Results:#

Result

Description

cycles

64-bit signless integer

pulse.extract_iq (::pulse::ExtractIQOp)#

Extract I and Q components from IQ data

Syntax:

operation ::= `pulse.extract_iq` $iq_data attr-dict `:` qualified(type($iq_data)) `->` type($i_value) `,` type($q_value)

The in-phase and quadrature components of an IQ point.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

iq_data

Raw IQ signal data from readout (value type)

Results:#

Result

Description

i_value

64-bit float

q_value

64-bit float

pulse.gaussian (::pulse::GaussianPulseOp)#

Create a Gaussian pulse

Syntax:

operation ::= `pulse.gaussian` $duration `,` $amplitude `,` $sigma attr-dict `:` type($duration) `,` type($amplitude) `,` type($sigma) `->` type($pulse)

A Gaussian envelope over duration clock cycles, centered in the pulse, with peak amplitude and standard deviation sigma in clock cycles. Constant duration and sigma must be positive.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

64-bit signless integer

amplitude

floating-point

sigma

floating-point

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.gaussian_square (::pulse::GaussianSquarePulseOp)#

Create a flat-topped Gaussian pulse

Syntax:

operation ::= `pulse.gaussian_square` $duration `,` $amplitude `,` $sigma `,` $risefall attr-dict `:` type($duration) `,` type($amplitude) `,` type($sigma) `,` type($risefall) `->` type($pulse)

A Gaussian rising edge, a flat top at the given amplitude, and a Gaussian falling edge. risefall is the duration of each edge in clock cycles.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

64-bit signless integer

amplitude

floating-point

sigma

floating-point

risefall

64-bit signless integer

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.get_current_time (::pulse::GetCurrentTimeOp)#

Get the current time of a line as a timepoint

Syntax:

operation ::= `pulse.get_current_time` $line attr-dict `:` qualified(type($line)) `->` qualified(type($time))

The time a line has reached, as a !pulse.timepoint. The line is not consumed: a line may be read any number of times, and then played on, and a read inside a loop of a line the loop does not carry reads the same time every iteration.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

line

any pulse line type

Results:#

Result

Description

time

Abstract point in time on a line

pulse.get_drive_line (::pulse::GetDriveLineOp)#

Get the drive line and tone for a qudit

Syntax:

operation ::= `pulse.get_drive_line` $qudit (`,` $others^)? attr-dict `:` functional-type(operands, results)

Returns the drive line and native tone associated with a qudit. The returned drive line starts at time t=0.

A broadcast drive line reaches several qudits with one tone: the op names all of them, lowest index first, and a drive on the line drives every one. Its frequency_hz is the frequency of the line’s tone.

%line, %tone = pulse.get_drive_line %q0, %q1 {frequency_hz = 5.0e+09 : f64}
    : (!pulse.qudit, !pulse.qudit) -> (!pulse.drive_line, !pulse.tone)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

qudit

A qudit of the quantum system

others

variadic of A qudit of the quantum system

Results:#

Result

Description

line

Physical drive channel (linear resource)

tone

Carrier signal tone (frequency and phase, linear resource)

pulse.get_readout_line (::pulse::GetReadoutLineOp)#

Get the readout line and tone for a qudit

Syntax:

operation ::= `pulse.get_readout_line` $qudit attr-dict `:` functional-type(operands, results)

The readout line and readout tone of a qudit. As with pulse.get_drive_line, the line starts at time 0 and is a linear value: each op that uses it returns the updated line, which the next op on the line consumes.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

qudit

A qudit of the quantum system

Results:#

Result

Description

line

Physical readout channel (linear resource)

tone

Carrier signal tone (frequency and phase, linear resource)

pulse.iq_acquire (::pulse::IQAcquireOp)#

Acquire raw IQ data from a readout line

Syntax:

operation ::= `pulse.iq_acquire` $line `,` $pulse `,` $tone attr-dict `:` qualified(type($line))
              `,` qualified(type($pulse)) `,` qualified(type($tone))
              `->` qualified(type($updated_line)) `,` qualified(type($updated_tone))
              `,` qualified(type($iq_data))

Plays pulse on a readout line at tone and returns the raw demodulated IQ point instead of a discriminated measurement. Like pulse.readout, it returns the updated line and tone, so one tone can be acquired with again. Unlike pulse.readout, it is not scheduled: it gets no start or duration, and the controller export has no event for it.

Operands:#

Operand

Description

line

Physical readout channel (linear resource)

pulse

Pulse envelope shape (value type, not linear)

tone

Carrier signal tone (frequency and phase, linear resource)

Results:#

Result

Description

updated_line

Physical readout channel (linear resource)

updated_tone

Carrier signal tone (frequency and phase, linear resource)

iq_data

Raw IQ signal data from readout (value type)

pulse.iq_magnitude (::pulse::IQMagnitudeOp)#

Compute magnitude of IQ data: sqrt(I^2 + Q^2)

Syntax:

operation ::= `pulse.iq_magnitude` $iq_data attr-dict `:` qualified(type($iq_data)) `->` type($magnitude)

The magnitude sqrt(I^2 + Q^2) of an IQ point.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

iq_data

Raw IQ signal data from readout (value type)

Results:#

Result

Description

magnitude

64-bit float

pulse.iq_phase (::pulse::IQPhaseOp)#

Compute phase of IQ data: atan2(Q, I)

Syntax:

operation ::= `pulse.iq_phase` $iq_data attr-dict `:` qualified(type($iq_data)) `->` type($phase)

The phase atan2(Q, I) of an IQ point, in radians.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

iq_data

Raw IQ signal data from readout (value type)

Results:#

Result

Description

phase

64-bit float

pulse.is_set (::pulse::IsSetOp)#

Whether a readout observed a nonzero level

Syntax:

operation ::= `pulse.is_set` $measurement attr-dict `:` qualified(type($measurement)) `->` type($condition)

true when the pulse.readout producing measurement observed any level other than 0: the truth value a kernel tests with if result:. Measurement-conditioned feedback is an scf.if on this condition, with the lines and tones either branch advances passed through scf.yield:

%bit = pulse.is_set %m : !pulse.measurement -> i1
%d1, %t1 = scf.if %bit -> (!pulse.drive_line, !pulse.tone) {
  %d, %t = pulse.drive %d0, %x, %t0 : ...
  scf.yield %d, %t : !pulse.drive_line, !pulse.tone
} else {
  scf.yield %d0, %t0 : !pulse.drive_line, !pulse.tone
}

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

measurement

The level a readout observed

Results:#

Result

Description

condition

1-bit signless integer

pulse.leave_if (::pulse::LeaveIfOp)#

Leave the loop around it here when a flag is set

Syntax:

operation ::= `pulse.leave_if` $flag (`,` $values^)? `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `` custom<CarriedTypes>(type($values), type($kept))

The place in a round of an scf.for where the loop is left while the program runs. The loop’s bounds stay constants: they are the most rounds it runs.

It takes the flag and one value for each value the loop carries (its iter_args), in their order and of their types. When the flag is set, the loop ends there and its results are those values: the rest of the round and the rounds after it do not run. When it is not, the op’s results are the same values, the rest of the round runs with them, and scf.yield carries on as in any loop. A loop whose flag is never set runs all its rounds and gives what scf.yield gives.

Lines and tones are used once: the op takes each one the loop carries and gives it back, as pulse.sync does with lines, so every line the loop carries meets there.

The op stands directly in the body of its loop (not in a branch of it), anywhere in the round, and a loop has at most one. The flag is any i1.

%d9, %t9, %r9, %u9 = scf.for %i = %c0 to %c16 step %c1
    iter_args(%d = %d0, %t = %t0, %r = %r0, %u = %u0)
    -> (!pulse.drive_line, !pulse.tone, !pulse.readout_line, !pulse.tone) {
  %r1, %u1, %m = pulse.readout %r, %ro, %u, iq : ...
  %d1, %r2 = pulse.sync %d, %r1 : ...
  %one = pulse.is_set %m : !pulse.measurement -> i1
  %zero = arith.xori %one, %true : i1
  %d2, %t2, %r3, %u2 = pulse.leave_if %zero, %d1, %t, %r2, %u1
      : !pulse.drive_line, !pulse.tone, !pulse.readout_line, !pulse.tone
  %d3, %t3 = pulse.drive %d2, %x, %t2 : ...
  %d4, %r4 = pulse.sync %d3, %r3 : ...
  scf.yield %d4, %t3, %r4, %u2 : ...
}

The schedule passes, pulse-simplify-control-flow, pulse-verify, the lowering to the simulator and load() do not take a loop that holds one yet; each refuses it by name.

Operands:#

Operand

Description

flag

1-bit signless integer

values

variadic of any type

Results:#

Result

Description

kept

variadic of any type

pulse.mul (::pulse::PulseMulOp)#

Multiply two waveforms element-wise

Syntax:

operation ::= `pulse.mul` $lhs `,` $rhs attr-dict `:` qualified(type($result))

The element-wise product of two waveforms of the same duration. The drive is not linear in it, so execution samples it once per clock cycle into piecewise-constant samples.

Traits: AlwaysSpeculatableImplTrait, Commutative

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

lhs

Pulse envelope shape (value type, not linear)

rhs

Pulse envelope shape (value type, not linear)

Results:#

Result

Description

result

Pulse envelope shape (value type, not linear)

pulse.neg (::pulse::PulseNegOp)#

Negate a waveform

Syntax:

operation ::= `pulse.neg` $pulse attr-dict `:` qualified(type($result))

The waveform pulse negated.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

pulse

Pulse envelope shape (value type, not linear)

Results:#

Result

Description

result

Pulse envelope shape (value type, not linear)

pulse.outcome (::pulse::OutcomeOp)#

Level observed by a readout

Syntax:

operation ::= `pulse.outcome` $measurement attr-dict `:` qualified(type($measurement)) `->` type($level)

The level k in [0, d) that the pulse.readout producing measurement observed on its d-level qudit. Compare it with arith.cmpi to branch on a particular level of a qudit:

%k = pulse.outcome %m : !pulse.measurement -> i64
%c2 = arith.constant 2 : i64
%is2 = arith.cmpi eq, %k, %c2 : i64
scf.if %is2 { ... }

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

measurement

The level a readout observed

Results:#

Result

Description

level

64-bit signless integer

pulse.qudit_alloc (::pulse::QuditAllocOp)#

A qudit of the quantum system, by its index

Syntax:

operation ::= `pulse.qudit_alloc` attr-dict `:` type($result)

Qudit qudit of the quantum system, by its index there. Lines and tones are obtained from it with pulse.get_drive_line and pulse.get_readout_line, which find the index here.

%q = pulse.qudit_alloc {qudit = 3 : i64} : !pulse.qudit

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:#

AttributeMLIR TypeDescription
qudit::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Results:#

Result

Description

result

A qudit of the quantum system

pulse.readout (::pulse::ReadoutOp)#

Apply a readout pulse and produce a measurement result

Syntax:

operation ::= `pulse.readout` $line `,` $pulse `,` $tone `,` $mode `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` qualified(type($line))
              `,` qualified(type($pulse)) `,` qualified(type($tone))
              `->` qualified(type($updated_line)) `,` qualified(type($updated_tone))
              `,` qualified(type($result))

Plays pulse on a readout line at tone and measures the qudit, returning the updated line and tone and a !pulse.measurement. The measurement completes at the end of the pulse: pulse.is_set and pulse.outcome read it, and pulse-verify checks that ops conditioned on it start after it completes. mode names what the acquisition gives: iq (demodulated and discriminated into a level, what the frontend emits), discriminated, trace or counts. Only iq is simulated and exported so far; the others are refused there.

Readouts are numbered in walk order, the kernel’s order: a module built from a kernel in which a pass can copy a readout (one in a loop, or one after an if or a select) gives each readout its number, pulse.readout_number, before any pass runs (in another module, scheduling numbers a function’s readouts before it first copies one); without it, a readout’s number is its place among the readouts. A copy keeps the number: an op that reads a measurement run in both arms of an if on it, or a readout of a loop that scheduling peels or unrolls, which also gets pulse.readout_iteration: three integers (depth, scale, offset) per loop of the kernel around it, outermost first; its iteration of that loop is scale * k + offset, k the iteration of its enclosing scf.for at depth depth, or offset where depth is -1.

%r1, %t1, %m = pulse.readout %r0, %w, %t0, iq : ...

Operands:#

Operand

Description

line

Physical readout channel (linear resource)

pulse

Pulse envelope shape (value type, not linear)

tone

Carrier signal tone (frequency and phase, linear resource)

Results:#

Result

Description

updated_line

Physical readout channel (linear resource)

updated_tone

Carrier signal tone (frequency and phase, linear resource)

result

The level a readout observed

pulse.scale (::pulse::PulseScaleOp)#

Scale a waveform by a scalar factor

Syntax:

operation ::= `pulse.scale` $pulse `,` $scale attr-dict `:` qualified(type($pulse)) `,` type($scale) `->` qualified(type($result))

The waveform pulse times a real or complex scale.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

pulse

Pulse envelope shape (value type, not linear)

scale

floating-point or complex-type

Results:#

Result

Description

result

Pulse envelope shape (value type, not linear)

pulse.schedule_block (::pulse::ScheduleBlockOp)#

A subroutine scheduled on its own, then placed as one unit

Syntax:

operation ::= `pulse.schedule_block` $policy ` ` `(` $inputs `)` `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles, $callee) attr-dict `:` functional-type($inputs, $outputs)
              $body

The body is scheduled in isolation with its own policy (asap or alap), every input available at local time 0. The enclosing schedule then places the whole block at one start time, so the relative timing of the ops inside is the same wherever the block appears.

Lines, tones and measurements cross the boundary explicitly, as with scf.for iteration arguments: each operand is passed to the matching block argument, and the pulse.yield operands become the results. A line or tone that enters the block continues as one of its results. Values of other types (waveforms, constants) may be used from the enclosing region directly.

%d1, %t1 = pulse.schedule_block asap (%d0, %t0)
    : (!pulse.drive_line, !pulse.tone) -> (!pulse.drive_line, !pulse.tone) {
^bb0(%d: !pulse.drive_line, %t: !pulse.tone):
  %d2, %t2 = pulse.drive %d, %x, %t : ...
  pulse.yield %d2, %t2 : !pulse.drive_line, !pulse.tone
}

Scheduling inlines the block, so later passes see flat IR. Before that, the scheduler records the block’s shape on it: length_cycles, for each operand the local time it is first needed (in_offset_cycles, -1 if no timed op depends on it), and for each result the local time it is available (out_offset_cycles), or -1 with out_source naming the operand it passes through unchanged. With max_duration_cycles, scheduling fails if the block can take longer than that many cycles.

Traits: RecursiveMemoryEffects, SingleBlock

Interfaces: RegionBranchOpInterface

Attributes:#

AttributeMLIR TypeDescription
callee::mlir::StringAttrstring attribute

Operands:#

Operand

Description

inputs

variadic of a pulse line, tone, measurement, link or call handle

Results:#

Result

Description

outputs

variadic of a pulse line, tone, measurement, link or call handle

pulse.set_frequency (::pulse::SetFrequencyOp)#

Set absolute frequency of a tone

Syntax:

operation ::= `pulse.set_frequency` $tone `,` $frequency_hz `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` qualified(type($tone)) `,` type($frequency_hz) `->` qualified(type($updated_tone))

Sets the tone’s carrier frequency to frequency_hz. The frame phase stays continuous, and gains phase at the new frequency from where the program makes the change, after the waits before it on the tone’s line. It takes no time.

Operands:#

Operand

Description

tone

Carrier signal tone (frequency and phase, linear resource)

frequency_hz

64-bit float

Results:#

Result

Description

updated_tone

Carrier signal tone (frequency and phase, linear resource)

pulse.set_phase (::pulse::SetPhaseOp)#

Set absolute phase of a tone

Syntax:

operation ::= `pulse.set_phase` $tone `,` $phase_rad `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` qualified(type($tone)) `,` type($phase_rad) `->` qualified(type($updated_tone))

Sets the tone’s frame phase to phase_rad, with the sign of pulse.shift_phase. It takes no time.

Operands:#

Operand

Description

tone

Carrier signal tone (frequency and phase, linear resource)

phase_rad

64-bit float

Results:#

Result

Description

updated_tone

Carrier signal tone (frequency and phase, linear resource)

pulse.shift_frequency (::pulse::ShiftFrequencyOp)#

Apply a relative frequency shift to a tone

Syntax:

operation ::= `pulse.shift_frequency` $tone `,` $frequency_hz `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` qualified(type($tone)) `,` type($frequency_hz) `->` qualified(type($updated_tone))

Adds frequency_hz to the tone’s carrier frequency. The frame phase stays continuous, and gains phase at the new frequency from where the program makes the change, after the waits before it on the tone’s line: shifted by +d before a wait of T and by -d after it, the frame is 2 pi d T further on. It takes no time.

Operands:#

Operand

Description

tone

Carrier signal tone (frequency and phase, linear resource)

frequency_hz

64-bit float

Results:#

Result

Description

updated_tone

Carrier signal tone (frequency and phase, linear resource)

pulse.shift_phase (::pulse::ShiftPhaseOp)#

Apply a relative phase shift to a tone (virtual Z gate)

Syntax:

operation ::= `pulse.shift_phase` $tone `,` $phase_rad `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` qualified(type($tone)) `,` type($phase_rad) `->` qualified(type($updated_tone))

Advances the tone’s frame phase by phase_rad: a virtual Z rotation, in the convention of McKay et al., PRA 96, 022330 (2017). A pulse played after it turns about an axis rotated by -phase_rad. It takes no time and takes effect at the next pulse on the tone, and pulse-fold-phases folds it into the next drive.

Operands:#

Operand

Description

tone

Carrier signal tone (frequency and phase, linear resource)

phase_rad

64-bit float

Results:#

Result

Description

updated_tone

Carrier signal tone (frequency and phase, linear resource)

pulse.square (::pulse::SquarePulseOp)#

Create a constant-amplitude (square) pulse

Syntax:

operation ::= `pulse.square` $duration `,` $amp_real `,` $amp_imag attr-dict `:` type($duration) `,` type($amp_real) `,` type($amp_imag) `->` type($pulse)

A constant envelope amp_real + i amp_imag over duration clock cycles. A constant duration must be positive; one that is a function argument is checked once it is specialized.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

64-bit signless integer

amp_real

floating-point

amp_imag

floating-point

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.sub (::pulse::PulseSubOp)#

Subtract two waveforms element-wise

Syntax:

operation ::= `pulse.sub` $lhs `,` $rhs attr-dict `:` qualified(type($result))

The element-wise difference lhs - rhs of two waveforms of the same duration.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

lhs

Pulse envelope shape (value type, not linear)

rhs

Pulse envelope shape (value type, not linear)

Results:#

Result

Description

result

Pulse envelope shape (value type, not linear)

pulse.sync (::pulse::SyncOp)#

Synchronize multiple lines to the same time

Syntax:

operation ::= `pulse.sync` $lines attr-dict `:` qualified(type($lines)) `->` qualified(type($synced_lines))

Aligns time state of multiple lines. All returned lines will have time = max(T1, …, Tk). Tones pass through unchanged: a frame change made before a sync applies to the next pulse on its tone after it.

Operands:#

Operand

Description

lines

variadic of any pulse line type

Results:#

Result

Description

synced_lines

variadic of any pulse line type

pulse.tanh_ramp (::pulse::TanhRampOp)#

Create a hyperbolic-tangent ramp pulse

Syntax:

operation ::= `pulse.tanh_ramp` $duration `,` $amplitude `,` $sigma attr-dict `:` type($duration) `,` type($amplitude) `,` type($sigma) `->` type($pulse)

Smooth ramp from 0 to amplitude using tanh shaping. sigma controls the steepness of the ramp.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

duration

64-bit signless integer

amplitude

floating-point

sigma

floating-point

Results:#

Result

Description

pulse

Pulse envelope shape (value type, not linear)

pulse.timepoint_subtract (::pulse::TimepointSubtractOp)#

Compute the duration between two timepoints

Syntax:

operation ::= `pulse.timepoint_subtract` $lhs `,` $rhs attr-dict `:` functional-type(operands, results)

The duration lhs - rhs between two timepoints.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

lhs

Abstract point in time on a line

rhs

Abstract point in time on a line

Results:#

Result

Description

duration

Time interval in clock cycles

pulse.timepoint_to_int (::pulse::TimepointToIntOp)#

Convert a timepoint to integer cycles

Syntax:

operation ::= `pulse.timepoint_to_int` $time attr-dict `:` qualified(type($time)) `->` qualified(type($time_in_cycles))

A timepoint as a number of clock cycles from the start of the program.

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

time

Abstract point in time on a line

Results:#

Result

Description

time_in_cycles

64-bit signless integer

pulse.tone (::pulse::ToneOp)#

Create a pulse tone with explicit frequency and phase

Syntax:

operation ::= `pulse.tone` $frequency_hz `,` $phase_rad attr-dict `:` qualified(type($frequency_hz)) `,` qualified(type($phase_rad)) `->` qualified(type($tone))

A tone with an explicit carrier frequency (Hz) and frame phase (radians), rather than the native tone of a line. Tones are linear values: pulse.drive, pulse.readout and the phase and frequency ops return the updated tone.

Each pulse.tone is a new frame, even with the same frequency and phase as another: it allocates its result, so it is not merged with another one or moved out of a loop, and is removed only when unused.

Operands:#

Operand

Description

frequency_hz

floating-point

phase_rad

floating-point

Results:#

Result

Description

tone

Carrier signal tone (frequency and phase, linear resource)

pulse.wait (::pulse::WaitOp)#

Idle a line for a specified duration

Syntax:

operation ::= `pulse.wait` $line `,` $duration `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` functional-type(operands, results)

Idles a drive or readout line for duration and returns the updated line, of the same kind. The scheduler reads the length from a pulse.duration_from_int of a constant. A wait does not change any tone’s frame phase (unlike an OpenPulse delay, which advances the frame); the carrier runs on, so a detuned tone’s phase in its qudit’s frame advances with the elapsed time as it does during pulses.

A wait marked pulse.variable_wait takes its length from a value computed from the function’s float arguments, so it is known only when they are bound. It carries pulse.min_cycles and, optionally, pulse.max_cycles: the bounds of its length in clock cycles. Without bound arguments, the module is scheduled with the wait at pulse.min_cycles; binding them folds the length to a constant within the bounds, and scheduling again gives the exact schedule.

Operands:#

Operand

Description

line

any pulse line type

duration

Time interval in clock cycles

Results:#

Result

Description

updated_line

any pulse line type

pulse.yield (::pulse::YieldOp)#

Yield from a pulse region

Syntax:

operation ::= `pulse.yield` attr-dict ($values^ `:` type($values))?

Ends the body of a pulse.schedule_block, passing the lines, tones and measurements that leave it to the block’s results.

Traits: AlwaysSpeculatableImplTrait, ReturnLike, Terminator

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), RegionBranchTerminatorOpInterface

Effects: MemoryEffects::Effect{}

Operands:#

Operand

Description

values

variadic of a pulse line, tone, measurement, link or call handle

Attributes#

ControlSystemAttr#

The control system a program plays on

The module attribute pulse.control_system: the program clock, as its period in femtoseconds, an exact fraction (clock_period_fs = 1250000/3 is a 2.4 GHz clock; a whole period prints without /1); its lines (#pulse.line); and its controllers (#pulse.controller). A line it does not list has no delay and, with one controller, is that controller’s; with several, such as a run-time qudit’s line, it may be on any of them and moves on every one’s grid.

Example:

module attributes {pulse.control_system = #pulse.control_system<
    clock_period_fs = 500000,
    lines = [#pulse.line<drive, qudits = [0], delay_cycles = 3>],
    controllers = [#pulse.controller<grid_cycles = 2>]>} {}

Parameters:#

Parameter

C++ type

Description

clock_period_fs_numerator

int64_t

clock_period_fs_denominator

int64_t

lines

::llvm::ArrayRef<LineAttr>

controllers

::llvm::ArrayRef<ControllerAttr>

ControllerAttr#

A controller of a control system

What scheduling needs to know of one controller, every field optional and left out at its default:

  • grid_cycles: the program cycles between the instants it can start an operation (default 1); each of its lines moves on that grid.

  • clock_ratio: its own cycles per program cycle, an exact fraction (clock_ratio = 3/5 is a 1.2 GHz controller of a 2 GHz program; a whole ratio prints without /1; default 1). The latencies and the start uncertainty below are in its own cycles.

  • feedback_latency_cycles: from the end of one of its readouts until the outcome is usable on it (default 0).

  • peer_latency_cycles: from there until the outcome reaches another controller: one value for every other controller, or by controller index ({1 = 10, 3 = 7}), 0 for a controller it does not name (default 0).

  • start_uncertainty_cycles: how well its start is known (default 0).

  • persistent_frames: its tones keep their frames from one shot to the next.

  • blocks_on_calls: it plays nothing while one of its classical calls is out.

  • max_duration_cycles: scheduling fails if the program is longer.

On a control system of several controllers, in program cycles, the outcome of a readout on controller r is usable on r ceil(feedback_r / ratio_r) after the readout ends, and on another controller u ceil((feedback_r + peer_r(u) + uncertainty_r) / ratio_r + uncertainty_u / ratio_u) after; the starts of two controllers may be ceil(uncertainty_a / ratio_a + uncertainty_b / ratio_b) apart.

Example: #pulse.controller<grid_cycles = 2, clock_ratio = 1/2, feedback_latency_cycles = 50, peer_latency_cycles = {1 = 20}, start_uncertainty_cycles = 1>.

Parameters:#

Parameter

C++ type

Description

grid_cycles

int64_t

clock_ratio_numerator

int64_t

clock_ratio_denominator

int64_t

feedback_latency_cycles

int64_t

peer_latency_cycles

int64_t

peer_latency_by_controller

::llvm::ArrayRef<std::pair<int64_t, int64_t>>

peer latency by controller index, by increasing index

start_uncertainty_cycles

int64_t

persistent_frames

bool

blocks_on_calls

bool

max_duration_cycles

int64_t

LineAttr#

A drive or readout line of a control system

A drive or readout line: the qudits it reaches (by index on the quantum system), the most tones it plays at once (max_concurrent_tones, default 1), its calibrated delay in program cycles (delay_cycles, default 0: every op on it starts that much later than scheduled), the cycles its fine delay adds to when an op on it ends, rounded up (fine_cycles, default 0: the hardware adds it below a cycle, so a readout’s outcome is usable that much later than its scheduled end plus delay_cycles), and the index of the controller that plays it (controller, default 0). Fields at their default are not printed.

Example: #pulse.line<readout, qudits = [5], delay_cycles = 24, controller = 1>.

Parameters:#

Parameter

C++ type

Description

kind

::pulse::LineKind

an enum of type LineKind

qudits

::llvm::ArrayRef<int64_t>

qudits it reaches

max_concurrent_tones

int64_t

delay_cycles

int64_t

controller

int64_t

fine_cycles

int64_t

QuantumSystemAttr#

The quantum system a program plays on

The module attribute pulse.quantum_system: what a program needs to know of the qudits it plays on, each list indexed by qudit (its index on the quantum system). A compiled module gives qudit_frequency_hz, the frequencies it is compiled for; a module lowered for simulation gives the simulated system, whose frequencies may differ from those its tones were compiled at. Every field may be left out, and the lists given have one entry per qudit.

  • qudit_frequency_hz: each qudit’s 0-1 transition frequency, in Hz.

  • level_counts: the levels each qudit is simulated with, 2 or more.

  • anharmonicity_hz: each qudit’s anharmonicity, in Hz.

  • t1_ns, t2_ns: each qudit’s relaxation and dephasing times, in ns (0: none).

  • drive_scale_rad_per_ns: the Rabi rate of a unit drive amplitude.

  • static_terms: static Hamiltonian terms between qudits (#pulse.static_term).

Example:

module attributes {pulse.quantum_system = #pulse.quantum_system<
    qudit_frequency_hz = [5.0e+09, 5.1e+09], level_counts = [3, 3],
    anharmonicity_hz = [-2.0e+08, -2.1e+08],
    static_terms = [#pulse.static_term<zz, qudits = [0, 1],
                                       rate_hz = 4.5e+04>]>} {}

Parameters:#

Parameter

C++ type

Description

qudit_frequency_hz

::mlir::DenseF64ArrayAttr

level_counts

::mlir::DenseI64ArrayAttr

anharmonicity_hz

::mlir::DenseF64ArrayAttr

t1_ns

::mlir::DenseF64ArrayAttr

t2_ns

::mlir::DenseF64ArrayAttr

drive_scale_rad_per_ns

::mlir::DenseF64ArrayAttr

static_terms

::mlir::ArrayAttr

ScheduleStateAttr#

How far a function is scheduled

Syntax:

#pulse.schedule_state<
  ::pulse::ScheduleState   # value
>

The pulse.schedule_state of a func.func. Without one a function is unscheduled: its timed ops may carry a start or a length, or not. timed: every timed op that runs has its start and its length (pulse-verify checks). placed: timed, and each line’s calibrated delay is applied to its ops’ starts. pulse-schedule-* writes placed when it moves some op by a line delay, timed otherwise; passes that change lengths or the order of ops on a line, such as pulse-merge-waits, take only an unscheduled function.

Example:

func.func @main() attributes {
    pulse.schedule_state = #pulse.schedule_state<timed>} {
  return
}

Parameters:#

Parameter

C++ type

Description

value

::pulse::ScheduleState

an enum of type ScheduleState

StaticTermAttr#

A static Hamiltonian term of a quantum system

A term of the system’s Hamiltonian that does not depend on time, of the operator kind on the qudits qudits (device indices, as many as the kind acts on) at the rate rate_hz (Hz, the coefficient over 2 pi). A module’s quantum system (#pulse.quantum_system) lists its terms in static_terms; the lowering to QOp adds each one between simulated qudits.

  • zz: two distinct qudits; rate_hz is the ZZ rate zeta / 2 pi, zeta = E11 - E10 - E01 + E00, modeled as zeta n_a n_b.

Example:

module attributes {pulse.quantum_system = #pulse.quantum_system<
    static_terms = [
      #pulse.static_term<zz, qudits = [3, 4], rate_hz = 4.5e+04>]>} {}

Parameters:#

Parameter

C++ type

Description

kind

::pulse::StaticTermKind

an enum of type StaticTermKind

qudits

::llvm::ArrayRef<int64_t>

qudits, by device index

rate_hz

::llvm::APFloat

rate in Hz, an f64

Types#

DriveLineType#

Physical drive channel (linear resource)

Syntax: !pulse.drive_line

A drive_line represents a physical drive channel. It is a linear resource: each value is produced exactly once and consumed exactly once. Operations that consume a drive line produce a new value with advanced time state.

DurationType#

Time interval in clock cycles

Syntax: !pulse.duration

IQDataType#

Raw IQ signal data from readout (value type)

Syntax: !pulse.iq_data

MeasurementType#

The level a readout observed

Syntax: !pulse.measurement

QuditType#

A qudit of the quantum system

Syntax: !pulse.qudit

A reference to one qudit, as pulse.qudit_alloc gives it or as a function takes a runtime qudit. Its number of levels is the quantum system’s, not part of the type.

ReadoutLineType#

Physical readout channel (linear resource)

Syntax: !pulse.readout_line

A readout_line represents a physical readout channel. Like drive lines, readout lines are linear resources with time state.

TimepointType#

Abstract point in time on a line

Syntax: !pulse.timepoint

ToneType#

Carrier signal tone (frequency and phase, linear resource)

Syntax: !pulse.tone

A tone represents a carrier tone tracking frequency and phase. Tones are separate from physical lines, enabling cross-resonance and position-independent calibrations.

WaveformType#

Pulse envelope shape (value type, not linear)

Syntax: !pulse.waveform

A waveform represents a time-domain pulse envelope. Waveforms are value types and can be freely passed around and applied to multiple lines.

Enums#

LineKind#

The kind of a line

Cases:#

Symbol

Value

String

Drive

0

drive

Readout

1

readout

ReadoutMode#

Readout mode

Cases:#

Symbol

Value

String

IQ

0

iq

Discriminated

1

discriminated

Trace

2

trace

Counts

3

counts

SchedulePolicy#

Schedule policy

Cases:#

Symbol

Value

String

ASAP

0

asap

ALAP

1

alap

ScheduleState#

How far a function is scheduled

Cases:#

Symbol

Value

String

Unscheduled

0

unscheduled

Timed

1

timed

Placed

2

placed

StaticTermKind#

Operator of a static Hamiltonian term

Cases:#

Symbol

Value

String

ZZ

0

zz